From 4b27dd367eae2f24958c6bb857fb6959dcdb7a4a Mon Sep 17 00:00:00 2001
From: qushaowei <qushaowei@163.com>
Date: 星期五, 13 六月 2025 18:04:46 +0800
Subject: [PATCH] 报表提交

---
 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/RepairOrderMapper.xml |  200 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 198 insertions(+), 2 deletions(-)

diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/RepairOrderMapper.xml b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/RepairOrderMapper.xml
index 9b2fc6a..1db6798 100644
--- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/RepairOrderMapper.xml
+++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/RepairOrderMapper.xml
@@ -16,7 +16,6 @@
         t1.preventive_measure preventiveMeasure,
         t1.fault_remove faultRemove,
         t1.fault_description faultDescription,
-        t1.fault_time faultTime,
         t1.photo photo,
         t1.is_stop isStop,
         t1.maintenance_method maintenanceMethod,
@@ -34,6 +33,7 @@
         t1.business_type businessType,
         t1.responsibility_id responsibilityId,
         t1.outsourcing_unit outsourcingUnit,
+        t1.actual_hour actualHour,
         t1.remark,
         t1.repair_order_uda1 repairOrderUda1,
         t1.repair_order_uda2 repairOrderUda2,
@@ -46,10 +46,12 @@
         report.accept_time acceptTime,
         report.err_uda3 errUda3,
         report.fault_hour faultHour,
+        report.fault_time faultTime,
         t2.num equipmentNum,
         t2.name equipmentName,
         t2.model equipmentModel,
         t2.specific_equipment specificEquipment,
+        t2.equipment_importance_id equipmentImportanceId,
         t3.depart_name departName,
         t4.name outsourcingUnitName,
         t5.realname responsibilityName,
@@ -61,6 +63,7 @@
         left join mom_base_supplier t4 on t1.outsourcing_unit = t4.id
         left join sys_user t5 on t5.id = t1.responsibility_id
         left join mom_base_team t6 on t6.id=t1.team_id
+        left join mom_eam_repair_order_fault_analysis t7 on t7.repair_order_id=t1.id
         where t1.del_flag = 0
         <if test="id != null and id != ''">
             and t1.id = #{id}
@@ -95,11 +98,45 @@
         <if test="specificEquipment != null and specificEquipment != ''">
             and t2.specific_equipment = #{specificEquipment}
         </if>
+        <if test="equipmentImportanceId != null and  equipmentImportanceId != ''">
+            and t2.equipment_importance_id = #{equipmentImportanceId}
+        </if>
+        <if test="faultCause != null and  faultCause != ''">
+            and t7.repair_order_fault_analysis_uda2 = #{faultCause}
+        </if>
         <if test="teamId != null and teamId != ''">
             and t1.team_id = #{teamId}
         </if>
         <if test="repairOrderType != null and repairOrderType != ''">
-        and t1.repair_order_type = #{repairOrderType}
+            and t1.repair_order_type = #{repairOrderType}
+        </if>
+        <if test="faultStartTime != null">
+            and report.fault_time &gt;= #{faultStartTime}
+        </if>
+        <if test="faultEndTime != null">
+            and report.fault_time &lt;= #{faultEndTime}
+        </if>
+        <if test="createStartTime != null">
+            and t1.create_time &gt;= #{createStartTime}
+        </if>
+        <if test="createEndTime != null">
+            and t1.create_time &lt;= #{createEndTime}
+        </if>
+
+        <if test="workCenterIds != null">
+            and t2.work_center_id in
+            <foreach collection="workCenterIds" open="(" separator="," close=")" item="workCenterId">
+                #{workCenterId}
+            </foreach>
+        </if>
+        <if test="equipmentId != null">
+            and t1.equipment_id = #{equipmentId}
+        </if>
+        <if test="statusEnums != null">
+            and t1.status not in
+            <foreach collection="statusEnums" open="(" separator="," close=")" item="statusEnum">
+                #{statusEnum}
+            </foreach>
         </if>
         order by t1.create_time desc
     </select>
@@ -157,4 +194,163 @@
 
 
     </select>
+
+    <select id="getAllFaultCause"  parameterType="Map" resultType="Map">
+        SELECT
+            t1.repair_order_fault_analysis_uda2,
+            COUNT ( t1.repair_order_fault_analysis_uda2 ) AS total,
+            t2.item_text AS faultCause
+        FROM
+        ( SELECT * FROM v_sys_dict WHERE dict_code = 'repair_order_fault_cause' ) t2
+        LEFT JOIN mom_eam_repair_order_fault_analysis t1 ON t1.repair_order_fault_analysis_uda2 = t2.item_value
+        WHERE
+            del_flag = '0'
+        GROUP BY
+            t1.repair_order_fault_analysis_uda2,
+            t2.item_text
+
+    </select>
+
+    <select id="getFaultCause"  parameterType="Map" resultType="Map">
+        SELECT
+            t3.item_text  as  faultCause,
+            count(t4.repair_order_fault_analysis_uda2) as total
+        FROM
+                ( SELECT * FROM v_sys_dict WHERE dict_code = 'repair_order_fault_cause' ) t3
+                    LEFT JOIN (
+                SELECT
+                    t1.repair_order_fault_analysis_uda2
+                FROM
+                    mom_eam_repair_order_fault_analysis t1
+                        LEFT JOIN mom_eam_repair_order t2 ON t1.repair_order_id = t2.id
+                WHERE
+                    t1.del_flag = 0
+                  AND t2.del_flag = 0
+                  AND t2.equipment_id = #{equipmentId}
+            ) t4 ON t3.item_value = t4.repair_order_fault_analysis_uda2
+        group by t3.item_text
+    </select>
+
+    <select id="getFaultCausePie"  parameterType="Map" resultType="Map">
+        SELECT
+            t3.item_text  as  x,
+            count(t4.repair_order_fault_analysis_uda2) as y
+        FROM
+                ( SELECT * FROM v_sys_dict WHERE dict_code = 'repair_order_fault_cause' ) t3
+                    LEFT JOIN (
+                SELECT
+                    t1.repair_order_fault_analysis_uda2
+                FROM
+                    mom_eam_repair_order_fault_analysis t1
+                    LEFT JOIN mom_eam_repair_order t2 ON t1.repair_order_id = t2.id
+                    left join mom_eam_equipment t11 on t2.equipment_id = t11.id
+                WHERE
+                    t1.del_flag = 0
+                  AND t2.del_flag = 0
+                 <if test="params.equipmentNum != null and params.equipmentNum != ''">
+                     and t11.num like concat('%',#{params.equipmentNum},'%')
+                 </if>
+                <if test="params.useId != null and params.useId != ''">
+                    and t11.use_id = #{params.useId}
+                </if>
+                <if test="params.faultStartTime != null">
+                    and t2.create_time &gt;= #{params.faultStartTime}
+                </if>
+                <if test="params.faultEndTime != null">
+                    and t2.create_time &lt;= #{params.faultEndTime}
+                </if>
+            ) t4 ON t3.item_value = t4.repair_order_fault_analysis_uda2
+        group by t3.item_text
+    </select>
+
+    <select id="getFaultCauseBar"  parameterType="Map" resultType="Map">
+        SELECT
+            t3.item_text  as  item,
+            count(t4.repair_order_fault_analysis_uda2) as count
+        FROM
+            ( SELECT * FROM v_sys_dict WHERE dict_code = 'repair_order_fault_cause' ) t3
+            LEFT JOIN (
+                SELECT
+                 t1.repair_order_fault_analysis_uda2
+                 FROM
+                mom_eam_repair_order_fault_analysis t1
+                    LEFT JOIN mom_eam_repair_order t2 ON t1.repair_order_id = t2.id
+                    left join mom_eam_equipment t11 on t2.equipment_id = t11.id
+                WHERE
+                t1.del_flag = 0
+                AND t2.del_flag = 0
+            <if test="params.equipmentNum != null and params.equipmentNum != ''">
+                and t11.num like concat('%',#{params.equipmentNum},'%')
+            </if>
+            <if test="params.useId != null and params.useId != ''">
+                and t11.use_id = #{params.useId}
+            </if>
+            <if test="params.faultStartTime != null">
+                and t2.create_time &gt;= #{params.faultStartTime}
+            </if>
+            <if test="params.faultEndTime != null">
+                and t2.create_time &lt;= #{params.faultEndTime}
+            </if>
+        ) t4 ON t3.item_value = t4.repair_order_fault_analysis_uda2
+        group by t3.item_text
+    </select>
+
+    <select id="getEquipmentFaultCause"  parameterType="Map" resultType="Map">
+        select count(SUBSTRING(CONVERT(VARCHAR(10), t1.fault_time, 120), 1, 10)) as '璁惧鏁呴殰娆℃暟',
+        SUBSTRING(CONVERT(VARCHAR(10), t1.fault_time, 120), 1, 10) as type from mom_eam_equipment_report_repair t1
+        left join mom_eam_equipment t2 on t1.equipment_id = t2.id
+        where 1=1
+        <if test="params.equipmentNum != null and params.equipmentNum != ''">
+            and t2.num like concat('%',#{params.equipmentNum},'%')
+        </if>
+        <if test="params.useId != null and params.useId != ''">
+            and t2.use_id = #{params.useId}
+        </if>
+        <if test="params.faultStartTime != null">
+            and t1.fault_time &gt;= #{params.faultStartTime}
+        </if>
+        <if test="params.faultEndTime != null">
+            and t1.fault_time &lt;= #{params.faultEndTime}
+        </if>
+        GROUP BY SUBSTRING(CONVERT(VARCHAR(10), t1.fault_time, 120), 1, 10)
+    </select>
+
+    <select id="getMTPF"  parameterType="Map" resultType="Map">
+        SELECT
+            t3.item_text  as  item,
+            count(t4.repair_order_fault_analysis_uda2) as count
+            FROM
+            ( SELECT * FROM v_sys_dict WHERE dict_code = 'repair_order_fault_cause' ) t3
+                LEFT JOIN (
+                    SELECT
+                        t1.repair_order_fault_analysis_uda2
+                        FROM
+                    mom_eam_repair_order_fault_analysis t1
+                    LEFT JOIN mom_eam_repair_order t2 ON t1.repair_order_id = t2.id
+                    left join mom_eam_equipment t11 on t2.equipment_id = t11.id
+                        WHERE
+                        t1.del_flag = 0
+                        AND t2.del_flag = 0
+            <if test="params.equipmentNum != null and params.equipmentNum != ''">
+                and t11.num like concat('%',#{params.equipmentNum},'%')
+            </if>
+            <if test="params.useId != null and params.useId != ''">
+                and t11.use_id = #{params.useId}
+            </if>
+            <if test="params.faultStartTime != null">
+                and t2.create_time &gt;= #{params.faultStartTime}
+            </if>
+            <if test="params.faultEndTime != null">
+                and t2.create_time &lt;= #{params.faultEndTime}
+            </if>
+            ) t4 ON t3.item_value = t4.repair_order_fault_analysis_uda2
+        group by t3.item_text
+    </select>
+
+    <update id="updateRepair" parameterType="String">
+        UPDATE mom_eam_repair_order
+        SET actual_end_time = null,
+            status = '3'
+        WHERE id = #{id}
+    </update>
 </mapper>

--
Gitblit v1.9.3