Quellcode durchsuchen

权限组查询改造

wangwei vor 5 Jahren
Ursprung
Commit
aebc6b3be6

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

@@ -9,7 +9,6 @@ import java.util.stream.Collectors;
 
 import org.apache.commons.collections.CollectionUtils;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.data.domain.Sort;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.DeleteMapping;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -197,8 +196,8 @@ public class RolePrivilegeController extends ControllerSupport {
 	@ApiOperation(value = "查询权限组")
 	@GetMapping("getPrivilegeGroupList")
 	public List<PrivilegeGroupDomain> getPrivilegeGroupList() {
-		Sort sort = new Sort(Sort.Direction.ASC, "id");
-		List<PrivilegeGroupEntity> list = privilegeGroupRepo.findAll(sort);
+		
+		List<PrivilegeGroupEntity> list = privilegeGroupRepo.findAllByRootOrgIdIsNullOrderById();
 
 		List<PrivilegeGroupDomain> ret = Lists.newArrayList();
 

+ 4 - 0
examcloud-core-basic-dao/src/main/java/cn/com/qmth/examcloud/core/basic/dao/PrivilegeGroupRepo.java

@@ -1,5 +1,7 @@
 package cn.com.qmth.examcloud.core.basic.dao;
 
+import java.util.List;
+
 import org.springframework.data.jpa.repository.JpaRepository;
 import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
 import org.springframework.data.repository.query.QueryByExampleExecutor;
@@ -13,6 +15,8 @@ public interface PrivilegeGroupRepo
 			JpaSpecificationExecutor<PrivilegeGroupEntity> {
 
 	PrivilegeGroupEntity findByCode(String code);
+	
+	List<PrivilegeGroupEntity> findAllByRootOrgIdIsNullOrderById();
 
 }