From 6d80e68e1ab530b8b8c12f4f0158b2106411d7d5 Mon Sep 17 00:00:00 2001 From: song-cc-rock Date: Wed, 31 Jan 2024 18:03:01 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E7=B3=BB=E7=BB=9F=E8=AE=BE=E7=BD=AE):?= =?UTF-8?q?=20=E6=B7=BB=E5=8A=A0=E7=94=A8=E6=88=B7=E7=BB=84=E6=88=90?= =?UTF-8?q?=E5=91=98=E9=BB=98=E8=AE=A4=E6=8E=92=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../metersphere/project/mapper/ExtProjectMemberMapper.xml | 2 +- .../project/mapper/ExtProjectUserRoleMapper.xml | 1 + .../metersphere/project/service/ProjectMemberService.java | 2 +- .../system/controller/OrganizationProjectController.java | 3 +-- .../system/controller/SystemProjectController.java | 3 +-- .../metersphere/system/mapper/ExtOrganizationMapper.xml | 8 ++++---- .../metersphere/system/mapper/ExtSystemProjectMapper.xml | 6 +++--- .../io/metersphere/system/mapper/ExtUserRoleMapper.xml | 1 + .../system/mapper/ExtUserRoleRelationMapper.xml | 1 + 9 files changed, 14 insertions(+), 13 deletions(-) diff --git a/backend/services/project-management/src/main/java/io/metersphere/project/mapper/ExtProjectMemberMapper.xml b/backend/services/project-management/src/main/java/io/metersphere/project/mapper/ExtProjectMemberMapper.xml index 97913694d4..0e722f32fc 100644 --- a/backend/services/project-management/src/main/java/io/metersphere/project/mapper/ExtProjectMemberMapper.xml +++ b/backend/services/project-management/src/main/java/io/metersphere/project/mapper/ExtProjectMemberMapper.xml @@ -14,7 +14,7 @@ - order by u.name + order by urr.create_time desc - select temp.*, max(if(temp.role_id = 'org_admin', true, false)) as adminFlag + select temp.*, max(if(temp.role_id = 'org_admin', true, false)) as adminFlag, min(temp.memberTime) as groupTime from ( - select u.*, urr.role_id + select u.*, urr.role_id, urr.create_time as memberTime from user_role_relation urr join `user` u on urr.user_id = u.id @@ -71,10 +71,10 @@ and u.name like concat('%', #{request.keyword},'%') - order by u.update_time desc + order by urr.create_time desc ) temp group by temp.id - order by adminFlag desc + order by adminFlag desc, groupTime desc - SELECT temp.* , MAX( if (temp.role_id = 'project_admin', true, false)) as adminFlag + SELECT temp.* , MAX( if (temp.role_id = 'project_admin', true, false)) as adminFlag, MIN(temp.memberTime) as groupTime FROM ( - SELECT `user`.* , user_role_relation.role_id + SELECT `user`.* , user_role_relation.role_id, user_role_relation.create_time as memberTime FROM user_role_relation LEFT JOIN `user` ON user_role_relation.user_id = `user`.id @@ -20,7 +20,7 @@ or user.phone like CONCAT('%', #{request.keyword},'%')) - ORDER BY `user`.update_time DESC) temp GROUP BY temp.id ORDER BY adminFlag DESC + ORDER BY `user_role_relation`.create_time DESC) temp GROUP BY temp.id ORDER BY adminFlag DESC, groupTime DESC \ No newline at end of file diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtUserRoleRelationMapper.xml b/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtUserRoleRelationMapper.xml index 0a282a3bed..6c8c895ede 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtUserRoleRelationMapper.xml +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtUserRoleRelationMapper.xml @@ -35,5 +35,6 @@ or u.email like concat('%', #{request.keyword},'%') ) + order by urr.create_time desc \ No newline at end of file