|
@@ -7,10 +7,12 @@ import java.util.Date;
|
|
|
import java.util.List;
|
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.data.domain.PageRequest;
|
|
|
import org.springframework.http.HttpStatus;
|
|
|
import org.springframework.http.ResponseEntity;
|
|
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
+import org.springframework.web.bind.annotation.ModelAttribute;
|
|
|
import org.springframework.web.bind.annotation.PathVariable;
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
import org.springframework.web.bind.annotation.PutMapping;
|
|
@@ -39,29 +41,35 @@ public class OrgApi {
|
|
|
@Autowired
|
|
|
OrgService orgService;
|
|
|
|
|
|
-// @ApiOperation(value="查询所有机构")
|
|
|
-// @GetMapping
|
|
|
-// public ResponseEntity getAllOrg(){
|
|
|
-// return new ResponseEntity(orgRepo.findAll(), HttpStatus.OK);
|
|
|
-// }
|
|
|
+ @ApiOperation(value="查询机构分页带查询",notes="分页带查询")
|
|
|
+ @GetMapping("/all/{curPage}/{pageSize}")
|
|
|
+ public ResponseEntity getAllOrg(@ModelAttribute Org orgCriteria, @PathVariable Integer curPage,@PathVariable Integer pageSize){
|
|
|
+ return new ResponseEntity(orgService.findAlL(orgCriteria,new PageRequest(curPage - 1,pageSize)), HttpStatus.OK);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value="查询机构不分页带查询",notes = "不分页带查询")
|
|
|
+ @GetMapping("/all")
|
|
|
+ public ResponseEntity getAllExam(@ModelAttribute Org orgCriteria){
|
|
|
+ return new ResponseEntity(orgService.findAlL(orgCriteria), HttpStatus.OK);
|
|
|
+ }
|
|
|
|
|
|
@ApiOperation(value="按ID查询机构",notes="ID查询")
|
|
|
@GetMapping("/{id}")
|
|
|
public ResponseEntity<Org> getOrgById(@PathVariable Long id){
|
|
|
- return new ResponseEntity(orgRepo.findById(id),HttpStatus.OK);
|
|
|
- }
|
|
|
-
|
|
|
- @ApiOperation(value="按parentId查询下属机构",notes="下属机构查询")
|
|
|
- @GetMapping("/sub/{parentId}")
|
|
|
- public ResponseEntity<Org> getOrgByParentId(@PathVariable Long parentId){
|
|
|
- return new ResponseEntity(orgRepo.findByParentId(parentId),HttpStatus.OK);
|
|
|
+ return new ResponseEntity(orgRepo.findOne(id),HttpStatus.OK);
|
|
|
}
|
|
|
|
|
|
- @ApiOperation(value="按rootId查询下属机构",notes="下属机构查询")
|
|
|
- @GetMapping("/allSub/{rootId}")
|
|
|
- public ResponseEntity<Org> getOrgByRootId(@PathVariable Long rootId){
|
|
|
- return new ResponseEntity(orgRepo.findByRootId(rootId),HttpStatus.OK);
|
|
|
- }
|
|
|
+// @ApiOperation(value="按parentId查询下属机构不带分页",notes="下属机构查询不带分页")
|
|
|
+// @GetMapping("/sub/{parentId}")
|
|
|
+// public ResponseEntity<Org> getOrgByParentId(@PathVariable Long parentId){
|
|
|
+// return new ResponseEntity(orgRepo.findByParentId(parentId),HttpStatus.OK);
|
|
|
+// }
|
|
|
+//
|
|
|
+// @ApiOperation(value="按rootId查询下属机构不带分页",notes="下属机构查询不带分页")
|
|
|
+// @GetMapping("/allSub/{rootId}")
|
|
|
+// public ResponseEntity<Org> getOrgByRootId(@PathVariable Long rootId){
|
|
|
+// return new ResponseEntity(orgRepo.findByRootId(rootId),HttpStatus.OK);
|
|
|
+// }
|
|
|
|
|
|
@ApiOperation(value="新增机构",notes="新增")
|
|
|
@PostMapping
|
|
@@ -100,4 +108,10 @@ public class OrgApi {
|
|
|
public ResponseEntity enableSchool(@PathVariable Long id,@RequestParam boolean enable){
|
|
|
return new ResponseEntity(orgService.enableSchool(id,enable),HttpStatus.OK);
|
|
|
}
|
|
|
+
|
|
|
+ @ApiOperation(value="按code查询机构(学习中心)",notes="code查询")
|
|
|
+ @GetMapping()
|
|
|
+ public ResponseEntity getCourseByCode(@RequestParam Long parentId,@RequestParam String code){
|
|
|
+ return new ResponseEntity(orgRepo.findByParentIdAndCode(parentId, code),HttpStatus.OK);
|
|
|
+ }
|
|
|
}
|