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

update 临时恢复随机点名逻辑

parent 1ace4532
......@@ -109,6 +109,18 @@ public class StudentInfoService {
.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
......
......@@ -38,12 +38,17 @@ public class StudentController {
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")
public Object pointList(@RequestParam Integer classId, @Nullable @RequestParam Integer maxCall) {
if (Objects.nonNull(maxCall) && maxCall <= 0) {
return ResponseUtil.badArgumentValue();
}
return ResponseUtil.ok(studentInfoService.selectStudentInfo(classId, maxCall));
return ResponseUtil.ok(studentInfoService.randomSelectStudentInfo(classId, maxCall));
}
@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