From 60025c612e4d068255d498ad69fb737ff27bf521 Mon Sep 17 00:00:00 2001
From: cuilei <ray_tsu1@163.com>
Date: 星期四, 07 八月 2025 10:27:17 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentMapper.xml |   51 ++++++++++++++++++++++++++++++++++++++-------------
 1 files changed, 38 insertions(+), 13 deletions(-)

diff --git a/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentMapper.xml b/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentMapper.xml
index 4e876b7..f4dcaf8 100644
--- a/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentMapper.xml
+++ b/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentMapper.xml
@@ -12,7 +12,7 @@
 
     <!--鏌ヨ璁惧鐨勬墍灞炰骇绾垮悕绉颁俊鎭�-->
     <select id="getProNamesByEquipmentIds" resultType="org.jeecg.modules.mdc.vo.MdcEquipmentProVo">
-        SELECT p.production_name, pe.equipment_id FROM mdc_production_equipment pe, mdc_production p WHERE p.id = pe.production_id AND pe.equipment_id IN
+        SELECT f.factory_name, bef.equipment_id FROM base_equipment_factory bef, base_factory f WHERE f.id = bef.factory_id AND bef.equipment_id IN
         <foreach collection="equipmentIds" index="index" item="id" open="(" separator="," close=")">
             #{id}
         </foreach>
@@ -95,10 +95,10 @@
         me.*
         FROM
         mdc_equipment me
-        LEFT JOIN mdc_production_equipment mpe ON me.id = mpe.equipment_id
+        LEFT JOIN base_equipment_factory mpe ON me.id = mpe.equipment_id
         WHERE
-        mpe.production_id IN
-        <foreach collection="allProductionIds" index="index" item="id" open="(" separator="," close=")">
+        mpe.factory_id IN
+        <foreach collection="allFactoryIds" index="index" item="id" open="(" separator="," close=")">
             #{id}
         </foreach>
     </select>
@@ -181,14 +181,14 @@
         SELECT
             mp.id,
             mp.parent_id,
-            mp.production_name,
-            mp.org_type,
+            mp.factory_name AS productionName,
+            mp.factory_category AS orgtype,
             me.equipment_id,
             me.equipment_name,
             me.equipment_type
         FROM
-            mdc_production_equipment mpe
-            LEFT JOIN mdc_production mp ON mpe.production_id = mp.id
+            base_equipment_factory mpe
+            LEFT JOIN base_factory mp ON mpe.factory_id = mp.id
             LEFT JOIN mdc_equipment me ON me.id = mpe.equipment_id
         <where>
             me.equipment_id IN
@@ -196,7 +196,7 @@
                 #{id}
             </foreach>
         </where>
-        ORDER BY mp.production_order
+        ORDER BY mp.sorter
     </select>
 
     <!--鏍规嵁澶у睆杞﹂棿id鏌ヨ璁惧鍒楄〃-->
@@ -221,8 +221,8 @@
             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
+            LEFT JOIN base_equipment_factory t2 ON t1.id = t2.equipment_id
+            LEFT JOIN base_factory t3 ON t2.factory_id = t3.id
         <where>
             <if test="mdcEquipment.equipmentId != null and mdcEquipment.equipmentId != '' ">
                 AND t1.equipment_id LIKE CONCAT(CONCAT('%',#{mdcEquipment.equipmentId}),'%')
@@ -260,8 +260,8 @@
             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
+            LEFT JOIN base_equipment_factory t2 ON t1.id = t2.equipment_id
+            LEFT JOIN base_factory 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}),'%')
@@ -402,4 +402,29 @@
         </where>
     </select>
 
+    <select id="queryByFactoryId" resultType="org.jeecg.modules.mdc.entity.MdcEquipment">
+        SELECT
+            me.*
+        FROM
+            base_equipment_factory bef,
+            mdc_equipment me
+        WHERE
+            bef.equipment_id = me.id
+          AND bef.factory_id = #{ factoryId }
+        ORDER BY me.equipment_id
+    </select>
+
+    <select id="queryIdsByFactorys" resultType="java.lang.String">
+        SELECT
+            me.equipment_id
+        FROM
+            mdc_equipment me
+            LEFT JOIN base_equipment_factory bef ON me.id = bef.equipment_id
+        WHERE
+            bef.factory_id IN
+        <foreach collection="allFactoryIds" index="index" item="id" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </select>
+
 </mapper>

--
Gitblit v1.9.3