|
@@ -28,6 +28,7 @@ import cn.com.qmth.examcloud.commons.web.support.ControllerSupport;
|
|
import cn.com.qmth.examcloud.core.basic.api.controller.bean.PrivilegeGroupBean;
|
|
import cn.com.qmth.examcloud.core.basic.api.controller.bean.PrivilegeGroupBean;
|
|
import cn.com.qmth.examcloud.core.basic.api.controller.bean.PrivilegeInfo;
|
|
import cn.com.qmth.examcloud.core.basic.api.controller.bean.PrivilegeInfo;
|
|
import cn.com.qmth.examcloud.core.basic.api.controller.bean.UpdateRolePrivilegeRelationsReq;
|
|
import cn.com.qmth.examcloud.core.basic.api.controller.bean.UpdateRolePrivilegeRelationsReq;
|
|
|
|
+import cn.com.qmth.examcloud.core.basic.base.constants.BasicConsts;
|
|
import cn.com.qmth.examcloud.core.basic.dao.AppRepo;
|
|
import cn.com.qmth.examcloud.core.basic.dao.AppRepo;
|
|
import cn.com.qmth.examcloud.core.basic.dao.OrgRepo;
|
|
import cn.com.qmth.examcloud.core.basic.dao.OrgRepo;
|
|
import cn.com.qmth.examcloud.core.basic.dao.PrivilegeGroupRepo;
|
|
import cn.com.qmth.examcloud.core.basic.dao.PrivilegeGroupRepo;
|
|
@@ -177,7 +178,7 @@ public class RolePrivilegeController extends ControllerSupport {
|
|
PrivilegeGroupEntity group = privilegeGroupRepo.findOne(groupId);
|
|
PrivilegeGroupEntity group = privilegeGroupRepo.findOne(groupId);
|
|
List<PrivilegeEntity> privilegeList = privilegeRepo
|
|
List<PrivilegeEntity> privilegeList = privilegeRepo
|
|
.findAllByGroupIdOrderByWeightDesc(groupId);
|
|
.findAllByGroupIdOrderByWeightDesc(groupId);
|
|
- EleTreeNode rootNode = new EleTreeNode(-1L, group.getName());
|
|
|
|
|
|
+ EleTreeNode rootNode = new EleTreeNode(BasicConsts.ROOT_PRIVILEGE_ID, group.getName());
|
|
TreeUtil.convert2OneEleTreeNode(rootNode, privilegeList);
|
|
TreeUtil.convert2OneEleTreeNode(rootNode, privilegeList);
|
|
|
|
|
|
return rootNode;
|
|
return rootNode;
|
|
@@ -211,7 +212,8 @@ public class RolePrivilegeController extends ControllerSupport {
|
|
throw new StatusException("B-012001", "非法请求");
|
|
throw new StatusException("B-012001", "非法请求");
|
|
}
|
|
}
|
|
|
|
|
|
- rolePrivilegeService.updateRolePrivilegeRelations(rootOrgId, roleId, privilegeGroupId,privilegeIdSet);
|
|
|
|
|
|
+ rolePrivilegeService.updateRolePrivilegeRelations(rootOrgId, roleId, privilegeGroupId,
|
|
|
|
+ privilegeIdSet);
|
|
}
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "增加权限")
|
|
@ApiOperation(value = "增加权限")
|
|
@@ -227,7 +229,8 @@ public class RolePrivilegeController extends ControllerSupport {
|
|
throw new StatusException("B-020001", "权限组不存在");
|
|
throw new StatusException("B-020001", "权限组不存在");
|
|
}
|
|
}
|
|
|
|
|
|
- if (null != privilege.getParentId()) {
|
|
|
|
|
|
+ if (BasicConsts.ROOT_PRIVILEGE_ID != privilege.getParentId()) {
|
|
|
|
+
|
|
PrivilegeEntity parentPrivilege = privilegeRepo.findOne(privilege.getParentId());
|
|
PrivilegeEntity parentPrivilege = privilegeRepo.findOne(privilege.getParentId());
|
|
if (null == parentPrivilege) {
|
|
if (null == parentPrivilege) {
|
|
throw new StatusException("B-020002", "父权限不存在");
|
|
throw new StatusException("B-020002", "父权限不存在");
|
|
@@ -235,6 +238,8 @@ public class RolePrivilegeController extends ControllerSupport {
|
|
if (!parentPrivilege.getGroupId().equals(privilege.getGroupId())) {
|
|
if (!parentPrivilege.getGroupId().equals(privilege.getGroupId())) {
|
|
throw new StatusException("B-020003", "权限组错误");
|
|
throw new StatusException("B-020003", "权限组错误");
|
|
}
|
|
}
|
|
|
|
+ } else {
|
|
|
|
+ privilege.setParentId(null);
|
|
}
|
|
}
|
|
|
|
|
|
PrivilegeEntity ret = privilegeRepo.save(privilege);
|
|
PrivilegeEntity ret = privilegeRepo.save(privilege);
|