派生自 projectDept/qhighschool

Administrator
2022-11-03 bf7fef028c847b6e63199a7f20991bff2de50765
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package com.qxueyou.scc.admin.score.action;
 
import com.qxueyou.scc.admin.score.model.Score;
import com.qxueyou.scc.admin.score.service.impl.ScoreService;
import com.qxueyou.scc.base.model.Pager;
import com.qxueyou.scc.base.model.Result;
import com.qxueyou.scc.base.util.CollectionUtils;
import com.qxueyou.scc.base.util.QBeanUtils;
import com.qxueyou.scc.exam.model.ExamBatchInfo;
import com.qxueyou.scc.exam.model.ExamInfo;
import com.qxueyou.scc.exam.model.ExamReExamPaper;
import com.qxueyou.scc.exam.model.ExamResultV;
import com.qxueyou.scc.exercise.model.ExerciseRecord;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
 
import java.util.HashMap;
import java.util.List;
import java.util.Map;
 
@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 = 2;
 
    @Autowired
    ScoreService scoreService;
 
    @RequestMapping(value = "lstScore", method = RequestMethod.GET)
    public @ResponseBody
    Result list(String classId,Integer pageSize, Integer pageNum) {
        pageSize = pageSize != null && pageSize > 0 ? pageSize : DEFAULT_PAGE_SIZE;
        pageNum = pageNum != null && pageNum > 0 ? pageNum : DEFAULT_PAGE_NUM;
        Pager pager = new Pager(pageSize,pageNum);
        if(classId == null){
            classId = "%";
        }else {
            classId += "%";
        }
        //×ܳɼ¨ÊýÁ¿
        int totalCount = scoreService.findCount("from ExamResultV where class_Id Like ?",CollectionUtils.newList(classId));
        pager.setTotalCount(totalCount);
        List<ExamResultV> list =  scoreService.allExamResultV(classId,pager);
        return new Result(true,"success",CollectionUtils.newObjectMap("data", list, "scoreCount", totalCount));
    }
}