fix(系统设置): 修复批量添加用户组的问题

--bug=1007859 --user=刘瑞斌 【系统设置】批量添加用户组问题汇总 https://www.tapd.cn/55049933/s/1070964
This commit is contained in:
CaptainB 2021-11-20 14:53:53 +08:00 committed by 刘瑞斌
parent 8e22dbe625
commit a29e9eca20
2 changed files with 11 additions and 6 deletions

View File

@ -42,7 +42,7 @@ public class GroupController {
}
@GetMapping("/get/all")
public List<Group> getAllGroup() {
public List<GroupDTO> getAllGroup() {
return groupService.getAllGroup();
}

View File

@ -80,8 +80,8 @@ public class GroupService {
public Pager<List<GroupDTO>> getGroupList(EditGroupRequest request) {
SessionUser user = SessionUtils.getUser();
List<UserGroupDTO> userGroup = extUserGroupMapper.getUserGroup(Objects.requireNonNull(user).getId() , request.getProjectId());
List<String> groupTypeList = userGroup.stream().map(UserGroupDTO::getType).collect(Collectors.toList());
List<UserGroupDTO> userGroup = extUserGroupMapper.getUserGroup(Objects.requireNonNull(user).getId(), request.getProjectId());
List<String> groupTypeList = userGroup.stream().map(UserGroupDTO::getType).distinct().collect(Collectors.toList());
return getGroups(groupTypeList, request);
}
@ -319,8 +319,11 @@ public class GroupService {
return extUserGroupMapper.getProjectMemberGroups(projectId, userId);
}
public List<Group> getAllGroup() {
return groupMapper.selectByExample(new GroupExample());
public List<GroupDTO> getAllGroup() {
List<String> types = map.get(UserGroupType.SYSTEM);
EditGroupRequest request = new EditGroupRequest();
request.setTypes(types);
return extGroupMapper.getGroupList(request);
}
public List<?> getResource(String type, String groupId) {
@ -346,7 +349,9 @@ public class GroupService {
criteria.andIdEqualTo(workspaceId);
List<Workspace> workspaces = workspaceMapper.selectByExample(workspaceExample);
List<String> list = workspaces.stream().map(Workspace::getId).collect(Collectors.toList());
pc.andWorkspaceIdIn(list);
if (CollectionUtils.isNotEmpty(list)) {
pc.andWorkspaceIdIn(list);
}
}
return projectMapper.selectByExample(projectExample);
}