From 47ff4d8018d550a23ca81a964c226ec173326942 Mon Sep 17 00:00:00 2001 From: zhaowenxuan <chacca165@163.com> Date: 星期一, 16 六月 2025 10:37:22 +0800 Subject: [PATCH] 0616-1 --- 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