From 1f2697051a87a7ca54734ccbf04a4bc8b0110907 Mon Sep 17 00:00:00 2001 From: zxl <763096477@qq.com> Date: 星期五, 21 三月 2025 15:56:18 +0800 Subject: [PATCH] 建设内容 --- system/src/main/resources/mapper/system/SysDeptMapper.xml | 14 ++++++++++++++ 1 files changed, 14 insertions(+), 0 deletions(-) diff --git a/system/src/main/resources/mapper/system/SysDeptMapper.xml b/system/src/main/resources/mapper/system/SysDeptMapper.xml index f4faa92..3aa7471 100644 --- a/system/src/main/resources/mapper/system/SysDeptMapper.xml +++ b/system/src/main/resources/mapper/system/SysDeptMapper.xml @@ -116,6 +116,20 @@ SELECT dept_id FROM sys_dept WHERE dept_name = #{name} and del_flag = '0' limit 1 </select> + <select id="getChildIds" parameterType="long" resultType="long"> + WITH RECURSIVE temp_table AS ( + SELECT + dept_id FROM sys_dept WHERE dept_id = #{deptId} AND del_flag = '0' + UNION ALL + SELECT + so.dept_id FROM sys_dept so INNER JOIN temp_table tb ON so.parent_id = tb.dept_id AND so.del_flag = '0' + ) + SELECT + dept_id + FROM + temp_table + </select> + <insert id="insertDept" parameterType="SysDept"> insert into sys_dept( <if test="deptId != null and deptId != 0">dept_id,</if> -- Gitblit v1.8.0