|
@@ -41,31 +41,36 @@ public class StudentInfoController {
|
|
|
|
|
|
|
|
@PostMapping("/add")
|
|
@PostMapping("/add")
|
|
|
@ApiOperation("新增学生信息")
|
|
@ApiOperation("新增学生信息")
|
|
|
- public Boolean add(@RequestBody StudentInfoAddBo studentInfo) throws CustomException {
|
|
|
|
|
- return studentInfoService.add(studentInfo);
|
|
|
|
|
|
|
+ public R add(@RequestBody StudentInfoAddBo studentInfo) throws CustomException {
|
|
|
|
|
+ studentInfoService.add(studentInfo);
|
|
|
|
|
+ return R.success(SuccessResultCode.SUCCESS.getCode(), SuccessResultCode.SUCCESS.getMsg());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@DeleteMapping("/delete/{id}")
|
|
@DeleteMapping("/delete/{id}")
|
|
|
@ApiOperation("删除学生信息")
|
|
@ApiOperation("删除学生信息")
|
|
|
- public Boolean delete(@PathVariable Long id) throws CustomException {
|
|
|
|
|
- return studentInfoService.delete(id);
|
|
|
|
|
|
|
+ public R delete(@PathVariable Long id) throws CustomException {
|
|
|
|
|
+ studentInfoService.delete(id);
|
|
|
|
|
+ return R.fail(SuccessResultCode.SUCCESS.getCode(), SuccessResultCode.SUCCESS.getMsg());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@PutMapping("/edit")
|
|
@PutMapping("/edit")
|
|
|
@ApiOperation("修改学生信息")
|
|
@ApiOperation("修改学生信息")
|
|
|
- public Boolean edit(@RequestBody StudentInfoUpdateBo studentInfo) throws CustomException {
|
|
|
|
|
- return studentInfoService.edit(studentInfo);
|
|
|
|
|
|
|
+ public R edit(@RequestBody StudentInfoUpdateBo studentInfo) throws CustomException {
|
|
|
|
|
+ studentInfoService.edit(studentInfo);
|
|
|
|
|
+ return R.fail(SuccessResultCode.SUCCESS.getCode(), SuccessResultCode.SUCCESS.getMsg());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@GetMapping("/{id}")
|
|
@GetMapping("/{id}")
|
|
|
@ApiOperation("查询学生详情")
|
|
@ApiOperation("查询学生详情")
|
|
|
- public StudentInfoVo detail(@PathVariable Long id) throws CustomException {
|
|
|
|
|
- return studentInfoService.detail(id);
|
|
|
|
|
|
|
+ public R detail(@PathVariable Long id) throws CustomException {
|
|
|
|
|
+ StudentInfoVo studentInfoVo = studentInfoService.detail(id);
|
|
|
|
|
+ return R.success(SuccessResultCode.SUCCESS.getCode(), SuccessResultCode.SUCCESS.getMsg(), studentInfoVo);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@DeleteMapping("/batchDelete")
|
|
@DeleteMapping("/batchDelete")
|
|
|
@ApiOperation("批量删除学生信息")
|
|
@ApiOperation("批量删除学生信息")
|
|
|
- public Boolean batchDelete(@RequestBody List<Long> ids) throws CustomException {
|
|
|
|
|
- return studentInfoService.batchDelete(ids);
|
|
|
|
|
|
|
+ public R batchDelete(@RequestBody List<Long> ids) throws CustomException {
|
|
|
|
|
+ studentInfoService.batchDelete(ids);
|
|
|
|
|
+ return R.success(SuccessResultCode.SUCCESS.getCode(), "批量删除成功");
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|