fix: 调整同 workspace 下 user 不能重复
This commit is contained in:
@@ -59,9 +59,14 @@ public class WorkspaceMemberServiceImpl extends ServiceImpl<WorkspaceMemberDao,
|
|||||||
if (T.StrUtil.equalsIgnoreCase(workspaceId, "1")) {
|
if (T.StrUtil.equalsIgnoreCase(workspaceId, "1")) {
|
||||||
throw new ASWException(RCode.WORKSPACE_BUILT_IN);
|
throw new ASWException(RCode.WORKSPACE_BUILT_IN);
|
||||||
}
|
}
|
||||||
long count = memberList.stream().map(x -> x.getUserId()).distinct().count();
|
|
||||||
if (count != memberList.size()) {
|
List userIdList = memberList.stream().map(x -> x.getUserId()).toList();
|
||||||
throw new ASWException(RCode.WORKSPACE_MEMBER_USER_ID_REPEAT);
|
List<WorkspaceMemberEntity> memberEntityList = workspaceMemberService.list(new LambdaQueryWrapper<WorkspaceMemberEntity>().eq(WorkspaceMemberEntity::getWorkspaceId, workspaceId));
|
||||||
|
if (T.CollectionUtil.isNotEmpty(memberList)){
|
||||||
|
memberEntityList = memberEntityList.stream().filter(x -> userIdList.contains(x.getUserId())).toList();
|
||||||
|
if (T.CollectionUtil.isNotEmpty(memberEntityList)) {
|
||||||
|
throw new ASWException(RCode.WORKSPACE_MEMBER_USER_ID_REPEAT);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
List<String> userIds = userService.list().stream().map(x -> x.getId()).toList();
|
List<String> userIds = userService.list().stream().map(x -> x.getId()).toList();
|
||||||
List<String> roleIds = roleService.list().stream().map(x -> x.getId()).toList();
|
List<String> roleIds = roleService.list().stream().map(x -> x.getId()).toList();
|
||||||
|
|||||||
Reference in New Issue
Block a user