From 18f876d637cf1e9b0b264a4586e4a676a21f8166 Mon Sep 17 00:00:00 2001
From: liusheng <337615773@qq.com>
Date: 星期五, 13 十一月 2026 10:30:46 +0800
Subject: [PATCH] 代码提交

---
 ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml |   43 +++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 43 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 2e18b43..cf4e077 100644
--- a/ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml
+++ b/ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml
@@ -85,6 +85,14 @@
         <if test="orgid != null and orgid != ''">
             AND orgid = #{orgid}
         </if>
+        <if test="deptCodes != null and deptCodes.size() > 0">
+            AND dept_code IN
+            <foreach collection="deptCodes" item="deptCodeItem" open="("
+                     separator=","
+                     close=")">
+                #{deptCodeItem}
+            </foreach>
+        </if>
         <!-- 鏁版嵁鑼冨洿杩囨护 -->
         ${params.dataScope}
         order by d.dept_type asc, d.parent_id, d.order_num
@@ -127,6 +135,7 @@
         select d.dept_id,
                d.parent_id,
                d.campusid,
+               d.orgid,
                d.dept_code,
                d.dept_type,
                d.ancestors,
@@ -169,6 +178,8 @@
         from sys_dept
         where find_in_set(#{deptId}, ancestors)
     </select>
+
+
 
     <select id="selectNormalChildrenDeptById" parameterType="Long" resultType="int">
         select count(*)
@@ -272,4 +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">
+        <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