| | |
| | | segment_distance, gps_point_count, gps_ids, task_id, task_code, calculate_method |
| | | FROM tb_vehicle_gps_segment_mileage |
| | | WHERE vehicle_id = #{vehicleId} |
| | | AND segment_start_time between #{startDate} and #{endDate} |
| | | AND segment_start_time between #{startTime} and #{endTime} |
| | | AND segment_end_time >= #{startTime} |
| | | AND segment_distance > 0 |
| | | ORDER BY segment_start_time |
| | |
| | | WHERE task_id = #{taskId} |
| | | </select> |
| | | |
| | | <!-- 插入或更新分段里程记录(避免重复插入) --> |
| | | <insert id="insertVehicleGpsSegmentMileage" parameterType="VehicleGpsSegmentMileage"> |
| | | INSERT INTO tb_vehicle_gps_segment_mileage |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | |
| | | <if test="taskCode != null">#{taskCode},</if> |
| | | <if test="calculateMethod != null">#{calculateMethod},</if> |
| | | </trim> |
| | | ON DUPLICATE KEY UPDATE |
| | | vehicle_no = VALUES(vehicle_no), |
| | | segment_end_time = VALUES(segment_end_time), |
| | | start_longitude = VALUES(start_longitude), |
| | | start_latitude = VALUES(start_latitude), |
| | | end_longitude = VALUES(end_longitude), |
| | | end_latitude = VALUES(end_latitude), |
| | | segment_distance = VALUES(segment_distance), |
| | | gps_point_count = VALUES(gps_point_count), |
| | | gps_ids = VALUES(gps_ids), |
| | | task_id = VALUES(task_id), |
| | | task_code = VALUES(task_code), |
| | | calculate_method = VALUES(calculate_method), |
| | | update_time = NOW() |
| | | </insert> |
| | | |
| | | <update id="updateVehicleGpsSegmentMileage" parameterType="VehicleGpsSegmentMileage"> |