From 37325b5b629a296230e87d41187742f843c7494c Mon Sep 17 00:00:00 2001
From: xiangpei <xiangpei@timesnew.cn>
Date: 星期二, 15 七月 2025 18:08:23 +0800
Subject: [PATCH] 文件ip迁移兼容

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

diff --git a/system/src/main/resources/mapper/system/SysDeptMapper.xml b/system/src/main/resources/mapper/system/SysDeptMapper.xml
index c5dd0d0..3aa7471 100644
--- a/system/src/main/resources/mapper/system/SysDeptMapper.xml
+++ b/system/src/main/resources/mapper/system/SysDeptMapper.xml
@@ -47,6 +47,18 @@
 		order by d.parent_id, d.order_num
     </select>
 
+	<select id="selectDeptListNoAuth" parameterType="SysDept" resultMap="SysDeptResult">
+		<include refid="selectDeptVo"/>
+		where d.del_flag = '0'
+		<if test="parentId != null">
+			AND FIND_IN_SET(#{parentId}, ancestors) > 0
+		</if>
+		<if test="deptName != null and deptName != ''">
+			AND dept_name like concat('%', #{deptName}, '%')
+		</if>
+		order by d.parent_id, d.order_num
+	</select>
+
     <select id="selectDeptListByRoleId" resultType="Long">
 		select d.dept_id
 		from sys_dept d
@@ -104,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