New file |
| | |
| | | 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)); |
| | | } |
| | | } |