| | |
| | | |
| | | <select id="query" resultType="map"> |
| | | select |
| | | aa.*, |
| | | (CASE WHEN (select count(id) from t_driver_activity_history where driverId = #{driverId} and carryOut = 1 and `day` = aa.time) = 0 THEN 2 ELSE 1 END) carryOut |
| | | a.*, |
| | | CASE WHEN b.num = 0 THEN 2 ELSE 1 END as carryOut |
| | | from ( |
| | | select |
| | | DATE_FORMAT(`day`, '%Y-%m-%d') as time, |
| | | DATE_FORMAT(`day`, '%Y-%m-%d') as paramTime |
| | | from t_driver_activity_history where driverId = #{driverId} group by `day` |
| | | ) as aa order by aa.time desc limit #{pageNum}, #{size} |
| | | select |
| | | DATE_FORMAT(`day`, '%Y-%m-%d') as time, |
| | | DATE_FORMAT(`day`, '%Y-%m-%d') as paramTime |
| | | from t_driver_activity_history where driverId = #{driverId} group by `day` |
| | | ) as a |
| | | left join (select `day`, count(id) as num from t_driver_activity_history where driverId = #{driverId} and carryOut = 1 group by `day`) b on (a.time = b.`day`) order by a.time desc limit #{pageNum}, #{size} |
| | | </select> |
| | | |
| | | <select id="queryList" resultType="DriverActivityHistory"> |
| | |
| | | and driverId = #{driverId} |
| | | </if> |
| | | </select> |
| | | |
| | | |
| | | |
| | | <select id="queryHistoryList" resultType="DriverActivityHistory"> |
| | | select |
| | | id as id, |
| | | `day` as `day`, |
| | | driverId as driverId, |
| | | `type` as `type`, |
| | | activityId as activityId, |
| | | carryOut as carryOut, |
| | | money as money, |
| | | 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> |