<?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.DriverActivityHistoryMapper">
|
|
<!-- 通用查询映射结果 -->
|
<resultMap id="BaseResultMap" type="com.stylefeng.guns.modular.system.model.DriverActivityHistory">
|
<id column="id" property="id"/>
|
<result column="day" property="day"/>
|
<result column="driverId" property="driverId"/>
|
<result column="type" property="type"/>
|
<result column="activityId" property="activityId"/>
|
<result column="carryOut" property="carryOut"/>
|
<result column="money" property="money"/>
|
<result column="collectionTime" property="collectionTime"/>
|
<result column="insertTime" property="insertTime"/>
|
|
</resultMap>
|
|
|
|
<select id="query" resultType="map">
|
select * from
|
(
|
select
|
DATE_FORMAT(`day`, '%Y.%m.%d') as time,
|
if((select count(id) from t_driver_activity_history where driverId = #{driverId}) > (select count(id) from t_driver_activity_history where driverId = #{driverId} and carryOut = 2), 1, 2) as carryOut
|
from t_driver_activity_history where driverId = #{driverId} group by `day`
|
) as a order by a.time desc limit #{pageNum}, #{size}
|
</select>
|
|
<select id="queryList" resultType="DriverActivityHistory">
|
select
|
id as id,
|
`day` as `day`,
|
driverId as driverId,
|
`type` as `type`,
|
activityId as activityId,
|
carryOut as carryOut,
|
money as money,
|
collectionTime as collectionTime,
|
insertTime as insertTime
|
from t_driver_activity_history where `day` between #{start} and #{end}
|
<if test="null != type">
|
and `type` = #{type}
|
</if>
|
<if test="null != carryOut">
|
and carryOut = #{carryOut}
|
</if>
|
<if test="null != driverId">
|
and driverId = #{driverId}
|
</if>
|
</select>
|
</mapper>
|