| | |
| | | <select id="getList1" resultType="map" parameterType="com.baomidou.mybatisplus.plugins.Page"> |
| | | select aa.startTime as times, aa.driverNum, bb.duration as timeNumber from ( |
| | | select a.startTime, count(a.driverId) as driverNum from ( |
| | | select DATE_FORMAT(startTime, '%Y-%m-%d') as startTime, driverId from t_driver_work group by DATE_FORMAT(startTime, '%Y-%m-%d'), driverId |
| | | select DATE_FORMAT(startTime, '%Y-%m-%d') as startTime, driverId from t_driver_work where 1 = 1 |
| | | <if test="null != company"> |
| | | and driverId in (select id from t_driver where companyId = #{company}) |
| | | </if> |
| | | group by DATE_FORMAT(startTime, '%Y-%m-%d'), driverId |
| | | ) as a group by a.startTime |
| | | ) as aa |
| | | left join ( |
| | | select DATE_FORMAT(startTime, '%Y-%m-%d') as startTime, sum(if(endTime is null, UNIX_TIMESTAMP(), UNIX_TIMESTAMP(endTime)) - UNIX_TIMESTAMP(startTime)) as duration from t_driver_work group by DATE_FORMAT(startTime, '%Y-%m-%d') |
| | | select DATE_FORMAT(startTime, '%Y-%m-%d') as startTime, sum(if(endTime is null, UNIX_TIMESTAMP(), UNIX_TIMESTAMP(endTime)) - UNIX_TIMESTAMP(startTime)) as duration from t_driver_work where 1 = 1 |
| | | <if test="null != company"> |
| | | and driverId in (select id from t_driver where companyId = #{company}) |
| | | </if> |
| | | group by DATE_FORMAT(startTime, '%Y-%m-%d') |
| | | ) as bb on (aa.startTime = bb.startTime) |
| | | ORDER BY aa.startTime DESC |
| | | </select> |
| | |
| | | a.duration as timeNumber |
| | | from (select DATE_FORMAT(startTime, '%Y-%m-%d') as startTime, driverId, sum(if(endTime is null, UNIX_TIMESTAMP(), UNIX_TIMESTAMP(endTime)) - UNIX_TIMESTAMP(startTime)) as duration from t_driver_work group by DATE_FORMAT(startTime, '%Y-%m-%d'), driverId) as a |
| | | left join t_driver b on (a.driverId = b.id) |
| | | where a.startTime = #{times} |
| | | where a.startTime = #{times} and b.companyId = #{company} |
| | | </select> |
| | | <select id="getTotal" resultType="map"> |
| | | SELECT COUNT(o.driverId) driverNum,SUM(o.timeNumber) timeNumber from (SELECT |