From a1808ba0ff1ccc2efacb69c1033054dbaab8687f Mon Sep 17 00:00:00 2001
From: zhaowenxuan <chacca165@163.com>
Date: 星期四, 10 七月 2025 17:57:16 +0800
Subject: [PATCH] 2025-07-10

---
 ltkj-system/src/main/resources/mapper/system/SysDeptMapper.xml |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/ltkj-system/src/main/resources/mapper/system/SysDeptMapper.xml b/ltkj-system/src/main/resources/mapper/system/SysDeptMapper.xml
index 022e364..f1e88c1 100644
--- a/ltkj-system/src/main/resources/mapper/system/SysDeptMapper.xml
+++ b/ltkj-system/src/main/resources/mapper/system/SysDeptMapper.xml
@@ -384,5 +384,19 @@
                 #{totalRows,mode=OUT,jdbcType=INTEGER}
             )}
     </select>
+    <select id="getDeptTreeById" resultType="java.lang.Long">
+        WITH RECURSIVE dept_tree AS (
+        SELECT dept_id
+        FROM sys_dept
+        WHERE dept_id = #{deptId}
+
+        UNION ALL
+
+        SELECT d.dept_id
+        FROM sys_dept d
+        INNER JOIN dept_tree dt ON d.parent_id = dt.dept_id
+        )
+        SELECT dept_id FROM dept_tree;
+    </select>
 
 </mapper>

--
Gitblit v1.8.0