wangwei 7 лет назад
Родитель
Сommit
7c4beb6483

+ 45 - 47
examcloud-core-examwork-api-provider/src/main/java/cn/com/qmth/examcloud/core/examwork/api/controller/ExamOrgTimeController.java

@@ -15,61 +15,59 @@ import org.springframework.web.bind.annotation.*;
 import java.util.List;
 
 /**
- * 考试服务API
- * Created by songyue on 17/1/13.
+ * 考试服务API Created by songyue on 17/1/13.
  */
 @RestController
-@RequestMapping("${$rmp.ctr.examwork}")
+@RequestMapping("${$rmp.ctr.examwork}/examOrgTime")
 public class ExamOrgTimeController {
 
-    @Autowired
-    ExamOrgTimeRepo examOrgTimeRepo;
+	@Autowired
+	ExamOrgTimeRepo examOrgTimeRepo;
 
-    @Autowired
-    ExamOrgTimeService examOrgTimeService;
+	@Autowired
+	ExamOrgTimeService examOrgTimeService;
 
-    @ApiOperation(value="查询学习中心考试时间",notes = "分页")
-    @GetMapping("/examOrgTime/{curPage}/{pageSize}")
-    public ResponseEntity findByExamId(@ModelAttribute ExamOrgTime examOrgTime,
-                                       @PathVariable Integer curPage,
-                                       @PathVariable Integer pageSize){
-        PageRequest pageRequest = new PageRequest(curPage,pageSize);
-        Page<ExamOrgTime> orgTimePage = examOrgTimeService.getAllOrgTime(examOrgTime,pageRequest);
-    	return new ResponseEntity(orgTimePage, HttpStatus.OK);
-    }
+	@ApiOperation(value = "查询学习中心考试时间", notes = "分页")
+	@GetMapping("{curPage}/{pageSize}")
+	public ResponseEntity findByExamId(@ModelAttribute ExamOrgTime examOrgTime,
+			@PathVariable Integer curPage, @PathVariable Integer pageSize) {
+		PageRequest pageRequest = new PageRequest(curPage, pageSize);
+		Page<ExamOrgTime> orgTimePage = examOrgTimeService.getAllOrgTime(examOrgTime, pageRequest);
+		return new ResponseEntity(orgTimePage, HttpStatus.OK);
+	}
 
-    @ApiOperation(value="查询学习中心考试时间",notes = "不分页")
-    @GetMapping("/examOrgTime/{examId}")
-    public ResponseEntity findByExamId(@PathVariable Long examId){
-        List<ExamOrgTime> orgTimePage = examOrgTimeRepo.findByExamId(examId);
-        return new ResponseEntity(orgTimePage, HttpStatus.OK);
-    }
+	@ApiOperation(value = "查询学习中心考试时间", notes = "不分页")
+	@GetMapping("{examId}")
+	public ResponseEntity findByExamId(@PathVariable Long examId) {
+		List<ExamOrgTime> orgTimePage = examOrgTimeRepo.findByExamId(examId);
+		return new ResponseEntity(orgTimePage, HttpStatus.OK);
+	}
 
-    @ApiOperation(value="按ID查询学习中心考试时间",notes = "ID查询")
-    @GetMapping("/examOrgTime/{id}")
-    public ResponseEntity findById(@PathVariable Long id){
-        return new ResponseEntity(examOrgTimeRepo.findOne(id),HttpStatus.OK);
-    }
+	@ApiOperation(value = "按ID查询学习中心考试时间", notes = "ID查询")
+	@GetMapping("{id}")
+	public ResponseEntity findById(@PathVariable Long id) {
+		return new ResponseEntity(examOrgTimeRepo.findOne(id), HttpStatus.OK);
+	}
 
-    @ApiOperation(value="新增学习中心考试时间",notes = "新增")
-    @PostMapping("/examOrgTime")
-    public ResponseEntity add(@RequestBody ExamOrgTime examOrgTime){
-        try{
-            return new ResponseEntity(examOrgTimeRepo.save(examOrgTime),HttpStatus.OK);
-        }catch (Exception e){
-            return new ResponseEntity(new ErrorMsg(e.getMessage()),
-                    HttpStatus.INTERNAL_SERVER_ERROR);
-        }
-    }
+	@ApiOperation(value = "新增学习中心考试时间", notes = "新增")
+	@PostMapping()
+	public ResponseEntity add(@RequestBody ExamOrgTime examOrgTime) {
+		try {
+			return new ResponseEntity(examOrgTimeRepo.save(examOrgTime), HttpStatus.OK);
+		} catch (Exception e) {
+			return new ResponseEntity(new ErrorMsg(e.getMessage()),
+					HttpStatus.INTERNAL_SERVER_ERROR);
+		}
+	}
 
-    @ApiOperation(value="更新学习中心考试时间",notes = "更新")
-    @PutMapping("/examOrgTime")
-    public ResponseEntity update(@RequestBody ExamOrgTime examOrgTime){
-        try{
-            return new ResponseEntity(examOrgTimeRepo.save(examOrgTime),HttpStatus.OK);
-        }catch (Exception e){
-            return new ResponseEntity(new ErrorMsg(e.getMessage()),
-                    HttpStatus.INTERNAL_SERVER_ERROR);
-        }
-    }
+	@ApiOperation(value = "更新学习中心考试时间", notes = "更新")
+	@PutMapping()
+	public ResponseEntity update(@RequestBody ExamOrgTime examOrgTime) {
+		try {
+			return new ResponseEntity(examOrgTimeRepo.save(examOrgTime), HttpStatus.OK);
+		} catch (Exception e) {
+			return new ResponseEntity(new ErrorMsg(e.getMessage()),
+					HttpStatus.INTERNAL_SERVER_ERROR);
+		}
+	}
 }