目錄
1.StudentController.java
2.interface StudentService
3.StudentServiceImpl.java
4.interface StudentMapper
1.StudentController.java
// 違紀處理@PutMapping("/violation/{id}/{score}")@Operation(summary = "違紀處理")public Result violationHandle(@PathVariable Integer id, @PathVariable Integer score){log.info("違紀處理:{},{}",id,score);studentService.violation(id,score);return Result.success();}
2.interface StudentService
// 違紀處理void violation(Integer id, Integer score);
3.StudentServiceImpl.java
// 違紀處理@Overridepublic void violation(Integer id, Integer score) {studentMapper.violation(id,score);}
4.interface StudentMapper
// 違紀處理
@Update("update student set violation_count = violation_count + 1 , violation_score = violation_score + #{score} , update_time = now() where id = #{id}")
void violation(Integer id, Integer score);