派生自 projectDept/qhighschool

yn147
2023-05-10 33d82860d93624e1865242be6aa752668a0c3c8d
src/main/java/com/qxueyou/scc/admin/score/action/ScoreController.java
@@ -30,13 +30,13 @@
import java.util.List;
import java.util.Map;
@Api(tags = "成绩管理接口")
@Api(tags = "成绩管理接口")
@Controller
@CrossOrigin(origins="*",maxAge=3600)
@RequestMapping(value = "admin/score")
public class ScoreController {
    // 分页查询中,默认记录条数和页数
    // 分页查询中,默认记录条数和页数
    private static final int DEFAULT_PAGE_SIZE = 10;
    private static final int DEFAULT_PAGE_NUM = 1;
@@ -56,21 +56,21 @@
        pageNum = pageNum != null && pageNum > 0 ? pageNum : DEFAULT_PAGE_NUM;
        Pager pager = new Pager(pageSize,pageNum);
        if(classId == null){
            classId = "%";
            classId = "";
        }else {
            classId += "%";
        }
        List<Map<String,Object>> mapList = new ArrayList<>();
        List<ExamResultV> examResultVS =  scoreService.allExamResultV(classId);
        List<ExerciseResultV> exerciseResultVS = scoreService.allExerciseResultV(classId);
        //总成绩数量
        //总成绩数量
        int totalCount = scoreService.findCount("from ExamResultV where class_Id Like ? and score != null and score != 0",CollectionUtils.newList(classId));
        if (examResultVS.size() < exerciseResultVS.size()){
            totalCount = exerciseResultVS.size();
        }
        int totalPage = totalCount % pageSize > 0 ? totalCount/pageSize + 1 : totalCount/pageSize;
        int currentPage = pageNum < totalPage? pageNum : totalPage;
        int pageStart = (currentPage-1) * pageSize;
        int pageStart = (currentPage-1) * pageSize < 0 ? 0 :  (currentPage-1) * pageSize;
        int pageEnd = pageSize * currentPage > totalCount ? totalCount : pageSize * currentPage;
        pager.setTotalCount(totalCount);