From 5c5cddb1c2ee0d19adddebaf3a3a10a6d93fd2ad Mon Sep 17 00:00:00 2001
From: wlzboy <66905212@qq.com>
Date: 星期日, 26 十月 2025 10:52:18 +0800
Subject: [PATCH] feat:优化微信小程序可以运行
---
ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml | 26 ++++++++++++++++++++++++++
1 files changed, 26 insertions(+), 0 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..6d1d189 100644
--- a/ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml
+++ b/ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml
@@ -45,6 +45,12 @@
<if test="status != null and status != ''">
AND status = #{status}
</if>
+ <if test="serviceOrderClass != null and serviceOrderClass != ''">
+ AND service_order_class = #{serviceOrderClass}
+ </if>
+ <if test="dispatchOrderClass != null and dispatchOrderClass != ''">
+ AND dispatch_order_class = #{dispatchOrderClass}
+ </if>
<!-- 鏁版嵁鑼冨洿杩囨护 -->
${params.dataScope}
order by d.parent_id, d.order_num
@@ -184,4 +190,24 @@
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>
+
</mapper>
\ No newline at end of file
--
Gitblit v1.9.1