From 766c2b5c6940fb4373b7b8097b31d2b03aa49ac2 Mon Sep 17 00:00:00 2001
From: wlzboy <66905212@qq.com>
Date: 星期一, 10 十一月 2025 21:22:16 +0800
Subject: [PATCH] fix:优化小程序人员加载和后台用户管理中的用户加载
---
ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml | 42 ++++++++++++++++++++++++++++++++++++++++--
1 files changed, 40 insertions(+), 2 deletions(-)
diff --git a/ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml
index 2d8e21a..f4b16dd 100644
--- a/ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml
+++ b/ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml
@@ -45,8 +45,13 @@
<if test="status != null and status != ''">
AND status = #{status}
</if>
- <!-- 鏁版嵁鑼冨洿杩囨护 -->
- ${params.dataScope}
+ <if test="serviceOrderClass != null and serviceOrderClass != ''">
+ AND service_order_class = #{serviceOrderClass}
+ </if>
+ <if test="dispatchOrderClass != null and dispatchOrderClass != ''">
+ AND dispatch_order_class = #{dispatchOrderClass}
+ </if>
+
order by d.parent_id, d.order_num
</select>
@@ -184,4 +189,37 @@
limit 1
</select>
+ <!-- 鑾峰彇鎸囧畾閮ㄩ棬ID鐨勫垎鍏徃ID锛坧arent_id=100鐨勯儴闂級 -->
+ <select id="selectBranchCompanyIdByDeptId" parameterType="Long" resultType="Long">
+ select case
+ -- 濡傛灉浼犲叆鐨勫氨鏄垎鍏徃锛坧arent_id=100锛夛紝鐩存帴杩斿洖
+ when exists(select 1 from sys_dept where dept_id = #{deptId} and parent_id = 100 and del_flag = '0')
+ then #{deptId}
+ else (
+ -- 鍚﹀垯浠� ancestors 涓煡鎵惧垎鍏徃ID
+ select d.dept_id
+ from sys_dept d
+ where d.parent_id = 100
+ and d.del_flag = '0'
+ and FIND_IN_SET(d.dept_id, (
+ select ancestors from sys_dept where dept_id = #{deptId} and del_flag = '0'
+ ))
+ limit 1
+ )
+ end
+ </select>
+
+ <!-- 鏍规嵁缂栫爜鍒楄〃鏌ヨ鍒嗗叕鍙� -->
+ <select id="selectBranchCompaniesByOrderCodes" resultMap="SysDeptResult">
+ select dept_id, dept_name, parent_id, ancestors, service_order_class, dispatch_order_class
+ from sys_dept
+ where parent_id = 100
+ and del_flag = '0'
+ and (
+ <foreach collection="orderCodes" item="code" separator=" or ">
+ service_order_class = #{code} or dispatch_order_class = #{code}
+ </foreach>
+ )
+ </select>
+
</mapper>
\ No newline at end of file
--
Gitblit v1.9.1