WANG il y a 6 ans
Parent
commit
815f1011da

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

@@ -5,6 +5,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.Optional;
 import java.util.Set;
+import java.util.stream.Collectors;
 
 import org.apache.commons.collections.CollectionUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -226,6 +227,20 @@ public class RolePrivilegeController extends ControllerSupport {
 		return rootNode;
 	}
 
+	@ApiOperation(value = "查询顶级机构的权限ID集合")
+	@GetMapping("getRootOrgPrivilegeIdList/{rootOrgId}/{privilegeGroupId}")
+	public List<Long> getRootOrgPrivilegeIdList(@PathVariable Long rootOrgId,
+			@PathVariable Long privilegeGroupId) {
+
+		List<RootOrgPrivilegeRelationEntity> list = rootOrgPrivilegeRelationRepo
+				.findAllByRootOrgIdAndGroupId(rootOrgId, privilegeGroupId);
+
+		List<Long> pList = list.stream().map(RootOrgPrivilegeRelationEntity::getPrivilegeId)
+				.collect(Collectors.toList());
+
+		return pList;
+	}
+
 	@ApiOperation(value = "查询角色的权限ID集合")
 	@GetMapping("getPrivilegeIdList/{rootOrgId}/{roleId}")
 	public Set<Long> getPrivilegeIdList(@PathVariable Long rootOrgId, @PathVariable Long roleId) {

+ 2 - 0
examcloud-core-basic-dao/src/main/java/cn/com/qmth/examcloud/core/basic/dao/RootOrgPrivilegeRelationRepo.java

@@ -19,4 +19,6 @@ public interface RootOrgPrivilegeRelationRepo
 
 	List<RootOrgPrivilegeRelationEntity> findAllByRootOrgId(Long rootOrgId);
 
+	List<RootOrgPrivilegeRelationEntity> findAllByRootOrgIdAndGroupId(Long rootOrgId, Long groupId);
+
 }