From 15a20a91316b726f45ccc9e06bbd632f10eedb43 Mon Sep 17 00:00:00 2001
From: Lius <Lius2225@163.com>
Date: 星期五, 13 九月 2024 14:10:55 +0800
Subject: [PATCH] update

---
 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentMapper.xml |  147 +++++++++++++++++++++++++++++++++++--------------
 1 files changed, 105 insertions(+), 42 deletions(-)

diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentMapper.xml b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentMapper.xml
index 945127c..925e610 100644
--- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentMapper.xml
+++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentMapper.xml
@@ -58,6 +58,9 @@
         WHERE
             med.equipment_id = me.id
             AND med.dep_id = #{ departId }
+            <if test="key != null and key != '' ">
+                AND me.device_abnormal_status = 1
+            </if>
         ORDER BY me.equipment_id
     </select>
 
@@ -71,6 +74,9 @@
         WHERE
             mpe.equipment_id = me.id
             AND mpe.production_id = #{ productionId }
+          <if test="key != null and key != '' ">
+              AND me.device_abnormal_status = 1
+          </if>
         ORDER BY me.equipment_id
     </select>
 
@@ -83,55 +89,30 @@
             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>
+            <foreach collection="allProductionIds" index="index" item="id" open="(" separator="," close=")">
+                #{id}
+            </foreach>
     </select>
 
     <!--鏌ヨ璁惧鐩戞帶淇℃伅-->
     <select id="checkStatusFromEquipmentIds" resultType="org.jeecg.modules.mdc.entity.MdcEquipmentMonitor">
         SELECT
-            k.EquipmentID,
-            k.CollectTime,
-            k.equipmentName,
-            MAX ( l.Oporation ) Oporation,
-            k.id,
-            k.equipment_type equipmentType,
-            k.equipment_type_pictures
+            t1.equipment_id,
+            t2.CollectTime,
+            t1.equipment_name,
+            t2.Oporation,
+            t1.id,
+            t1.equipment_status,
+            t1.equipment_type equipmentType,
+            t3.equipment_type_pictures
         FROM
-            (
-            SELECT
-                t.EquipmentID,
-                MAX ( t.equipmentName ) equipmentName,
-                MAX ( m.CollectTime ) CollectTime,
-                id,
-                equipment_type,
-                equipment_type_pictures
-            FROM
-                ( SELECT equipment_id EquipmentID, equipment_Name equipmentName, id, equipment_type FROM mdc_equipment WHERE equipment_id IN
+            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
         <foreach collection="equipmentIds" index="index" item="id" open="(" separator="," close=")">
             #{id}
         </foreach>
-                 ) t
-                LEFT JOIN ( SELECT equipment_type_name, equipment_type_pictures FROM mdc_equipment_type) met ON t.equipment_type = met.equipment_type_name
-                LEFT JOIN ( SELECT EquipmentID, CollectTime, Oporation FROM EquipmentLog WHERE Oporation <![CDATA[ <> ]]> 23 ) m ON t.EquipmentID= m.EquipmentID
-            GROUP BY
-                t.EquipmentID,
-                id,
-                equipment_type,
-                equipment_type_pictures
-            ) k
-            LEFT JOIN ( SELECT EquipmentID, CollectTime, Oporation FROM EquipmentLog WHERE Oporation <![CDATA[ <> ]]> 23 ) l ON k.CollectTime= l.CollectTime
-            AND k.EquipmentID = l.EquipmentID
-        GROUP BY
-            k.EquipmentID,
-            k.CollectTime,
-            k.equipmentName,
-            k.id,
-            k.equipment_type,
-            k.equipment_type_pictures
-        ORDER BY
-            EquipmentID
     </select>
 
     <!--鏍规嵁閮ㄩ棬id鏌ヨ璁惧id闆嗗悎-->
@@ -157,7 +138,8 @@
             sd.org_type,
             me.equipment_id,
             me.equipment_name,
-            me.equipment_type
+            me.equipment_type,
+            me.equipment_model
         FROM
             mdc_equipment_depart med
             LEFT JOIN sys_depart sd ON med.dep_id = sd.id
@@ -180,7 +162,8 @@
             mp.org_type,
             me.equipment_id,
             me.equipment_name,
-            me.equipment_type
+            me.equipment_type,
+            me.equipment_model
         FROM
             mdc_production_equipment mpe
             LEFT JOIN mdc_production mp ON mpe.production_id = mp.id
@@ -210,5 +193,85 @@
         ORDER BY me.equipment_id
     </select>
 
+    <!--鍒嗛〉鍒楄〃-->
+    <select id="pageList" resultType="org.jeecg.modules.mdc.entity.MdcEquipment">
+        SELECT
+            t1.*
+        FROM
+            mdc_equipment t1
+            LEFT JOIN mdc_production_equipment t2 ON t1.id = t2.equipment_id
+            LEFT JOIN mdc_production t3 ON t2.production_id = t3.id
+        <where>
+            <if test="mdcEquipment.equipmentId != null and mdcEquipment.equipmentId != '' ">
+                AND t1.equipment_id LIKE CONCAT(CONCAT('%',#{mdcEquipment.equipmentId}),'%')
+            </if>
+            <if test="mdcEquipment.equipmentName != null and mdcEquipment.equipmentName != '' ">
+                AND t1.equipment_name LIKE CONCAT(CONCAT('%',#{mdcEquipment.equipmentName}),'%')
+            </if>
+            <if test="mdcEquipment.equipmentModel != null and mdcEquipment.equipmentModel != '' ">
+                AND t1.equipment_name = #{mdcEquipment.equipmentModel}
+            </if>
+            <if test="mdcEquipment.equipmentType != null and mdcEquipment.equipmentType != '' ">
+                AND t1.equipmentType = #{mdcEquipment.equipmentType}
+            </if>
+            <if test="mdcEquipment.driveType != null and mdcEquipment.driveType != '' ">
+                AND t1.drive_type = #{mdcEquipment.driveType}
+            </if>
+            <if test="mdcEquipment.deviceLevel != null and mdcEquipment.deviceLevel != '' ">
+                AND t1.device_level = #{mdcEquipment.deviceLevel}
+            </if>
+            <if test="mdcEquipment.deviceCategory != null and mdcEquipment.deviceCategory != '' ">
+                AND t1.device_category = #{mdcEquipment.deviceCategory}
+            </if>
+            <if test="mdcEquipment.deviceAbnormalStatus != null and mdcEquipment.deviceAbnormalStatus != '' ">
+                AND t1.device_abnormal_status = #{mdcEquipment.deviceAbnormalStatus}
+            </if>
+            <if test="mdcEquipment.productionIds != null and mdcEquipment.productionIds.size() > 0 ">
+                AND t3.id IN
+                <foreach collection="mdcEquipment.productionIds" index="index" item="id" open="(" separator="," close=")">
+                    #{id}
+                </foreach>
+            </if>
+        </where>
+        order by t1.sort_no
+    </select>
+
+    <select id="exportXlsList" resultType="org.jeecg.modules.mdc.entity.MdcEquipment">
+        SELECT
+            t1.*
+        FROM
+            mdc_equipment t1
+            LEFT JOIN mdc_production_equipment t2 ON t1.id = t2.equipment_id
+            LEFT JOIN mdc_production t3 ON t2.production_id = t3.id
+        <where>
+            <if test="mdcEquipment.equipmentId != null and mdcEquipment.equipmentId != '' ">
+                AND t1.equipment_id LIKE CONCAT(CONCAT('%',#{mdcEquipment.equipmentId}),'%')
+            </if>
+            <if test="mdcEquipment.equipmentName != null and mdcEquipment.equipmentName != '' ">
+                AND t1.equipment_name LIKE CONCAT(CONCAT('%',#{mdcEquipment.equipmentName}),'%')
+            </if>
+            <if test="mdcEquipment.equipmentModel != null and mdcEquipment.equipmentModel != '' ">
+                AND t1.equipment_name = #{mdcEquipment.equipmentModel}
+            </if>
+            <if test="mdcEquipment.equipmentType != null and mdcEquipment.equipmentType != '' ">
+                AND t1.equipment_type = #{mdcEquipment.equipmentType}
+            </if>
+            <if test="mdcEquipment.driveType != null and mdcEquipment.driveType != '' ">
+                AND t1.drive_type = #{mdcEquipment.driveType}
+            </if>
+            <if test="mdcEquipment.productionIds != null and mdcEquipment.productionIds.size() > 0 ">
+                AND t3.id IN
+                <foreach collection="mdcEquipment.productionIds" index="index" item="id" open="(" separator="," close=")">
+                    #{id}
+                </foreach>
+            </if>
+        </where>
+        order by t1.sort_no
+    </select>
+
+    <!--鏌ヨ鍗曡〃鏁版嵁-->
+    <select id="findWorkLineLast" resultType="org.jeecg.modules.mdc.dto.MdcEquipmentDto">
+        select top 1 spindlespeed, actualspindlespeed from [${tableName}] order by CollectTime  desc
+    </select>
 
 </mapper>
\ No newline at end of file

--
Gitblit v1.9.3