Commit 538214f1 authored by Ryan Loong's avatar Ryan Loong

update 优化学生点名逻辑

parent ffdc5ffa
......@@ -14,10 +14,7 @@ import cn.exploring.engine.server.db.util.excel.ExcelReaderListener;
import cn.exploring.engine.server.db.util.excel.StudentInfoExcelReaderListener;
import cn.zhxu.bs.BeanSearcher;
import cn.zhxu.bs.SearchResult;
import cn.zhxu.bs.operator.Between;
import cn.zhxu.bs.operator.Contain;
import cn.zhxu.bs.operator.Equal;
import cn.zhxu.bs.operator.InList;
import cn.zhxu.bs.operator.*;
import cn.zhxu.bs.util.MapBuilder;
import cn.zhxu.bs.util.MapUtils;
import com.alibaba.excel.EasyExcel;
......@@ -102,8 +99,13 @@ public class StudentInfoService {
* @param classId
* @return
*/
public Map selectStudentInfo(Integer classId) {
return specialSqlMapper.selectRandomStudentInfo(classId);
public StudentVo selectStudentInfo(Integer classId, Integer maxCall) {
return 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)
.orderBy("random()")
.build());
}
/**
......
......@@ -39,8 +39,8 @@ public class StudentController {
}
@GetMapping("randomSelect")
public Object randomSelect(@RequestParam Integer classId) {
return ResponseUtil.ok(studentInfoService.selectStudentInfo(classId));
public Object randomSelect(@RequestParam Integer classId, @RequestParam Integer maxCall) {
return ResponseUtil.ok(studentInfoService.selectStudentInfo(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