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