From 6bce1b35246ed695a4272c24254c7073a524818a Mon Sep 17 00:00:00 2001
From: zhangnaisong <2434969829@qq.com>
Date: 星期二, 30 七月 2024 13:33:12 +0800
Subject: [PATCH] 电磁锁查询加入状态修改提交

---
 ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml |   58 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 57 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 5049c2e..c2627af 100644
--- a/ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml
+++ b/ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml
@@ -46,7 +46,23 @@
 		${params.dataScope}
 		order by d.parent_id, d.order_num
     </select>
-    
+	<select id="selectDeptListNoDataScope" parameterType="SysDept" resultMap="SysDeptResult">
+		<include refid="selectDeptVo"/>
+		where d.del_flag = '0'
+		<if test="deptId != null and deptId != 0">
+			AND dept_id = #{deptId}
+		</if>
+		<if test="parentId != null and parentId != 0">
+			AND parent_id = #{parentId}
+		</if>
+		<if test="deptName != null and deptName != ''">
+			AND dept_name like ('%${deptName}%')
+		</if>
+		<if test="status != null and status != ''">
+			AND status = #{status}
+		</if>
+		order by d.parent_id, d.order_num
+	</select>
     <select id="selectDeptListByRoleId" resultType="Long">
 		select d.dept_id
 		from sys_dept d
@@ -158,4 +174,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