From 49ca0cffd43f1ceb119d84232ecc92186d5abb63 Mon Sep 17 00:00:00 2001
From: liusuyi <1951119284@qq.com>
Date: 星期一, 03 六月 2024 16:28:26 +0800
Subject: [PATCH] 修复雷达强制引导只获取大光电

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

diff --git a/ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml
index 0827ecb..94aa515 100644
--- a/ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml
+++ b/ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml
@@ -77,7 +77,9 @@
 	<select id="selectChildrenDeptById" parameterType="Long" resultMap="SysDeptResult">
 		select * from sys_dept where cast(#{deptId} as varchar) = any(string_to_array(ancestors,','))
 	</select>
-	
+	<select id="selectNextChildrenDeptById" parameterType="Long" resultMap="SysDeptResult">
+		select * from sys_dept where parent_id=#{deptId} and del_flag='0'
+	</select>
 	<select id="selectNormalChildrenDeptById" parameterType="Long" resultType="int">
 		select count(*) from sys_dept where status = '0' and del_flag = '0' and cast(#{deptId} as varchar) = any(string_to_array(ancestors,','))
 	</select>
@@ -156,4 +158,44 @@
 		update sys_dept set del_flag = '2' where dept_id = #{deptId}
 	</delete>
 
+	<select id="getChildrenDeptIdList" resultType="java.lang.Long">
+		select distinct sd.dept_id from sys_dept sd
+		where sd.parent_id in
+		<foreach collection="deptIdList" item="deptId" separator="," open="(" close=")">
+			#{deptId}
+		</foreach>
+	</select>
+
+	<select id="selectDeptIdBySub" resultType="java.lang.Long" parameterType="java.lang.Long">
+		with recursive rsd as (
+			select sd.dept_id from sys_dept sd where sd.dept_id = #{deptId}
+			union
+			select csd.dept_id from sys_dept csd inner join rsd on rsd.dept_id = csd.parent_id
+		)
+		select dept_id from rsd
+	</select>
+
+	<select id="selectRoleDeptIdByUsersId" resultType="java.lang.Long" parameterType="java.lang.String">
+		select srd.dept_id from sys_user su
+		inner join sys_user_role sur on su.user_id = sur.user_id
+		inner join sys_role_dept srd on sur.role_id = srd.role_id
+		where su.user_id = #{usersId} order by srd.dept_id
+	</select>
+
+	<select id="getParentsDeptListByDeptId" resultMap="SysDeptResult" parameterType="java.lang.Long">
+		with recursive rsd as (
+			select * from sys_dept sd where sd.dept_id = #{deptId}
+			union
+			select psd.* from sys_dept psd inner join rsd on rsd.parent_id = psd.dept_id
+		)
+		select * from rsd
+	</select>
+
+	<select id="selectNextChildrenDeptByIdAndInList" resultMap="SysDeptResult">
+		select * from sys_dept where parent_id=#{deptId} and del_flag='0'
+		and dept_id in
+		<foreach collection="deptIdList" item="deptId" separator="," index="index" open="(" close=")">
+			#{deptId}
+		</foreach>
+	</select>
 </mapper> 
\ No newline at end of file

--
Gitblit v1.9.3