|
|
|
@ -104,18 +104,21 @@ public class RoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> impleme |
|
|
|
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
|
@Override |
|
|
|
|
public void deletedRole(Integer id) { |
|
|
|
|
//获取关联userId
|
|
|
|
|
List<Integer> userIds = userRoleService.getUserIdsByRoleId(id); |
|
|
|
|
//删除角色
|
|
|
|
|
sysRoleMapper.deleteById(id); |
|
|
|
|
//删除角色权限关联
|
|
|
|
|
rolePermissionService.remove(Wrappers.<SysRolePermission>lambdaQuery().eq(SysRolePermission::getRoleId, id)); |
|
|
|
|
//删除角色用户关联
|
|
|
|
|
userRoleService.remove(Wrappers.<SysUserRole>lambdaQuery().eq(SysUserRole::getRoleId, id)); |
|
|
|
|
if (!CollectionUtils.isEmpty(userIds)) { |
|
|
|
|
// 刷新权限
|
|
|
|
|
userIds.parallelStream().forEach(httpSessionService::refreshUerId); |
|
|
|
|
public void deletedRole(List<Integer> ids) { |
|
|
|
|
|
|
|
|
|
for (Integer id : ids) { |
|
|
|
|
//获取关联userId
|
|
|
|
|
List<Integer> userIds = userRoleService.getUserIdsByRoleId(id); |
|
|
|
|
//删除角色
|
|
|
|
|
sysRoleMapper.deleteById(id); |
|
|
|
|
//删除角色权限关联
|
|
|
|
|
rolePermissionService.remove(Wrappers.<SysRolePermission>lambdaQuery().eq(SysRolePermission::getRoleId, id)); |
|
|
|
|
//删除角色用户关联
|
|
|
|
|
userRoleService.remove(Wrappers.<SysUserRole>lambdaQuery().eq(SysUserRole::getRoleId, id)); |
|
|
|
|
if (!CollectionUtils.isEmpty(userIds)) { |
|
|
|
|
// 刷新权限
|
|
|
|
|
userIds.parallelStream().forEach(httpSessionService::refreshUerId); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|