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 16e290cd6d..c77e83dc25 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 @@ -26,7 +26,7 @@ and (u.name like concat('%', #{keyword}, '%') or u.email like concat('%', #{keyword}, '%')) - order by u.create_time desc + order by u.name limit 100 diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/service/UserRoleService.java b/backend/services/system-setting/src/main/java/io/metersphere/system/service/UserRoleService.java index e193e3e94e..8729634680 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/service/UserRoleService.java +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/service/UserRoleService.java @@ -13,6 +13,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.ArrayList; +import java.util.Comparator; import java.util.List; import java.util.Map; import java.util.stream.Collectors; @@ -44,7 +45,7 @@ public class UserRoleService { UserRoleRelationExample example = new UserRoleRelationExample(); example.createCriteria().andSourceIdEqualTo(sourceId); List userRoleRelations = userRoleRelationMapper.selectByExample(example); - if (org.apache.commons.collections.CollectionUtils.isNotEmpty(userRoleRelations)) { + if (CollectionUtils.isNotEmpty(userRoleRelations)) { Map> userRoleMap = userRoleRelations.stream().collect(Collectors.groupingBy(UserRoleRelation::getUserId, Collectors.mapping(UserRoleRelation::getRoleId, Collectors.toList()))); userRoleMap.forEach((k, v) -> { @@ -61,7 +62,7 @@ public class UserRoleService { // 设置用户信息, 用户不存在或者已删除, 则不展示 List userIds = userExtends.stream().map(UserExtend::getId).toList(); List users = extUserMapper.getRoleUserByParam(userIds, keyword); - if (org.apache.commons.collections.CollectionUtils.isNotEmpty(users)) { + if (CollectionUtils.isNotEmpty(users)) { Map userMap = users.stream().collect(Collectors.toMap(User::getId, user -> user)); userExtends.removeIf(userExtend -> { if (userMap.containsKey(userExtend.getId())) { @@ -74,6 +75,8 @@ public class UserRoleService { userExtends.clear(); } } + + userExtends.sort(Comparator.comparing(UserExtend::getName)); return userExtends; } }