Pārlūkot izejas kodu

修复用户列表翻页数据重复问题

jiawuxian 1 gadu atpakaļ
vecāks
revīzija
d73504f290

+ 33 - 31
soc-modules/soc-modules-system/src/main/resources/mapper/system/SysUserMapper.xml

@@ -411,6 +411,8 @@
         (
         SELECT
         h.user_id AS is_manager,
+<!--        ur. role_names,-->
+<!--        ur. roleIds,-->
         GROUP_CONCAT(sr.role_name) role_names,
         CONCAT(",",GROUP_CONCAT( sr.id ),",") as roleIds,
         u.id,
@@ -453,6 +455,10 @@
         sys_user u
         LEFT JOIN sys_org o ON u.original_org_id = o.id
         LEFT JOIN ( SELECT user_id FROM sys_user_role uo LEFT JOIN sys_role ro ON uo.role_id = ro.id WHERE ro.role_name
+<!--        LIKE '%安全保卫管理人员' group by user_id) h ON h.user_id = u.id-->
+<!--        LEFT JOIN (select sro.user_id, GROUP_CONCAT(sr.role_name) role_names,-->
+<!--        CONCAT(",",GROUP_CONCAT( sr.id ),",") as roleIds from sys_user_role sro-->
+<!--        LEFT JOIN sys_role sr on sro.role_id=sr.id) ur on ur.user_id = u.id-->
         LIKE '%安全保卫管理人员' ) h ON h.user_id = u.id
         LEFT JOIN sys_user_role sro on u.id=sro.user_id
         LEFT JOIN sys_role sr on sro.role_id=sr.id
@@ -502,10 +508,10 @@
         <if test="info.onlyManager ==true">
             AND t.is_manage ='Y'
         </if>
-<!--        <if test="info.onlyManager ==false or info.onlyManager==null">-->
-<!--            AND (t.is_manage is NULL OR t.is_manage ='N')-->
-<!--        </if>-->
-        ORDER BY t.org_id DESC
+        <!--        <if test="info.onlyManager ==false or info.onlyManager==null">-->
+        <!--            AND (t.is_manage is NULL OR t.is_manage ='N')-->
+        <!--        </if>-->
+        ORDER BY  t.org_id DESC, t.id DESC
     </select>
     <select id="selectrolesByOrgId" resultType="com.xunmei.system.api.domain.SysRole">
         SELECT r.*
@@ -707,32 +713,28 @@
         </foreach>
     </select>
     <select id="selectSecurityUser" resultType="com.xunmei.system.util.SecurityUserExport">
-        SELECT
-            c.id AS orgId,
-            c.short_name AS orgName,
-            b.`name` AS name,
-            IFNULL( b.gender, 2 ) AS gender,
-            b.card AS card,
-            TIMESTAMPDIFF( YEAR, a.born_time, NOW() ) AS age,
-            a.dept_id AS departmentName,
-            a.duties AS nowDuties,
-            a.is_full_time AS isFullTime,
-            a.work_type AS workType,
-            a.entry_time AS entryTime,
-            TIMESTAMPDIFF( MONTH, a.work_time, NOW() ) AS workDuration,
-            a.highest_education AS highestEducation,
-            a.education_type AS educationType,
-            a.professional_qualifications AS professionalQualifications,
-            a.certificate_work AS certificateWork,
-            a.certificate_fail_reason AS certificateFailReason,
-            a.responsibilities_leader_name AS responsibilitiesLeaderName,
-            a.responsibilities_leader_duties AS responsibilitiesLeaderDuties
-        FROM
-            sys_user_information a
-                LEFT JOIN sys_user b ON a.user_id = b.id
-                LEFT JOIN sys_org c ON c.id = b.org_id
-        WHERE
-            b.deleted = 0
-
+        SELECT c.id                                     AS orgId,
+               c.short_name                             AS orgName,
+               b.`name`                                 AS name,
+               IFNULL(b.gender, 2)                      AS gender,
+               b.card                                   AS card,
+               TIMESTAMPDIFF(YEAR, a.born_time, NOW())  AS age,
+               a.dept_id                                AS departmentName,
+               a.duties                                 AS nowDuties,
+               a.is_full_time                           AS isFullTime,
+               a.work_type                              AS workType,
+               a.entry_time                             AS entryTime,
+               TIMESTAMPDIFF(MONTH, a.work_time, NOW()) AS workDuration,
+               a.highest_education                      AS highestEducation,
+               a.education_type                         AS educationType,
+               a.professional_qualifications            AS professionalQualifications,
+               a.certificate_work                       AS certificateWork,
+               a.certificate_fail_reason                AS certificateFailReason,
+               a.responsibilities_leader_name           AS responsibilitiesLeaderName,
+               a.responsibilities_leader_duties         AS responsibilitiesLeaderDuties
+        FROM sys_user_information a
+                 LEFT JOIN sys_user b ON a.user_id = b.id
+                 LEFT JOIN sys_org c ON c.id = b.org_id
+        WHERE b.deleted = 0
     </select>
 </mapper>