From 299b1469c9f19c1d45948bcc050aa37c86c965cd Mon Sep 17 00:00:00 2001
From: hyingbo <1363390067@qq.com>
Date: 星期五, 13 六月 2025 17:53:07 +0800
Subject: [PATCH] mdc设备添加图片,设备监控、大屏修改设备图片来源及添加设备状态为故障的类型

---
 lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentMapper.xml |   68 ++++++++++++++++++++++++++++------
 1 files changed, 56 insertions(+), 12 deletions(-)

diff --git a/lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentMapper.xml b/lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentMapper.xml
index 8440226..4e876b7 100644
--- a/lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentMapper.xml
+++ b/lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentMapper.xml
@@ -89,22 +89,51 @@
         </foreach>
     </select>
 
+    <!--鏍规嵁浜х嚎id鏌ヨ璁惧id闆嗗悎-->
+    <select id="getEquipmentList" resultType="org.jeecg.modules.mdc.entity.MdcEquipment">
+        SELECT
+        me.*
+        FROM
+        mdc_equipment me
+        LEFT JOIN mdc_production_equipment mpe ON me.id = mpe.equipment_id
+        WHERE
+        mpe.production_id IN
+        <foreach collection="allProductionIds" index="index" item="id" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </select>
+
     <!--鏌ヨ璁惧鐩戞帶淇℃伅-->
     <select id="checkStatusFromEquipmentIds" resultType="org.jeecg.modules.mdc.entity.MdcEquipmentMonitor">
         SELECT
-            t1.equipment_id,
-            t2.CollectTime,
-            t1.equipment_name,
-            t2.Oporation,
-            t1.id,
-            t1.equipment_status,
-            t1.equipment_type equipmentType,
-            t3.equipment_type_pictures
+          t1.equipment_id,
+          t2.CollectTime,
+          t1.equipment_name,
+        CASE
+
+            WHEN repair.count > 0 THEN
+            '5' ELSE t2.Oporation
+          END AS Oporation,
+          t1.id,
+          t1.equipment_status,
+          t1.equipment_type equipmentType,
+          t1.equipment_image equipmentTypePictures
+
         FROM
-            mdc_equipment t1
-            LEFT JOIN Equipment t2 ON t1.equipment_id = t2.EquipmentID
-            LEFT JOIN mdc_equipment_type t3 ON t1.equipment_type = t3.equipment_type_name
-        WHERE equipment_id IN
+          mdc_equipment t1
+          LEFT JOIN Equipment t2 ON t1.equipment_id = t2.EquipmentID
+          LEFT JOIN (
+            SELECT
+              e1.equipment_code,
+              COUNT(1) COUNT
+            FROM
+              eam_report_repair r1
+              INNER JOIN eam_equipment e1 ON e1.id = r1.equipment_id
+            WHERE
+              r1.report_status NOT IN ('COMPLETE', 'ABOLISH')
+          GROUP BY
+            e1.equipment_code) repair ON repair.equipment_code = t1.equipment_id
+        WHERE t1.equipment_id IN
         <foreach collection="equipmentIds" index="index" item="id" open="(" separator="," close=")">
             #{id}
         </foreach>
@@ -340,6 +369,7 @@
             #{equipmentType}
         </foreach>
     </select>
+
     <select id="queryByDepartIdsAndType" resultType="org.jeecg.modules.mdc.entity.MdcEquipment">
         SELECT
             e.*,
@@ -358,4 +388,18 @@
         </foreach>
     </select>
 
+    <select id="getEquIdsByProIds" resultType="java.lang.String">
+        SELECT
+        t1.equipment_id
+        FROM
+        mdc_equipment t1
+        LEFT JOIN mdc_production_equipment t2 ON t1.id = t2.equipment_id
+        <where>
+            t2.production_id IN
+            <foreach collection="proIds" index="index" item="id" open="(" separator="," close=")">
+                #{id}
+            </foreach>
+        </where>
+    </select>
+
 </mapper>

--
Gitblit v1.9.3