From 1cbbb341d22e3c46b15af65b6f97d738bae7ca95 Mon Sep 17 00:00:00 2001
From: yangbin <yangbin>
Date: 星期二, 20 五月 2025 10:46:57 +0800
Subject: [PATCH] 自动化

---
 lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/mapper/xml/MdcProductionMapper.xml |   96 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 96 insertions(+), 0 deletions(-)

diff --git a/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/mapper/xml/MdcProductionMapper.xml b/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/mapper/xml/MdcProductionMapper.xml
index f5228ba..7d0b8f2 100644
--- a/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/mapper/xml/MdcProductionMapper.xml
+++ b/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/mapper/xml/MdcProductionMapper.xml
@@ -42,4 +42,100 @@
             t3.id = #{userId}
           AND t1.org_type = '3'
     </select>
+
+    <select id="recursionChildrenByList" resultType="java.lang.String">
+        WITH temp (id) AS (
+            -- 鍒濆鏌ヨ锛岃幏鍙栨寚瀹� id 鐨勮褰�
+            SELECT
+                id
+            FROM
+                mdc_production
+            WHERE
+                id IN
+            <foreach collection = "productionIds" item = "id" index = "index" open = "(" close = ")" separator = ",">
+                 #{id}
+            </foreach>
+            UNION ALL
+            -- 閫掑綊鏌ヨ锛屾煡鎵惧瓙鑺傜偣
+            SELECT
+                a.id
+            FROM
+                mdc_production a
+                    INNER JOIN temp ON a.parent_id = temp.id
+        )
+-- 鏈�缁堟煡璇紝浣跨敤 DISTINCT 鍘婚噸
+        SELECT DISTINCT
+            id
+        FROM
+            temp;
+    </select>
+
+    <select id="findChildren" resultType="java.lang.String">
+        WITH temp ( id ) AS (
+            SELECT
+                id
+            FROM
+                mdc_production
+            WHERE
+                id IN
+            <foreach collection="mdcProductionIds" item = "id" index = "index" open = "(" close = ")" separator = ",">
+                #{id}
+            </foreach>
+            AND mdc_flag = '1' UNION ALL
+            SELECT
+                a.id
+            FROM
+                mdc_production a
+                    INNER JOIN temp ON a.parent_id = temp.id
+            WHERE
+                a.mdc_flag = '1'
+        ) SELECT
+            *
+        FROM
+            temp
+    </select>
+
+    <select id="loadProductionOptions" resultType="org.jeecg.modules.system.entity.MdcProduction">
+        SELECT
+            t1.*
+        FROM
+            mdc_production t1
+                LEFT JOIN mdc_user_production t2 ON t1.id = t2.pro_id
+        WHERE
+            t2.user_id = #{userId} AND t1.mdc_flag = '1'
+        <choose>
+            <when test="productionId != null and productionId != ''">
+                AND t1.org_type = '3' AND t1.parent_id = #{productionId}
+            </when>
+            <otherwise>
+                AND t1.org_type = '2'
+            </otherwise>
+        </choose>
+        ORDER BY t1.production_order
+    </select>
+
+    <select id="findTeamValue" resultType="java.lang.String">
+        SELECT DISTINCT
+            t1.team_code deamCode
+        FROM
+            mdc_equipment t1
+            LEFT JOIN mdc_production_equipment t2 ON t1.id = t2.equipment_id
+        WHERE t2.production_id IN
+        <foreach collection="productionList" item = "productionId" index = "index" open = "(" close= ")" separator = ",">
+            #{productionId}
+        </foreach>
+    </select>
+
+    <select id="findProIdsByUId" resultType="java.lang.String">
+        SELECT
+            pro_id
+        FROM
+            mdc_user_production
+        WHERE
+            pro_id IN
+            <foreach collection="allProductionIds" item = "productionId" index = "index" open = "(" close= ")" separator = ",">
+                #{productionId}
+            </foreach>
+          AND user_id = #{userId}
+    </select>
 </mapper>

--
Gitblit v1.9.3