| | |
| | | d.device_id, |
| | | d.device_number, |
| | | d.device_name, |
| | | d.device_model, |
| | | d.check_time, |
| | | d.check_index, |
| | | d.check_method, |
| | |
| | | d.check_charger_user_id, |
| | | CASE WHEN d.check_charger_user='' or d.check_charger_user is null THEN u.name |
| | | ELSE d.check_charger_user END AS check_charger_user, |
| | | d.environment, |
| | | d.check_basis, |
| | | d.appearance_status, |
| | | d.running_status, |
| | | d.remark, |
| | | d.file_name, |
| | | d.file_url, |
| | | d.create_user, |
| | | d.create_time, |
| | | d.update_user, |
| | |
| | | WHEN dd.review_status = 0 THEN 3 |
| | | WHEN dd.review_status = 1 THEN 2 |
| | | WHEN dd.record_contrast_id IS NOT NULL THEN 1 |
| | | ELSE 0 END record_contrast_status |
| | | ELSE 0 END record_contrast_status, |
| | | CASE WHEN dev.next_examine_date IS NOT NULL |
| | | AND dev.next_examine_date <= date_add(curdate(), interval 1 month) |
| | | AND (dev.last_examine_date IS NULL OR dev.last_examine_date < str_to_date(concat(left(d.check_time, 7), '-01'), '%Y-%m-%d')) |
| | | THEN 1 ELSE 0 END red_flag, |
| | | (select count(*) from device_examine_attachment a where a.plan_details_id = d.plan_details_id) attachment_count |
| | | from device_examine_plan_details d |
| | | left join user u on u.id = d.check_charger_user_id |
| | | left join device_examine_record dc on d.plan_details_id = dc.plan_details_id |
| | | left join device_examine_record_contrast dd on dd.plan_details_id = dc.plan_details_id |
| | | order by check_time asc |
| | | left join device_examine_record_contrast dd on dd.plan_details_id = d.plan_details_id |
| | | left join device dev on dev.id = d.device_id |
| | | ) a |
| | | <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''"> |
| | | ${ew.customSqlSegment} |
| | | </if> |
| | | order by device_number asc, check_time desc |
| | | </select> |
| | | |
| | | </mapper> |