WANG 6 tahun lalu
induk
melakukan
033f0fec01

+ 21 - 2
examcloud-core-basic-api-provider/src/main/java/cn/com/qmth/examcloud/core/basic/api/controller/RolePrivilegeController.java

@@ -226,9 +226,9 @@ public class RolePrivilegeController extends ControllerSupport {
 		return rootNode;
 	}
 
-	@ApiOperation(value = "查询权限ID集合")
+	@ApiOperation(value = "查询角色的权限ID集合")
 	@GetMapping("getPrivilegeIdList/{rootOrgId}/{roleId}")
-	public Set<Long> getPrivilegeTree(@PathVariable Long rootOrgId, @PathVariable Long roleId) {
+	public Set<Long> getPrivilegeIdList(@PathVariable Long rootOrgId, @PathVariable Long roleId) {
 		List<RolePrivilegeRelationEntity> rolePrivRelationList = rolePrivilegeRelationRepo
 				.findAllByRoleIdAndRootOrgId(roleId, rootOrgId);
 
@@ -240,6 +240,25 @@ public class RolePrivilegeController extends ControllerSupport {
 		return pIdSet;
 	}
 
+	@ApiOperation(value = "查询角色的权限ID集合(限制权限组)")
+	@GetMapping("getPrivilegeIdList/{rootOrgId}/{roleId}/{privilegeGroupId}")
+	public Set<Long> getPrivilegeIdList(@PathVariable Long rootOrgId, @PathVariable Long roleId,
+			@PathVariable Long privilegeGroupId) {
+		List<RolePrivilegeRelationEntity> rolePrivRelationList = rolePrivilegeRelationRepo
+				.findAllByRoleIdAndRootOrgId(roleId, rootOrgId);
+
+		Set<Long> pIdSet = Sets.newHashSet();
+		for (RolePrivilegeRelationEntity cur : rolePrivRelationList) {
+			PrivilegeEntity privilegeEntity = GlobalHelper.getPresentEntity(privilegeRepo,
+					cur.getPrivilegeId(), PrivilegeEntity.class);
+			if (privilegeEntity.getGroupId().equals(privilegeGroupId)) {
+				pIdSet.add(cur.getPrivilegeId());
+			}
+		}
+
+		return pIdSet;
+	}
+
 	@ApiOperation(value = "更新角色权限关联")
 	@PostMapping("updateRolePrivilegeRelations")
 	public void updateRolePrivilegeRelations(@RequestBody UpdateRolePrivilegeRelationsDomain req) {