|
@@ -252,6 +252,86 @@ public class RolePrivilegeController extends ControllerSupport {
|
|
|
|
|
|
return pList;
|
|
return pList;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 2020年2月11日
|
|
|
|
+ *
|
|
|
|
+ * @author WANGWEI
|
|
|
|
+ * @param rootOrgId
|
|
|
|
+ * @param privilegeGroupCode
|
|
|
|
+ * @param withRootOrgSuffix
|
|
|
|
+ * @param full
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ @ApiOperation(value = "查询顶级机构的权限集合")
|
|
|
|
+ @GetMapping("getRootOrgPrivilegeList")
|
|
|
|
+ public List<PrivilegeDomain> getRootOrgPrivilegeList(@RequestParam Long rootOrgId,
|
|
|
|
+ @RequestParam String privilegeGroupCode,
|
|
|
|
+ @RequestParam(defaultValue = "true") boolean withRootOrgSuffix,
|
|
|
|
+ @RequestParam boolean full) {
|
|
|
|
+
|
|
|
|
+ validateRootOrgIsolation(rootOrgId);
|
|
|
|
+
|
|
|
|
+ PrivilegeGroupEntity matrixPrivilegeGroup = null;
|
|
|
|
+
|
|
|
|
+ if (withRootOrgSuffix) {
|
|
|
|
+
|
|
|
|
+ matrixPrivilegeGroup = privilegeGroupRepo.findByCode(privilegeGroupCode);
|
|
|
|
+ if (null == matrixPrivilegeGroup) {
|
|
|
|
+ throw new StatusException("002109", "groupCode is not existing");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ privilegeGroupCode = privilegeGroupCode + "_" + rootOrgId;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ PrivilegeGroupEntity privilegeGroup = privilegeGroupRepo.findByCode(privilegeGroupCode);
|
|
|
|
+
|
|
|
|
+ if (null == privilegeGroup) {
|
|
|
|
+ throw new StatusException("002101", "groupCode is not existing");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ List<RootOrgPrivilegeRelationEntity> list = rootOrgPrivilegeRelationRepo
|
|
|
|
+ .findAllByRootOrgIdAndGroupId(rootOrgId, privilegeGroup.getId());
|
|
|
|
+
|
|
|
|
+ List<Long> pList = list.stream().map(RootOrgPrivilegeRelationEntity::getPrivilegeId)
|
|
|
|
+ .collect(Collectors.toList());
|
|
|
|
+
|
|
|
|
+ List<PrivilegeEntity> privilegeList = privilegeRepo
|
|
|
|
+ .findAllByGroupIdOrderByWeightDesc(privilegeGroup.getId());
|
|
|
|
+
|
|
|
|
+ List<PrivilegeDomain> privilegeInfoList = Lists.newArrayList();
|
|
|
|
+
|
|
|
|
+ for (PrivilegeEntity cur : privilegeList) {
|
|
|
|
+ boolean hasPrivilege = pList.contains(cur.getId());
|
|
|
|
+
|
|
|
|
+ if ((!full) && (!hasPrivilege)) {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ PrivilegeDomain privilegeInfo = new PrivilegeDomain();
|
|
|
|
+ privilegeInfo.setHasPrivilege(hasPrivilege);
|
|
|
|
+ privilegeInfo.setCode(cur.getCode());
|
|
|
|
+ privilegeInfo.setCreationTime(cur.getCreationTime());
|
|
|
|
+ privilegeInfo.setGroupId(cur.getGroupId());
|
|
|
|
+ privilegeInfo.setGroupCode(privilegeGroup.getCode());
|
|
|
|
+ privilegeInfo.setId(cur.getId());
|
|
|
|
+ privilegeInfo.setName(cur.getName());
|
|
|
|
+ privilegeInfo.setParentId(cur.getParentId());
|
|
|
|
+ privilegeInfo.setUpdateTime(cur.getUpdateTime());
|
|
|
|
+ privilegeInfo.setDescription(cur.getDescription());
|
|
|
|
+ privilegeInfo.setWeight(cur.getWeight());
|
|
|
|
+ privilegeInfo.setExt1(cur.getExt1());
|
|
|
|
+ privilegeInfo.setExt2(cur.getExt2());
|
|
|
|
+ privilegeInfo.setExt3(cur.getExt3());
|
|
|
|
+ privilegeInfo.setExt4(cur.getExt4());
|
|
|
|
+ privilegeInfo.setExt5(cur.getExt5());
|
|
|
|
+
|
|
|
|
+ privilegeInfoList.add(privilegeInfo);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return privilegeInfoList;
|
|
|
|
+ }
|
|
|
|
|
|
@ApiOperation(value = "查询角色的权限ID集合")
|
|
@ApiOperation(value = "查询角色的权限ID集合")
|
|
@GetMapping("getPrivilegeIdList/{rootOrgId}/{roleId}")
|
|
@GetMapping("getPrivilegeIdList/{rootOrgId}/{roleId}")
|