宋悦 8 лет назад
Родитель
Сommit
920c0ad85e

+ 7 - 1
core-api/src/main/java/cn/com/qmth/examcloud/service/core/api/OrgApi.java

@@ -96,7 +96,13 @@ public class OrgApi {
 
     @ApiOperation(value = "查询下属机构不带分页", notes = "不分页")
     @GetMapping("/sub/{parentId}")
-    public ResponseEntity getOrgByParentId(@PathVariable Long parentId) {
+    public ResponseEntity getOrgByParentId(@PathVariable Long parentId,HttpServletRequest request) {
+        AccessUser accessUser = (AccessUser) request.getAttribute("accessUser");
+        if(accessUser != null){
+            if(accessUser.getRootOrgId().longValue() != accessUser.getOrgId().longValue()){
+                return new ResponseEntity(orgRepo.findById(parentId), HttpStatus.OK);
+            }
+        }
         return new ResponseEntity(orgRepo.findByParentId(parentId), HttpStatus.OK);
     }
 

+ 5 - 2
core-api/src/main/java/cn/com/qmth/examcloud/service/core/service/ExamSiteService.java

@@ -12,6 +12,7 @@ import java.util.Date;
 import java.util.List;
 
 import static org.springframework.data.domain.ExampleMatcher.GenericPropertyMatchers.contains;
+import static org.springframework.data.domain.ExampleMatcher.GenericPropertyMatchers.exact;
 
 @Service
 public class ExamSiteService {
@@ -23,7 +24,8 @@ public class ExamSiteService {
 	public Page<ExamSite> findAll(ExamSite examSiteCriteria, Pageable pageable) {
 		ExampleMatcher exampleMatcher = ExampleMatcher.matching()
 				.withMatcher("name", contains())
-				.withMatcher("code", contains());
+				.withMatcher("code", contains())
+                .withMatcher("orgId",exact());
 		Example<ExamSite> examSiteExample = Example.of(examSiteCriteria,
 				exampleMatcher);
 		return examSiteRepo.findAll(examSiteExample, pageable);
@@ -32,7 +34,8 @@ public class ExamSiteService {
 	public List<ExamSite> findAll(ExamSite examSiteCriteria) {
 		ExampleMatcher exampleMatcher = ExampleMatcher.matching()
 				.withMatcher("name", contains())
-				.withMatcher("code", contains());
+				.withMatcher("code", contains())
+                .withMatcher("orgId",exact());
 		Example<ExamSite> examSiteExample = Example.of(examSiteCriteria,
 				exampleMatcher);
 		return examSiteRepo.findAll(examSiteExample);

+ 11 - 0
core-domain/src/main/java/cn/com/qmth/examcloud/service/core/entity/ExamSite.java

@@ -48,6 +48,9 @@ public class ExamSite implements Serializable {
     @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     private Date updateTime;
 
+
+    private String remark;
+
     public Long getId() {
         return id;
     }
@@ -120,6 +123,14 @@ public class ExamSite implements Serializable {
         this.updateTime = updateTime;
     }
 
+    public String getRemark() {
+        return remark;
+    }
+
+    public void setRemark(String remark) {
+        this.remark = remark;
+    }
+
     public ExamSite() {
     }
 }

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

@@ -15,6 +15,8 @@ public interface OrgRepo extends JpaRepository<Org,Long>,QueryByExampleExecutor<
 
     List<Org> findByRootId(long rootId);
 
+    List<Org> findById(long id);
+
     @Query(nativeQuery = true,value = "select *from ecs_core_org where parent_id=:parentId and enable = 1")
     List<Org> findByParentId(@Param("parentId") long parentId);