Explorar el Código

增加查询学校结构

chenken hace 7 años
padre
commit
21d672f87b

+ 6 - 0
core-api/src/main/java/cn/com/qmth/examcloud/service/core/api/OrgApi.java

@@ -241,4 +241,10 @@ public class OrgApi {
         }
 
     }
+    
+    @ApiOperation(value = "查询所有学校", notes = "查询所有学校")
+    @GetMapping("/getAllParentOrg")
+    public ResponseEntity getAllParentOrg(){
+    	return new ResponseEntity(orgRepo.findAllParentOrg(), HttpStatus.OK);
+    }
 }

+ 3 - 0
core-domain/src/main/java/cn/com/qmth/examcloud/service/core/repo/OrgRepo.java

@@ -28,4 +28,7 @@ public interface OrgRepo extends JpaRepository<Org,Long>,QueryByExampleExecutor<
 
     @Query(nativeQuery = true,value = "select *from ecs_core_org where parent_id=:parentId and code=:code and enable = 1")
 	Org findFirstByParentIdAndCode(@Param("parentId") Long parentId, @Param("code")String code);
+    
+    @Query(nativeQuery = true,value = "select * from ecs_core_org t where t.parent_id = 0 and t.enable = 1 order by t.id")
+    List<Org> findAllParentOrg();
 }