修复删除角色和删除权限失败时,不提示的bug

This commit is contained in:
郑杰
2018-09-21 17:04:32 +08:00
parent 73b3c94feb
commit 575b932e93
2 changed files with 9 additions and 6 deletions
@@ -73,10 +73,12 @@ public class PermissionServiceImpl implements PermissionService {
@Override
public void delete(Permission permission) {
if(permission.getRoles() != null && permission.getRoles().size()!=0){
throw new AuroraException(HttpStatus.HTTP_BAD_REQUEST,"暂不支持删除使用中的权限,请先与角色解绑");
try {
permissionRepo.delete(permission);
}catch (Exception e){
throw new AuroraException(HttpStatus.HTTP_BAD_REQUEST,"删除失败,请检查权限是否被使用");
}
permissionRepo.delete(permission);
}
@Override
@@ -96,10 +96,11 @@ public class RoleServiceImpl implements RoleService {
@Override
public void delete(Role role) {
if(role.getUsers() != null && role.getUsers().size() != 0){
throw new AuroraException(400,"角色使用中,请先解绑用户");
try {
roleRepo.delete(role);
}catch (Exception e){
throw new AuroraException(HttpStatus.HTTP_INTERNAL_ERROR,"删除失败,请检查角色是否被使用");
}
roleRepo.delete(role);
}
@Override