From 18925965b55c103283a2fcbb161cceed41139ec6 Mon Sep 17 00:00:00 2001
From: 陈昶聿 <chychen@nbjetron.com>
Date: 星期四, 12 十一月 2026 17:14:20 +0800
Subject: [PATCH] /system/user/list 增加hospInfoCode\deptInfoCode 匹配

---
 ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml             |   32 ++++++++++++++++
 ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysUser.java |   58 +++++++++++++++++++++++++++++
 2 files changed, 90 insertions(+), 0 deletions(-)

diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysUser.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysUser.java
index 905ee0d..f4f5952 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysUser.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysUser.java
@@ -1,6 +1,7 @@
 package com.ruoyi.common.core.domain.entity;
 
 import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fasterxml.jackson.annotation.JsonIgnore;
 import com.ruoyi.common.annotation.Excel;
 import com.ruoyi.common.annotation.Excel.ColumnType;
 import com.ruoyi.common.annotation.Excel.Type;
@@ -187,6 +188,18 @@
     private String deptInfo;
 
     /**
+     * 绉戝淇℃伅锛堟寜瀹屾暣 Code 鍖归厤锛�
+     */
+    @ApiModelProperty(value = "绉戝淇℃伅锛堟寜瀹屾暣 Code 鍖归厤锛�")
+    private String hospInfoCode;
+
+    /**
+     * 鐥呭尯淇℃伅锛堟寜瀹屾暣 Code 鍖归厤锛�
+     */
+    @ApiModelProperty(value = "鐥呭尯淇℃伅锛堟寜瀹屾暣 Code 鍖归厤锛�")
+    private String deptInfoCode;
+
+    /**
      * 閮ㄩ棬瀵硅薄
      */
     @ApiModelProperty(value = "閮ㄩ棬瀵硅薄")
@@ -339,6 +352,51 @@
         this.deptInfo = deptInfo;
     }
 
+    public String getHospInfoCode() {
+        return this.hospInfoCode;
+    }
+
+    public void setHospInfoCode(String hospInfoCode) {
+        this.hospInfoCode = hospInfoCode;
+    }
+
+    public String getDeptInfoCode() {
+        return this.deptInfoCode;
+    }
+
+    public void setDeptInfoCode(String deptInfoCode) {
+        this.deptInfoCode = deptInfoCode;
+    }
+
+    /**
+     * 绉戝 Code 鍒楄〃锛屾敮鎸� hospInfoCode=D001,D003 杩欑閫楀彿鍒嗛殧鐨勫 Code 浼犲弬
+     */
+    @JsonIgnore
+    public List<String> getHospInfoCodeList() {
+        return splitCodes(this.hospInfoCode);
+    }
+
+    /**
+     * 鐥呭尯 Code 鍒楄〃锛屾敮鎸� deptInfoCode=W001,W003 杩欑閫楀彿鍒嗛殧鐨勫 Code 浼犲弬
+     */
+    @JsonIgnore
+    public List<String> getDeptInfoCodeList() {
+        return splitCodes(this.deptInfoCode);
+    }
+
+    private static List<String> splitCodes(String codes) {
+        if (codes == null || codes.trim().isEmpty()) {
+            return Collections.emptyList();
+        }
+        List<String> codeList = new ArrayList<>();
+        for (String code : codes.split(",")) {
+            if (code != null && !code.trim().isEmpty()) {
+                codeList.add(code.trim());
+            }
+        }
+        return codeList;
+    }
+
     public SysUser(Long userId) {
         this.userId = userId;
     }
diff --git a/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml
index ac40ec5..9075330 100644
--- a/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml
+++ b/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml
@@ -173,6 +173,22 @@
             AND (u.dept_id = #{deptId} OR u.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE find_in_set(#{deptId},
             ancestors) ))
         </if>
+        <if test="hospInfoCodeList != null and hospInfoCodeList.size() > 0">
+            <!-- 绉戝澶� Code 浠讳竴鍖归厤锛欴001,D003 绛変环浜� D001 鎴� D003锛岄『搴忔棤鍏� -->
+            AND (
+            <foreach collection="hospInfoCodeList" item="code" separator=" OR ">
+                u.hosp_info LIKE concat('%"', #{code}, '"%')
+            </foreach>
+            )
+        </if>
+        <if test="deptInfoCodeList != null and deptInfoCodeList.size() > 0">
+            <!-- 鐥呭尯澶� Code 浠讳竴鍖归厤锛歐001,W003 绛変环浜� W001 鎴� W003锛岄『搴忔棤鍏� -->
+            AND (
+            <foreach collection="deptInfoCodeList" item="code" separator=" OR ">
+                u.dept_info LIKE concat('%"', #{code}, '"%')
+            </foreach>
+            )
+        </if>
         <!-- 鏁版嵁鑼冨洿杩囨护 -->
         ${params.dataScope}
     </select>
@@ -242,6 +258,22 @@
             AND (u.dept_id = #{deptId} OR u.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE find_in_set(#{deptId},
             ancestors) ))
         </if>
+        <if test="hospInfoCodeList != null and hospInfoCodeList.size() > 0">
+            <!-- 绉戝澶� Code 浠讳竴鍖归厤锛欴001,D003 绛変环浜� D001 鎴� D003锛岄『搴忔棤鍏� -->
+            AND (
+            <foreach collection="hospInfoCodeList" item="code" separator=" OR ">
+                u.hosp_info LIKE concat('%"', #{code}, '"%')
+            </foreach>
+            )
+        </if>
+        <if test="deptInfoCodeList != null and deptInfoCodeList.size() > 0">
+            <!-- 鐥呭尯澶� Code 浠讳竴鍖归厤锛歐001,W003 绛変环浜� W001 鎴� W003锛岄『搴忔棤鍏� -->
+            AND (
+            <foreach collection="deptInfoCodeList" item="code" separator=" OR ">
+                u.dept_info LIKE concat('%"', #{code}, '"%')
+            </foreach>
+            )
+        </if>
         <if test="pageSize != null  and pageNum != null">limit ${pageSize} OFFSET ${pageNum}</if>
     </select>
 

--
Gitblit v1.9.3