From 6fcb995547973223f4401745e5c2fbc77230089f Mon Sep 17 00:00:00 2001
From: Lius <Lius2225@163.com>
Date: 星期四, 10 七月 2025 10:42:33 +0800
Subject: [PATCH] 生产设备自主维护点检表导出

---
 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/EamInspectionOrderMapper.xml |  146 ++++++++++++++++++++++++++++++++++++------------
 1 files changed, 108 insertions(+), 38 deletions(-)

diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/EamInspectionOrderMapper.xml b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/EamInspectionOrderMapper.xml
index 2c34c4a..f67c832 100644
--- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/EamInspectionOrderMapper.xml
+++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/EamInspectionOrderMapper.xml
@@ -10,47 +10,117 @@
         ${ew.customSqlSegment}
     </select>
 
-    <select id="findInspectionUser"  parameterType="String" resultType="org.jeecg.modules.eam.vo.InspectionVo">
-
-        SELECT
-            t2.realname operator,
-            t3.realname as confirmUser,
-            CONVERT(VARCHAR, DATEPART(DAY, t1.inspection_date)) as dayTime
+    <select id="findInsOrderBaseInfo" resultType="org.jeecg.modules.eam.request.EamInspectionOrderBaseResponse">
+        SELECT TOP 1
+            t2.equipment_name equipmentName,
+            t2.equipment_code equipmentCode,
+            t2.equipment_model equipmentModel,
+            t2.factory_org_code factoryName,
+            DATEPART( YEAR, t1.inspection_date ) AS inspectionYear,
+            DATEPART( MONTH, t1.inspection_date ) AS inspectionMonth
         FROM
             eam_inspection_order t1
-            left join sys_user t2 on t1.operator = t2.username
-            left join sys_user t3 on t1.confirm_user = t3.username
-        WHERE t1.del_flag = '0'
-          AND t1.equipment_id = #{equipmentId}
-        AND SUBSTRING ( CONVERT ( VARCHAR ( 10 ), t1.inspection_date, 120 ), 1, 7 ) = SUBSTRING(CONVERT(VARCHAR(10),#{yearMonth}, 120 ), 1, 7 )
-    </select>
-
-    <select id="findInspectionResult"  parameterType="String" resultType="org.jeecg.modules.eam.vo.InspectionVo">
-
-        SELECT
-            t1.item_demand as inspectionContent,
-            CONVERT(VARCHAR, DATEPART(DAY, t2.inspection_date)) as dayTime,
-            case t1.inspection_result  when '1' then '鈭�' when '2' then 'x' else '' end as inspectionResult
-        FROM
-            eam_inspection_order_detail t1
-        LEFT JOIN eam_inspection_order t2 ON t1.order_id = t2.id
-        WHERE t1.item_demand = #{itemDemand}
-        and t2.equipment_id = #{equipmentId}
-        AND SUBSTRING ( CONVERT ( VARCHAR ( 10 ), t2.inspection_date, 120 ), 1, 7 ) = SUBSTRING(CONVERT(VARCHAR(10),#{yearMonth}, 120 ), 1, 7 )
-    </select>
-
-    <select id="findInspectionStandard"  parameterType="String" resultType="Map">
-        SELECT
-            ROW_NUMBER() OVER (ORDER BY t1.id) AS seq,
-            t1.item_demand as itemDemand
-        FROM
-            eam_maintenance_standard_detail t1
-            LEFT JOIN eam_maintenance_standard t2 ON t1.standard_id = t2.id
+                LEFT JOIN eam_equipment t2 ON t1.equipment_id = t2.id
         WHERE
-          t2.maintenance_category = 'POINT_INSPECTION'
-          AND t2.standard_status = 'NORMAL'
-          and equipment_id =#{equipmentId}
+            t2.equipment_code = #{equipmentCode}
+          AND t1.inspection_date LIKE CONCAT(#{inspectionDate},'%')
+          AND t1.inspection_status = 'COMPLETE'
         ORDER BY
-            item_code ASC
+            t1.inspection_date DESC
     </select>
+
+    <select id="findInsOrderDetailList" resultType="org.jeecg.modules.eam.request.EamInsOrderDetailResultResponse">
+        SELECT
+            t1.inspection_date inspectionDate,
+            t2.item_code item_code,
+            t2.item_name item_name,
+            t2.item_demand item_demand,
+            t2.inspection_result inspection_result
+        FROM
+            eam_inspection_order t1
+                LEFT JOIN eam_inspection_order_detail t2 ON t1.id = t2.order_id
+                LEFT JOIN eam_equipment t3 ON t1.equipment_id = t3.id
+        WHERE
+            t3.equipment_code = #{equipmentCode}
+            AND t1.inspection_date LIKE CONCAT(#{inspectionDate},'%')
+            AND t1.inspection_status = 'COMPLETE'
+        GROUP BY
+            t1.inspection_date,
+            t2.item_code,
+            t2.item_name,
+            t2.item_demand,
+            t2.inspection_result
+        ORDER BY
+            t1.inspection_date ASC
+    </select>
+
+    <select id="findInspectionOrderDetailUserList" resultType="org.jeecg.modules.eam.request.EamInsOrderDetailUserResponse">
+        SELECT
+            t1.inspection_date inspectionDate,
+            t1.operator,
+            t1.confirm_user confirmUser
+        FROM
+            eam_inspection_order t1
+            LEFT JOIN eam_equipment t2 ON t1.equipment_id = t2.id
+        WHERE
+            t2.equipment_code = #{equipmentCode}
+            AND t1.inspection_date LIKE CONCAT(#{inspectionDate},'%')
+            AND t1.inspection_status = 'COMPLETE'
+        GROUP BY
+            t1.inspection_date,
+            t1.operator,
+            t1.confirm_user
+        ORDER BY
+            t1.inspection_date ASC
+    </select>
+
+    <select id="findWeekInsDetailList" resultType="org.jeecg.modules.eam.request.EamWeekInsDetailResultResponse">
+        SELECT
+            t1.plan_inspection_date,
+            t1.item_code,
+            t1.item_name,
+            t1.item_demand,
+            t1.inspection_result
+
+        FROM
+            eam_week_inspection_detail t1
+                LEFT JOIN eam_equipment t2 ON t1.equipment_id = t2.id
+                LEFT JOIN eam_inspection_order t3 ON t3.inspection_date = t1.plan_inspection_date
+                AND t3.equipment_id = t1.equipment_id
+        WHERE
+            t2.equipment_code = #{equipmentCode}
+            AND t3.inspection_date LIKE CONCAT(#{inspectionDate},'%')
+            AND t3.inspection_status = 'COMPLETE'
+        GROUP BY
+            t1.plan_inspection_date,
+            t1.item_code,
+            t1.item_name,
+            t1.item_demand,
+            t1.inspection_result
+        ORDER BY
+            t1.plan_inspection_date ASC
+    </select>
+
+    <select id="findWeekInsOrderDetailUserList" resultType="org.jeecg.modules.eam.request.EamWeekInsDetailUserResponse">
+        SELECT
+            t1.plan_inspection_date,
+            t1.inspector,
+            t3.confirm_user
+        FROM
+            eam_week_inspection_detail t1
+                LEFT JOIN eam_equipment t2 ON t1.equipment_id = t2.id
+                LEFT JOIN eam_inspection_order t3 ON t3.inspection_date = t1.plan_inspection_date
+                AND t3.equipment_id = t1.equipment_id
+        WHERE
+            t2.equipment_code = #{equipmentCode}
+            AND t3.inspection_date LIKE CONCAT(#{inspectionDate},'%')
+            AND t3.inspection_status = 'COMPLETE'
+        GROUP BY
+            t1.plan_inspection_date,
+            t1.inspector,
+            t3.confirm_user
+        ORDER BY
+            t1.plan_inspection_date ASC
+    </select>
+
 </mapper>

--
Gitblit v1.9.3