diff --git a/inspect-main/inspect-main-task/src/main/resources/mapper/task/PatrolResultMapper.xml b/inspect-main/inspect-main-task/src/main/resources/mapper/task/PatrolResultMapper.xml index 18851b1..2ec06a8 100644 --- a/inspect-main/inspect-main-task/src/main/resources/mapper/task/PatrolResultMapper.xml +++ b/inspect-main/inspect-main-task/src/main/resources/mapper/task/PatrolResultMapper.xml @@ -874,45 +874,127 @@ - SELECT a.patrol_point_id, d.area_name, d.patrol_device_name, f.patrol_point_name, CASE - WHEN e.`value` = 'check image' THEN - '0' ELSE e.`value` - END `value`, - h.dict_value line_id, + WHEN e.`value` = 'check image' THEN '0' + ELSE e.`value` + END AS `value`, + h.dict_value AS line_id, e.create_time, a.channel_code - FROM - patrol_preset_pos a - LEFT JOIN patrol_result e ON a.patrol_point_id = e.device_id + FROM patrol_preset_pos a + LEFT JOIN patrol_result e + ON a.patrol_point_id = e.device_id RIGHT JOIN ( SELECT - MAX( h.line_id ) line_id - FROM - patrol_result h + MAX(h.line_id) AS line_id + FROM patrol_result h - - DATE_FORMAT( h.create_time, '%y%m%d' ) = DATE_FORMAT( #{createTime}, '%y%m%d' ) + + h.create_time =]]> DATE(#{createTime}) + AND h.create_time DATE_ADD(DATE(#{createTime}), INTERVAL 1 DAY) - GROUP BY - h.device_id + GROUP BY h.device_id ) i ON e.line_id = i.line_id - RIGHT JOIN ( SELECT g.dict_value, g.dict_label FROM sys_dict_data g WHERE g.dict_type = 'oil_api' ) h ON - h.dict_label = a.patrol_point_id - LEFT JOIN basedata_eqpbook d ON a.eqp_book_id = d.eqp_book_id - LEFT JOIN basedata_patrolpoint f ON a.patrol_point_id = f.patrol_point_id + RIGHT JOIN ( + SELECT g.dict_value, g.dict_label + FROM sys_dict_data g + WHERE g.dict_type = 'oil_api' + ) h ON h.dict_label = a.patrol_point_id + LEFT JOIN basedata_eqpbook d + ON a.eqp_book_id = d.eqp_book_id + LEFT JOIN basedata_patrolpoint f + ON a.patrol_point_id = f.patrol_point_id ORDER BY d.area_name, d.patrol_device_name - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +