From a092e089316c05c6f7732d779e8fdff6060592c0 Mon Sep 17 00:00:00 2001 From: zhangherong <571457620@qq.com> Date: 星期五, 09 五月 2025 11:10:28 +0800 Subject: [PATCH] art: 设备管理-维修看板-维修状态统计,维修列表统计 --- lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/EamReportRepairMapper.xml | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 50 insertions(+), 2 deletions(-) diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/EamReportRepairMapper.xml b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/EamReportRepairMapper.xml index fb16bd6..55e6baf 100644 --- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/EamReportRepairMapper.xml +++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/EamReportRepairMapper.xml @@ -14,7 +14,7 @@ <when test="equipmentIds != null and equipmentIds.size() > 0 "> AND t2.equipment_code IN <foreach collection="equipmentIds" item="equipmentId" index="index" open="(" close=")" separator=","> - {equipmentId} + #{equipmentId} </foreach> </when> <otherwise> @@ -46,6 +46,54 @@ AND t1.fault_start_time BETWEEN #{ eamReportRepair.startTime } AND #{ eamReportRepair.endTime } </if> </where> - ORDER BY t1.fault_start_time DESC + ORDER BY t1.create_time DESC + </select> + + <select id="equipmentRepairStatistics" resultType="org.jeecg.modules.eam.vo.EquipmentRepairStatistics"> + select FORMAT(err.create_time, 'yyyy-MM') as monthStr, + COUNT(1) as reportNumber, + SUM(CASE WHEN err.report_status = 'COMPLETE' THEN 1 ELSE 0 END) as repairedNumber + from eam_report_repair err + inner join eam_equipment e + on err.equipment_id = e.id + where err.report_status != 'ABOLISH' and err.del_flag = 0 and e.del_flag = 0 + <if test="productionIds != null"> + AND e.org_id IN + <foreach collection="productionIds" item="productionId" index="index" open="(" close=")" separator=","> + #{productionId} + </foreach> + </if> + and err.create_time >= #{start} + and err.create_time < #{end} + group by FORMAT(err.create_time, 'yyyy-MM') + </select> + <select id="repairStatusStatistics" resultType="org.jeecg.modules.eam.vo.EquipmentRepairStatusStatistics"> + SELECT + SUM(CASE WHEN t.report_status='WAIT_REPAIR' THEN 1 ELSE 0 END) AS waitRepair, + SUM(CASE WHEN t.report_status='UNDER_REPAIR' THEN 1 ELSE 0 END) AS underRepair, + SUM(CASE WHEN t.report_status='WAIT_SPARES' THEN 1 ELSE 0 END) AS waitSpares, + SUM(CASE WHEN t.report_status='WAIT_CONFIRM' THEN 1 ELSE 0 END) AS waitConfirm + from eam_report_repair t + where t.report_status not in ('ABOLISH', 'COMPLETE') and t.del_flag = 0 + </select> + + <select id="repairList" resultType="org.jeecg.modules.eam.vo.EquipmentRepairListVO"> + select e.equipment_code, + e.equipment_name, + e.org_id, + e.installation_position, + err.create_by as reportOperator, + err.fault_start_time, + ero.repairer as repairOperator, + ero.actual_start_time as repairStartTime, + err.report_status + from eam_report_repair err + left join eam_equipment e + on err.equipment_id = e.id + left join eam_repair_order ero + on ero.report_id = err.id + where err.report_status not in ('ABOLISH', 'COMPLETE') + and err.del_flag = 0 + order by e.org_id, err.fault_start_time </select> </mapper> \ No newline at end of file -- Gitblit v1.9.3