From 24d3def5fd8dc526ce9439449d2725b529e394f2 Mon Sep 17 00:00:00 2001
From: liyj <15602261488@163.com>
Date: Sun, 22 Sep 2024 13:02:27 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/gzdyh_test' into gzdyh_test

---
 dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/dao/mapper/xml/CtUnitMapper.xml |   40 ++++++++++++++++++++++++++++++++++++++++
 1 files changed, 40 insertions(+), 0 deletions(-)

diff --git a/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/dao/mapper/xml/CtUnitMapper.xml b/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/dao/mapper/xml/CtUnitMapper.xml
index 6c6718d..c42ddef 100644
--- a/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/dao/mapper/xml/CtUnitMapper.xml
+++ b/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/dao/mapper/xml/CtUnitMapper.xml
@@ -344,4 +344,44 @@
         WHERE
         id = #{entity.id}
     </update>
+
+    <!--  更新调度规则指标目标组织名称  -->
+    <update id="updateDispNormCauseTargetUnitName">
+        update dyh_disp_norm_cause
+        set target_unit_name = #{unitName}
+        where target_unit_id = #{unitId}
+    </update>
+
+    <!-- 查询某一单位下下一级所有管辖单位-->
+    <select id="listAllChild" resultMap="dataResult">
+        WITH RECURSIVE unit_hierarchy(id, parent_id, name) AS (
+        -- 锚成员 (起始点)
+        SELECT
+        id ,
+        parent_id,
+        unit_name
+        FROM
+        dyh_ct_unit
+        WHERE
+        id = #{unitId}
+
+        UNION ALL
+
+        -- 递归成员
+        SELECT
+        u.id,
+        u.parent_id,
+        u.unit_name
+        FROM
+        dyh_ct_unit u
+        JOIN
+        unit_hierarchy h ON u.parent_id = h.id where u.delete_status = 0
+        )
+        SELECT
+        id AS id,
+        parent_id AS parent_id,
+        name AS unit_name
+        FROM
+        unit_hierarchy;
+    </select>
 </mapper> 
\ No newline at end of file

--
Gitblit v1.8.0