修改编辑成员角色时出现的问题
This commit is contained in:
parent
4a27a0aeb6
commit
369b0399cc
|
@ -84,7 +84,6 @@ public class OrganizationService {
|
||||||
List<String> roles = memberDTO.getRoleIds();
|
List<String> roles = memberDTO.getRoleIds();
|
||||||
List<String> allRoleIds = memberRoles.stream().map(Role::getId).collect(Collectors.toList());
|
List<String> allRoleIds = memberRoles.stream().map(Role::getId).collect(Collectors.toList());
|
||||||
// 更新用户时添加了角色
|
// 更新用户时添加了角色
|
||||||
if (roles.size() > allRoleIds.size()) {
|
|
||||||
for (int i = 0; i < roles.size(); i++) {
|
for (int i = 0; i < roles.size(); i++) {
|
||||||
if (checkSourceRole(orgId, userId, roles.get(i)) == 0) {
|
if (checkSourceRole(orgId, userId, roles.get(i)) == 0) {
|
||||||
UserRole userRole = new UserRole();
|
UserRole userRole = new UserRole();
|
||||||
|
@ -97,8 +96,8 @@ public class OrganizationService {
|
||||||
userRoleMapper.insertSelective(userRole);
|
userRoleMapper.insertSelective(userRole);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (roles.size() < allRoleIds.size()){
|
|
||||||
allRoleIds.removeAll(roles);
|
allRoleIds.removeAll(roles);
|
||||||
|
if (allRoleIds.size() > 0) {
|
||||||
UserRoleExample userRoleExample = new UserRoleExample();
|
UserRoleExample userRoleExample = new UserRoleExample();
|
||||||
userRoleExample.createCriteria().andUserIdEqualTo(userId)
|
userRoleExample.createCriteria().andUserIdEqualTo(userId)
|
||||||
.andSourceIdEqualTo(orgId)
|
.andSourceIdEqualTo(orgId)
|
||||||
|
|
|
@ -151,7 +151,6 @@ public class WorkspaceService {
|
||||||
List<String> roles = memberDTO.getRoleIds();
|
List<String> roles = memberDTO.getRoleIds();
|
||||||
List<String> allRoleIds = memberRoles.stream().map(Role::getId).collect(Collectors.toList());
|
List<String> allRoleIds = memberRoles.stream().map(Role::getId).collect(Collectors.toList());
|
||||||
// 更新用户时添加了角色
|
// 更新用户时添加了角色
|
||||||
if (roles.size() > allRoleIds.size()) {
|
|
||||||
for (int i = 0; i < roles.size(); i++) {
|
for (int i = 0; i < roles.size(); i++) {
|
||||||
if (checkSourceRole(workspaceId, userId, roles.get(i)) == 0) {
|
if (checkSourceRole(workspaceId, userId, roles.get(i)) == 0) {
|
||||||
UserRole userRole = new UserRole();
|
UserRole userRole = new UserRole();
|
||||||
|
@ -164,8 +163,8 @@ public class WorkspaceService {
|
||||||
userRoleMapper.insertSelective(userRole);
|
userRoleMapper.insertSelective(userRole);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (roles.size() < allRoleIds.size()){
|
|
||||||
allRoleIds.removeAll(roles);
|
allRoleIds.removeAll(roles);
|
||||||
|
if (allRoleIds.size() > 0) {
|
||||||
UserRoleExample userRoleExample = new UserRoleExample();
|
UserRoleExample userRoleExample = new UserRoleExample();
|
||||||
userRoleExample.createCriteria().andUserIdEqualTo(userId)
|
userRoleExample.createCriteria().andUserIdEqualTo(userId)
|
||||||
.andSourceIdEqualTo(workspaceId)
|
.andSourceIdEqualTo(workspaceId)
|
||||||
|
|
Loading…
Reference in New Issue