<?xml version="1.0" encoding="UTF-8"?>
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
<mapper namespace="com.stylefeng.guns.modular.system.dao.DriverOnlineMapper">
|
|
<!-- 通用查询映射结果 -->
|
<resultMap id="BaseResultMap" type="com.stylefeng.guns.modular.system.model.DriverOnline">
|
<id column="id" property="id" />
|
<result column="driverId" property="driverId" />
|
<result column="date" property="date" />
|
<result column="duration" property="duration" />
|
<result column="assessment" property="assessment" />
|
</resultMap>
|
|
|
<select id="query" resultType="DriverOnline">
|
select
|
id as id,
|
driverId as driverId,
|
`date` as `date`,
|
duration as duration,
|
assessment as assessment
|
from t_driver_online where driverId = #{driverId} and DATE_FORMAT(`date`, '%Y-%m-%d') = #{day} and type = #{type} and assessment = #{assessment}
|
</select>
|
|
|
|
<select id="querySumTime" resultType="int">
|
select
|
ifnull(sum(duration), 0) as duration
|
from t_driver_online where 1 = 1
|
<if test="null != driverId">
|
and driverId = #{driverId}
|
</if>
|
<if test="null != assessment">
|
and assessment = #{assessment}
|
</if>
|
<if test="null != start and null != end">
|
and `date` between #{start} and #{end}
|
</if>
|
</select>
|
|
|
<select id="queryList" resultType="DriverOnline">
|
select
|
id as id,
|
driverId as driverId,
|
`date` as `date`,
|
duration as duration,
|
assessment as assessment
|
from t_driver_online where DATE_FORMAT(`date`, '%Y-%m-%d') = #{day}
|
<if test="null != driverId">
|
and driverId = #{driverId}
|
</if>
|
<if test="null != type">
|
and type = #{type}
|
</if>
|
and duration >= #{duration}
|
</select>
|
</mapper>
|