|
@@ -229,8 +229,10 @@ public class RolePrivilegeController extends ControllerSupport {
|
|
|
throw new StatusException("B-020001", "权限组不存在");
|
|
|
}
|
|
|
|
|
|
- if (BasicConsts.ROOT_PRIVILEGE_ID != privilege.getParentId()) {
|
|
|
-
|
|
|
+ if (null == privilege.getParentId()
|
|
|
+ || BasicConsts.ROOT_PRIVILEGE_ID == privilege.getParentId()) {
|
|
|
+ privilege.setParentId(null);
|
|
|
+ } else {
|
|
|
PrivilegeEntity parentPrivilege = privilegeRepo.findOne(privilege.getParentId());
|
|
|
if (null == parentPrivilege) {
|
|
|
throw new StatusException("B-020002", "父权限不存在");
|
|
@@ -238,8 +240,6 @@ public class RolePrivilegeController extends ControllerSupport {
|
|
|
if (!parentPrivilege.getGroupId().equals(privilege.getGroupId())) {
|
|
|
throw new StatusException("B-020003", "权限组错误");
|
|
|
}
|
|
|
- } else {
|
|
|
- privilege.setParentId(null);
|
|
|
}
|
|
|
|
|
|
PrivilegeEntity ret = privilegeRepo.save(privilege);
|