|
|
@ -13,7 +13,19 @@ import java.util.List;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 考试管理 控制层
|
|
|
|
* 考试管理 控制层
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
@RestController
|
|
|
|
|
|
|
|
@RequiredArgsConstructor
|
|
|
|
|
|
|
|
public class ExamManageController {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private final ExamManageService examManageService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 查询所有考试
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* @return 考试列表
|
|
|
|
|
|
|
|
*/
|
|
|
|
@GetMapping("/exams")
|
|
|
|
@GetMapping("/exams")
|
|
|
|
public R<List<ExamManage>> findAll() {
|
|
|
|
public R<List<ExamManage>> findAll() {
|
|
|
|
return ApiResultHandler.buildApiResult(200, "请求成功!", examManageService.findAll());
|
|
|
|
return ApiResultHandler.buildApiResult(200, "请求成功!", examManageService.findAll());
|
|
|
@ -31,6 +43,20 @@ import java.util.List;
|
|
|
|
return ApiResultHandler.buildApiResult(200, "请求成功!", examManageService.findAll(new Page<>(page, size)));
|
|
|
|
return ApiResultHandler.buildApiResult(200, "请求成功!", examManageService.findAll(new Page<>(page, size)));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 根据考试编号查询考试信息
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* @param examCode 考试编号
|
|
|
|
|
|
|
|
* @return 考试信息
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
@GetMapping("/exam/{examCode}")
|
|
|
|
|
|
|
|
public R<ExamManage> findById(@PathVariable("examCode") Integer examCode) {
|
|
|
|
|
|
|
|
ExamManage res = examManageService.findById(examCode);
|
|
|
|
|
|
|
|
if (res == null) {
|
|
|
|
|
|
|
|
return ApiResultHandler.buildApiResult(10000, "考试编号不存在", null);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return ApiResultHandler.buildApiResult(200, "请求成功!", res);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 根据考试编号删除
|
|
|
|
* 根据考试编号删除
|
|
|
@ -47,17 +73,38 @@ import java.util.List;
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @param examManage 考试信息
|
|
|
|
* @param examManage 考试信息
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
@PutMapping("/exam")
|
|
|
|
|
|
|
|
public R update(@RequestBody ExamManage examManage) {
|
|
|
|
|
|
|
|
return ApiResultHandler.buildApiResult(200, "更新成功", examManageService.update(examManage));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 添加考试信息
|
|
|
|
* 添加考试信息
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @param examManage 考试信息
|
|
|
|
* @param examManage 考试信息
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
@PostMapping("/exam")
|
|
|
|
|
|
|
|
public R add(@RequestBody ExamManage examManage) {
|
|
|
|
|
|
|
|
int res = examManageService.add(examManage);
|
|
|
|
|
|
|
|
if (res == 1) {
|
|
|
|
|
|
|
|
return ApiResultHandler.buildApiResult(200, "添加成功", res);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
return ApiResultHandler.buildApiResult(400, "添加失败", res);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 查询最后一条记录的paperId,返回给前端达到自增效果
|
|
|
|
* 查询最后一条记录的paperId,返回给前端达到自增效果
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @return 最后一条记录
|
|
|
|
* @return 最后一条记录
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
@GetMapping("/examManagePaperId")
|
|
|
|
|
|
|
|
public R<ExamManage> findOnlyPaperId() {
|
|
|
|
|
|
|
|
ExamManage res = examManageService.findOnlyPaperId();
|
|
|
|
|
|
|
|
if (res != null) {
|
|
|
|
|
|
|
|
return ApiResultHandler.buildApiResult(200, "请求成功", res);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return ApiResultHandler.buildApiResult(400, "请求失败", res);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|