|
@@ -9,6 +9,8 @@ import org.springframework.data.domain.PageRequest;
|
|
import org.springframework.http.ResponseEntity;
|
|
import org.springframework.http.ResponseEntity;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
+import java.util.Date;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 考试服务API
|
|
* 考试服务API
|
|
* Created by songyue on 17/1/13.
|
|
* Created by songyue on 17/1/13.
|
|
@@ -23,38 +25,45 @@ public class ExamApi {
|
|
@Autowired
|
|
@Autowired
|
|
ExamService examService;
|
|
ExamService examService;
|
|
|
|
|
|
- @ApiOperation(value="查询所有考试批次",notes = "分页")
|
|
|
|
|
|
+ @ApiOperation(value="查询所有考试批次",notes = "分页带查询")
|
|
@GetMapping("/exam/all/{curPage}/{pageSize}")
|
|
@GetMapping("/exam/all/{curPage}/{pageSize}")
|
|
public ResponseEntity getAllExam(@ModelAttribute Exam examCriteria, @PathVariable Integer curPage,@PathVariable Integer pageSize){
|
|
public ResponseEntity getAllExam(@ModelAttribute Exam examCriteria, @PathVariable Integer curPage,@PathVariable Integer pageSize){
|
|
return examService.getAllExam(examCriteria,new PageRequest(curPage - 1,pageSize));
|
|
return examService.getAllExam(examCriteria,new PageRequest(curPage - 1,pageSize));
|
|
}
|
|
}
|
|
|
|
|
|
- @ApiOperation(value="查询所有考试批次",notes = "不分页")
|
|
|
|
|
|
+ @ApiOperation(value="查询所有考试批次",notes = "不分页带查询")
|
|
@GetMapping("/exam/all")
|
|
@GetMapping("/exam/all")
|
|
public ResponseEntity getAllExam(@ModelAttribute Exam examCriteria){
|
|
public ResponseEntity getAllExam(@ModelAttribute Exam examCriteria){
|
|
return examService.getAllExam(examCriteria);
|
|
return examService.getAllExam(examCriteria);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @ApiOperation(value="查询所有考试批次",notes = "不分页不带查询")
|
|
|
|
+ @GetMapping("/exam")
|
|
|
|
+ public ResponseEntity getAllExam(){
|
|
|
|
+ return examService.getAllExam();
|
|
|
|
+ }
|
|
|
|
+
|
|
@ApiOperation(value="按ID查询考试批次",notes = "ID查询")
|
|
@ApiOperation(value="按ID查询考试批次",notes = "ID查询")
|
|
- @GetMapping("/exam/{examId}")
|
|
|
|
|
|
+ @GetMapping("/exam/{id}")
|
|
public ResponseEntity<Exam> getExamById(@PathVariable Long id){
|
|
public ResponseEntity<Exam> getExamById(@PathVariable Long id){
|
|
return examService.getExamById(id);
|
|
return examService.getExamById(id);
|
|
}
|
|
}
|
|
|
|
|
|
@ApiOperation(value="新增考试批次",notes = "新增")
|
|
@ApiOperation(value="新增考试批次",notes = "新增")
|
|
@PostMapping("/exam")
|
|
@PostMapping("/exam")
|
|
- public ResponseEntity addExam(@ModelAttribute Exam exam){
|
|
|
|
|
|
+ public ResponseEntity addExam(@RequestBody Exam exam){
|
|
|
|
+ exam.setCreateTime(new Date());
|
|
return examService.saveExam(exam);
|
|
return examService.saveExam(exam);
|
|
}
|
|
}
|
|
|
|
|
|
@ApiOperation(value="更新考试批次",notes = "更新")
|
|
@ApiOperation(value="更新考试批次",notes = "更新")
|
|
@PutMapping("/exam")
|
|
@PutMapping("/exam")
|
|
- public ResponseEntity updateExam(@ModelAttribute Exam exam){
|
|
|
|
|
|
+ public ResponseEntity updateExam(@RequestBody Exam exam){
|
|
return examService.saveExam(exam);
|
|
return examService.saveExam(exam);
|
|
}
|
|
}
|
|
|
|
|
|
@ApiOperation(value="按ID删除考试批次",notes = "删除")
|
|
@ApiOperation(value="按ID删除考试批次",notes = "删除")
|
|
- @DeleteMapping("/exam/{examId}")
|
|
|
|
|
|
+ @DeleteMapping("/exam/{id}")
|
|
public ResponseEntity deleteExam(@PathVariable Long id){
|
|
public ResponseEntity deleteExam(@PathVariable Long id){
|
|
return examService.deleteExam(id);
|
|
return examService.deleteExam(id);
|
|
}
|
|
}
|