| | |
| | | s.non_task_mileage, s.task_ratio, s.gps_point_count, s.task_count, s.segment_count, |
| | | s.data_source, s.create_time, s.update_time |
| | | from tb_vehicle_mileage_stats s |
| | | where s.vehicle_id = #{vehicleId} and s.stat_date = #{statDate} |
| | | where s.vehicle_id = #{vehicleId} and DATE(s.stat_date) = DATE(#{statDate}) |
| | | limit 1 |
| | | </select> |
| | | |
| | | <select id="selectTaskTimeIntervals" resultMap="TaskTimeIntervalResult"> |
| | | select tv.task_id, t.create_time as start_time, |
| | | select tv.task_id, t.actual_start_time as start_time, |
| | | IFNULL(t.actual_end_time, NOW()) as end_time |
| | | from sys_task_vehicle tv |
| | | inner join sys_task t on tv.task_id = t.task_id |
| | | where tv.vehicle_id = #{vehicleId} |
| | | and t.del_flag = '0' |
| | | and t.actual_end_time is not null |
| | | and t.create_time < #{endTime} |
| | | and t.actual_end_time > #{startTime} |
| | | order by t.create_time |
| | | and ( |
| | | (t.actual_end_time is not null and t.actual_start_time > #{startTime} and t.actual_end_time < #{endTime}) |
| | | or (t.actual_end_time is null and t.actual_start_time > #{startTime}) |
| | | ) |
| | | order by t.actual_start_time |
| | | </select> |
| | | |
| | | <insert id="insertVehicleMileageStats" parameterType="VehicleMileageStats" useGeneratedKeys="true" keyProperty="statsId"> |
| | |
| | | <if test="dataSource != null">#{dataSource},</if> |
| | | NOW() |
| | | </trim> |
| | | ON DUPLICATE KEY UPDATE |
| | | vehicle_no = VALUES(vehicle_no), |
| | | total_mileage = VALUES(total_mileage), |
| | | task_mileage = VALUES(task_mileage), |
| | | non_task_mileage = VALUES(non_task_mileage), |
| | | task_ratio = VALUES(task_ratio), |
| | | gps_point_count = VALUES(gps_point_count), |
| | | task_count = VALUES(task_count), |
| | | segment_count = VALUES(segment_count), |
| | | data_source = VALUES(data_source), |
| | | update_time = NOW() |
| | | </insert> |
| | | |
| | | <update id="updateVehicleMileageStats" parameterType="VehicleMileageStats"> |