From dfdcc7850c244d1c41f2421dbe948558418927ae Mon Sep 17 00:00:00 2001
From: 陈昶聿 <chychen@nbjetron.com>
Date: 星期二, 20 一月 2026 15:52:51 +0800
Subject: [PATCH] 【丽水】菜单管理-查询 menu 不限制 orgid,orgid都为空

---
 ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml |   30 ++++++++++++++----------------
 1 files changed, 14 insertions(+), 16 deletions(-)

diff --git a/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml
index 20ff6a8..14a7c7a 100644
--- a/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml
+++ b/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml
@@ -35,7 +35,6 @@
         <result property="userType" column="user_type"/>
         <result property="searchscope" column="searchscope"/>
         <result property="guid" column="guid"/>
-        <result property="orgid" column="orgid"/>
         <association property="dept" column="dept_id" javaType="com.ruoyi.common.core.domain.entity.SysDept"
                      resultMap="deptResult"/>
         <collection property="roles" javaType="java.util.List" resultMap="RoleResult"/>
@@ -89,7 +88,6 @@
                u.create_time,
                u.remark,
                u.guid,
-               u.orgid,
                d.dept_id,
                d.parent_id,
                d.ancestors,
@@ -125,9 +123,6 @@
         where u.del_flag = '0'
         <if test="userId != null">
             AND u.user_id = #{userId}
-        </if>
-        <if test="orgid != null and orgid != ''">
-            AND u.orgid = #{orgid}
         </if>
         <if test="userName != null and userName != ''">
             AND u.user_name like concat('%', #{userName}, '%')
@@ -187,11 +182,11 @@
         u.phonenumber, u.sex, u.status,
         u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark from sys_user u
         where u.del_flag = '0'
+        <if test="orgid != null">
+            AND u.orgid = #{orgid}
+        </if>
         <if test="userId != null">
             AND u.user_id = #{userId}
-        </if>
-        <if test="orgid != null and orgid != ''">
-            AND u.orgid = #{orgid}
         </if>
         <if test="userName != null and userName != ''">
             AND u.user_name like concat('%', #{userName}, '%')
@@ -309,8 +304,8 @@
 
     <select id="selectUserByUserNameByCondition" parameterType="String" resultMap="SysUserResult">
         <include refid="selectUserVo"/>
-        <where>
-            u.del_flag = '0'
+        where 1=1
+            AND u.del_flag = '0'
             <if test="userName != null and userName != ''">
                 AND u.user_name = #{userName}
             </if>
@@ -320,7 +315,6 @@
             <if test="deptId != null and deptId != ''">
                 AND u.dept_id = #{deptId}
             </if>
-        </where>
     </select>
 
     <select id="selectUserById" parameterType="Long" resultMap="SysUserResult">
@@ -328,11 +322,18 @@
         where u.user_id = #{userId}
     </select>
 
-    <select id="checkUserNameUnique" parameterType="String" resultMap="SysUserResult">
+    <select id="checkUserNameUnique" parameterType="com.ruoyi.common.core.domain.entity.SysUser" resultMap="SysUserResult">
         select user_id, user_name
         from sys_user
         where user_name = #{userName}
-          and del_flag = '0' limit 1
+        and del_flag = '0'
+        <if test="orgid != null and orgid != ''">
+            and orgid = #{orgid}
+        </if>
+        <if test="campusid != null and campusid != ''">
+            and campusid = #{campusid}
+        </if>
+        limit 1
     </select>
 
     <select id="checkPhoneUnique" parameterType="String" resultMap="SysUserResult">
@@ -374,7 +375,6 @@
         <if test="jobPhone != null and jobPhone != ''">job_phone,</if>
         <if test="birthday != null ">birthday,</if>
         <if test="hisUserId != null and hisUserId != ''">his_user_id,</if>
-        <if test="orgid != null and orgid != ''">orgid,</if>
         <if test="deptCode != null and deptCode != ''">dept_code,</if>
         <if test="deptName != null and deptName != ''">dept_name,</if>
         create_time
@@ -400,7 +400,6 @@
         <if test="jobPhone != null and jobPhone != ''">#{jobPhone},</if>
         <if test="birthday != null and birthday != ''">#{birthday},</if>
         <if test="hisUserId != null and hisUserId != ''">#{hisUserId},</if>
-        <if test="orgid != null and orgid != ''">#{orgid},</if>
         <if test="deptCode != null and deptCode != ''">#{deptCode},</if>
         <if test="deptName != null and deptName != ''">#{deptName},</if>
         sysdate()
@@ -430,7 +429,6 @@
             <if test="idCard != null and idCard != ''">id_card=#{idCard},</if>
             <if test="jobPhone != null and jobPhone != ''">job_phone=#{jobPhone},</if>
             <if test="birthday != null ">birthday=#{birthday},</if>
-            <if test="orgid != null ">orgid=#{orgid},</if>
             <if test="title != null and title != ''">
                 title = #{title},
             </if>

--
Gitblit v1.9.3