From a77bf9fb4718d1b657f8ef8c6edfaffa1a53683f Mon Sep 17 00:00:00 2001
From: liusheng <337615773@qq.com>
Date: 星期五, 06 二月 2026 17:01:20 +0800
Subject: [PATCH] 处理数据查询慢的问题

---
 smartor/src/main/resources/mapper/smartor/SysUserMapper.xml |   28 +++++++++++++++++-----------
 1 files changed, 17 insertions(+), 11 deletions(-)

diff --git a/smartor/src/main/resources/mapper/smartor/SysUserMapper.xml b/smartor/src/main/resources/mapper/smartor/SysUserMapper.xml
index 2e6237e..428a18a 100644
--- a/smartor/src/main/resources/mapper/smartor/SysUserMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/SysUserMapper.xml
@@ -6,7 +6,6 @@
 
     <resultMap type="com.ruoyi.common.core.domain.entity.SysUser" id="SysUserResult">
         <id property="userId" column="user_id"/>
-        <id property="orgid" column="orgid"/>
         <id property="hisUserId" column="his_user_id"/>
         <result property="deptId" column="dept_id"/>
         <result property="userCode" column="user_code"/>
@@ -35,6 +34,8 @@
         <result property="userType" column="user_type"/>
         <result property="searchscope" column="searchscope"/>
         <result property="guid" column="guid"/>
+        <result property="orgid" column="orgid"/>
+        <result property="campusid" column="campusid"/>
         <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"/>
@@ -88,6 +89,7 @@
                u.remark,
                u.guid,
                u.orgid,
+               u.campusid,
                d.dept_id,
                d.parent_id,
                d.ancestors,
@@ -102,6 +104,7 @@
                r.data_scope,
                r.status as role_status
         from sys_user u
+                 left join sys_user_org o on o.user_id = u.user_id
                  left join sys_dept d on u.dept_id = d.dept_id
                  left join sys_user_role ur on u.user_id = ur.user_id
                  left join sys_role r on r.role_id = ur.role_id
@@ -114,11 +117,12 @@
         u.email,u.id_card,
         u.avatar,
         u.birthday,
-        u.orgid,
         u.job_phone,
         u.phonenumber, u.sex, u.status,
-        u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, d.dept_name, d.leader from sys_user
-        u
+        u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark,
+        u.orgid, u.campusid,
+        d.dept_name, d.leader
+        from sys_user u
         left join sys_dept d on u.dept_id = d.dept_id
         where u.del_flag = '0'
         <if test="userId != null and userId != 0">
@@ -173,7 +177,6 @@
         u.email,
         u.birthday,
         u.job_phone,
-        u.orgid,
         u.phonenumber, u.status,u.id_card,
         u.create_time
         from sys_user u
@@ -205,7 +208,6 @@
         u.email,
         u.his_user_id,
         u.title,
-        u.orgid,
         u.job_phone,
         u.birthday,
         u.phonenumber, u.status,u.id_card,
@@ -283,10 +285,11 @@
         <if test="birthday != null ">birthday,</if>
         <if test="hisUserId != null and hisUserId != ''">his_user_id,</if>
         <if test="guid != null and guid != ''">guid,</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>
         <if test="userCode != null and userCode != ''">user_code,</if>
+        <if test="orgid != null and orgid != ''">orgid,</if>
+        <if test="campusid != null and campusid != ''">campusid,</if>
         create_time
         )values(
         <if test="userId != null and userId != ''">#{userId},</if>
@@ -311,10 +314,11 @@
         <if test="birthday != null">#{birthday},</if>
         <if test="hisUserId != null and hisUserId != ''">#{hisUserId},</if>
         <if test="guid != null and guid != ''">#{guid},</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>
         <if test="userCode != null and userCode != ''">#{userCode},</if>
+        <if test="orgid != null and orgid != ''">#{orgid},</if>
+        <if test="campusid != null and campusid != ''">#{campusid},</if>
         sysdate()
         )
     </insert>
@@ -324,7 +328,7 @@
         insert into sys_user(
         user_id, dept_id, user_name, nick_name, email, avatar, phonenumber, sex, password, status, create_by, remark,
         user_type, dept_info, hosp_info, searchscope, id_card, title, job_phone, birthday, his_user_id, guid,
-        orgid,user_code,
+        user_code, orgid, campusid,
         create_time
         ) values
         <foreach collection="list" item="item" separator=",">
@@ -351,8 +355,9 @@
             #{item.birthday},
             #{item.hisUserId},
             #{item.guid},
-            #{item.orgid},
             #{item.userCode},
+            #{item.orgid},
+            #{item.campusid},
             now()
             )
         </foreach>
@@ -381,7 +386,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="userCode != null ">user_code=#{userCode},</if>
             <if test="title != null and title != ''">
                 title = #{title},
@@ -389,6 +393,8 @@
             <if test="hisUserId != null and hisUserId != ''">
                 his_user_id = #{hisUserId},
             </if>
+            <if test="orgid != null and orgid != ''">orgid = #{orgid},</if>
+            <if test="campusid != null and campusid != ''">campusid = #{campusid},</if>
             update_time = sysdate()
         </set>
         where user_id = #{userId}

--
Gitblit v1.9.3