Commit 21f367c4 authored by Ryan Loong's avatar Ryan Loong

update 临时恢复随机点名逻辑

parent 1ace4532
...@@ -109,6 +109,18 @@ public class StudentInfoService { ...@@ -109,6 +109,18 @@ public class StudentInfoService {
.build()); .build());
} }
@Transactional(rollbackFor = Exception.class)
public StudentVo randomSelectStudentInfo(Integer classId, Integer maxCall) {
StudentVo record = beanSearcher.searchFirst(StudentVo.class, MapUtils.builder()
.field(StudentVo::getDeleted, StudentInfo.NOT_DELETED).op(Equal.class)
.field(StudentVo::getClassId, classId).op(Equal.class)
.field(StudentVo::getCallTimes, maxCall).op(LessThan.class)
.build());
increaseCallTime(record);
return record;
}
/** /**
* 更新数据 * 更新数据
* @param studentInfo * @param studentInfo
......
...@@ -38,12 +38,17 @@ public class StudentController { ...@@ -38,12 +38,17 @@ public class StudentController {
return ResponseUtil.ok(studentInfoService.selectStudentInfoByWeb(studentName, studentUniqueId, null, classId, page, limit, sort, order, minCall, maxCall)); return ResponseUtil.ok(studentInfoService.selectStudentInfoByWeb(studentName, studentUniqueId, null, classId, page, limit, sort, order, minCall, maxCall));
} }
@GetMapping("randomSelect")
public Object randomSelect(@RequestParam Integer classId, @Nullable @RequestParam Integer maxCall) {
return ResponseUtil.ok(studentInfoService.selectStudentInfo(classId, maxCall));
}
@GetMapping("pointList") @GetMapping("pointList")
public Object pointList(@RequestParam Integer classId, @Nullable @RequestParam Integer maxCall) { public Object pointList(@RequestParam Integer classId, @Nullable @RequestParam Integer maxCall) {
if (Objects.nonNull(maxCall) && maxCall <= 0) { if (Objects.nonNull(maxCall) && maxCall <= 0) {
return ResponseUtil.badArgumentValue(); return ResponseUtil.badArgumentValue();
} }
return ResponseUtil.ok(studentInfoService.selectStudentInfo(classId, maxCall)); return ResponseUtil.ok(studentInfoService.randomSelectStudentInfo(classId, maxCall));
} }
@PostMapping("add") @PostMapping("add")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment