From 1958e8bad428b94aa457734f7f047fe373eafd83 Mon Sep 17 00:00:00 2001
From: 陈昶聿 <chychen@nbjetron.com>
Date: 星期三, 11 十一月 2026 14:06:11 +0800
Subject: [PATCH] Merge branch 'smartor_ls_261103' into smartor_ls_merge

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

diff --git a/ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml
index 225eac3..cf4e077 100644
--- a/ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml
+++ b/ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml
@@ -283,17 +283,36 @@
         where dept_id = #{deptId}
     </delete>
 
+    <!--
+        鏌ヨ绉戝/鐥呭尯锛�
+          路 userId 鏈夊�硷紙鏅�氱敤鎴� / 鐢ㄦ埛缂栬緫椤碉細鏌ユ煇涓敤鎴峰悕涓嬬殑閮ㄩ棬锛夆啋 鍏宠仈 sys_user_dept锛�
+          路 userId 涓虹┖锛堢鐞嗗憳锛氱湅鏈満鏋勫叏閮ㄧ瀹�/鐥呭尯锛夆啋 鍙煡 sys_dept锛屼笉鍏宠仈鍏崇郴琛ㄣ��
+        涓轰粈涔堣鍒嗘敮锛欻IS 閲囬泦鍐� sys_user_dept 鏃舵槑纭帓闄や簡 admin锛圕ollectHISMapper 鐨�
+        yhyksxx/yhybfxx 閮芥湁 ud.user_id != 'admin'锛夛紝绠$悊鍛樺湪鍏崇郴琛ㄩ噷娌℃湁鏁版嵁锛岃蛋 inner join
+        浼氬緱鍒扮┖鍒楄〃锛岃〃鐜板氨鏄�岀櫥褰曟垚鍔熶絾鍒涘缓浠诲姟鏃堕�変笉鍒扮瀹ょ梾鍖恒�嶃��
+        鍙﹀涓嶅仛闄㈠尯杩囨护锛堢鐞嗗憳璺ㄩ櫌鍖猴級锛岄櫌鍖洪殧绂诲彧瀵规櫘閫氱敤鎴风敓鏁堛��
+    -->
     <select id="selectSysDeptListBySysUserDept" parameterType="com.ruoyi.common.core.domain.entity.SysUserDept"
             resultMap="SysDeptResult">
-        <include refid="selectDeptVo"/>
-        inner join sys_user_dept ud
-        on d.dept_code = ud.dept_code
-        where 1=1
-        and d.del_flag = 0
-        and ud.del_flag = 0
-        <if test="orgid != null">and d.orgid = #{orgid} and ud.orgid = #{orgid}</if>
-        <if test="campusid != null">and d.campusid = #{campusid}</if>
-        <if test="userId != null">and ud.user_id = #{userId}</if>
-        <if test="deptType != null and deptType != ''">and d.dept_type = #{deptType}</if>
+        <choose>
+            <when test="userId != null">
+                <include refid="selectDeptVo"/>
+                inner join sys_user_dept ud
+                on d.dept_code = ud.dept_code
+                where 1=1
+                and d.del_flag = 0
+                and ud.del_flag = 0
+                <if test="orgid != null">and d.orgid = #{orgid} and ud.orgid = #{orgid}</if>
+                <if test="campusid != null">and d.campusid = #{campusid}</if>
+                <if test="deptType != null and deptType != ''">and d.dept_type = #{deptType}</if>
+                and ud.user_id = #{userId}
+            </when>
+            <otherwise>
+                <include refid="selectDeptVo"/>
+                where d.del_flag = 0
+                <if test="orgid != null">and d.orgid = #{orgid}</if>
+                <if test="deptType != null and deptType != ''">and d.dept_type = #{deptType}</if>
+            </otherwise>
+        </choose>
     </select>
 </mapper>

--
Gitblit v1.9.3