fix(system): 修复更新账号时岗位为空时发生的空指针异常
This commit is contained in:
parent
522ab17902
commit
fb479d7d79
@ -138,8 +138,9 @@ public class PermissionServiceImpl implements PermissionService {
|
||||
// 获得角色拥有菜单编号
|
||||
Set<Long> dbMenuIds = convertSet(roleMenuMapper.selectListByRoleId(roleId), RoleMenuDO::getMenuId);
|
||||
// 计算新增和删除的菜单编号
|
||||
Collection<Long> createMenuIds = CollUtil.subtract(menuIds, dbMenuIds);
|
||||
Collection<Long> deleteMenuIds = CollUtil.subtract(dbMenuIds, menuIds);
|
||||
Set<Long> menuIdList = CollUtil.emptyIfNull(menuIds);
|
||||
Collection<Long> createMenuIds = CollUtil.subtract(menuIdList, dbMenuIds);
|
||||
Collection<Long> deleteMenuIds = CollUtil.subtract(dbMenuIds, menuIdList);
|
||||
// 执行新增和删除。对于已经授权的菜单,不用做任何处理
|
||||
if (CollUtil.isNotEmpty(createMenuIds)) {
|
||||
roleMenuMapper.insertBatch(CollectionUtils.convertList(createMenuIds, menuId -> {
|
||||
@ -205,8 +206,9 @@ public class PermissionServiceImpl implements PermissionService {
|
||||
Set<Long> dbRoleIds = convertSet(userRoleMapper.selectListByUserId(userId),
|
||||
UserRoleDO::getRoleId);
|
||||
// 计算新增和删除的角色编号
|
||||
Collection<Long> createRoleIds = CollUtil.subtract(roleIds, dbRoleIds);
|
||||
Collection<Long> deleteMenuIds = CollUtil.subtract(dbRoleIds, roleIds);
|
||||
Set<Long> roleIdList = CollUtil.emptyIfNull(roleIds);
|
||||
Collection<Long> createRoleIds = CollUtil.subtract(roleIdList, dbRoleIds);
|
||||
Collection<Long> deleteMenuIds = CollUtil.subtract(dbRoleIds, roleIdList);
|
||||
// 执行新增和删除。对于已经授权的角色,不用做任何处理
|
||||
if (!CollectionUtil.isEmpty(createRoleIds)) {
|
||||
userRoleMapper.insertBatch(CollectionUtils.convertList(createRoleIds, roleId -> {
|
||||
|
@ -117,7 +117,7 @@ public class AdminUserServiceImpl implements AdminUserService {
|
||||
Long userId = reqVO.getId();
|
||||
Set<Long> dbPostIds = convertSet(userPostMapper.selectListByUserId(userId), UserPostDO::getPostId);
|
||||
// 计算新增和删除的岗位编号
|
||||
Set<Long> postIds = updateObj.getPostIds();
|
||||
Set<Long> postIds = CollUtil.emptyIfNull(updateObj.getPostIds());
|
||||
Collection<Long> createPostIds = CollUtil.subtract(postIds, dbPostIds);
|
||||
Collection<Long> deletePostIds = CollUtil.subtract(dbPostIds, postIds);
|
||||
// 执行新增和删除。对于已经授权的菜单,不用做任何处理
|
||||
|
Loading…
Reference in New Issue
Block a user