成绩管理

This commit is contained in:
alvis 2021-02-01 12:11:37 +08:00
parent e8159a17e1
commit 626ba788c7
7 changed files with 193 additions and 0 deletions

View File

@ -0,0 +1,54 @@
package com.mindskip.xzs.controller.admin;
import com.mindskip.xzs.base.BaseApiController;
import com.mindskip.xzs.base.RestResponse;
import com.mindskip.xzs.domain.ExamPaperAnswer;
import com.mindskip.xzs.domain.Subject;
import com.mindskip.xzs.domain.User;
import com.mindskip.xzs.service.*;
import com.mindskip.xzs.utility.DateTimeUtil;
import com.mindskip.xzs.utility.ExamUtil;
import com.mindskip.xzs.utility.PageInfoHelper;
import com.mindskip.xzs.viewmodel.student.exampaper.ExamPaperAnswerPageResponseVM;
import com.mindskip.xzs.viewmodel.admin.paper.ExamPaperAnswerPageRequestVM;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@RestController("AdminExamPaperAnswerController")
@RequestMapping(value = "/api/admin/examPaperAnswer")
public class ExamPaperAnswerController extends BaseApiController {
private final ExamPaperAnswerService examPaperAnswerService;
private final SubjectService subjectService;
private final UserService userService;
@Autowired
public ExamPaperAnswerController(ExamPaperAnswerService examPaperAnswerService, SubjectService subjectService, UserService userService) {
this.examPaperAnswerService = examPaperAnswerService;
this.subjectService = subjectService;
this.userService = userService;
}
@RequestMapping(value = "/page", method = RequestMethod.POST)
public RestResponse<PageInfo<ExamPaperAnswerPageResponseVM>> pageJudgeList(@RequestBody ExamPaperAnswerPageRequestVM model) {
PageInfo<ExamPaperAnswer> pageInfo = examPaperAnswerService.adminPage(model);
PageInfo<ExamPaperAnswerPageResponseVM> page = PageInfoHelper.copyMap(pageInfo, e -> {
ExamPaperAnswerPageResponseVM vm = modelMapper.map(e, ExamPaperAnswerPageResponseVM.class);
Subject subject = subjectService.selectById(vm.getSubjectId());
vm.setDoTime(ExamUtil.secondToVM(e.getDoTime()));
vm.setSystemScore(ExamUtil.scoreToVM(e.getSystemScore()));
vm.setUserScore(ExamUtil.scoreToVM(e.getUserScore()));
vm.setPaperScore(ExamUtil.scoreToVM(e.getPaperScore()));
vm.setSubjectName(subject.getName());
vm.setCreateTime(DateTimeUtil.dateFormat(e.getCreateTime()));
User user = userService.selectById(e.getCreateUser());
vm.setUserName(user.getUserName());
return vm;
});
return RestResponse.ok(page);
}
}

View File

@ -31,4 +31,5 @@ public interface ExamPaperAnswerMapper extends BaseMapper<ExamPaperAnswer> {
ExamPaperAnswer getByPidUid(@Param("pid") Integer paperId, @Param("uid") Integer uid);
List<ExamPaperAnswer> adminPage(com.mindskip.xzs.viewmodel.admin.paper.ExamPaperAnswerPageRequestVM requestVM);
}

View File

@ -48,4 +48,6 @@ public interface ExamPaperAnswerService extends BaseService<ExamPaperAnswer> {
Integer selectAllCount();
List<Integer> selectMothCount();
PageInfo<ExamPaperAnswer> adminPage(com.mindskip.xzs.viewmodel.admin.paper.ExamPaperAnswerPageRequestVM requestVM);
}

View File

@ -268,4 +268,11 @@ public class ExamPaperAnswerServiceImpl extends BaseServiceImpl<ExamPaperAnswer>
}
return examPaperAnswer;
}
@Override
public PageInfo<ExamPaperAnswer> adminPage(com.mindskip.xzs.viewmodel.admin.paper.ExamPaperAnswerPageRequestVM requestVM) {
return PageHelper.startPage(requestVM.getPageIndex(), requestVM.getPageSize(), "id desc").doSelectPageInfo(() ->
examPaperAnswerMapper.adminPage(requestVM));
}
}

View File

@ -0,0 +1,94 @@
package com.mindskip.xzs.viewmodel.admin.paper;
public class ExamAnswerResponseVM {
private Integer id;
private String name;
private Integer questionCount;
private Integer score;
private String createTime;
private Integer createUser;
private Integer subjectId;
private Integer paperType;
private Integer frameTextContentId;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Integer getQuestionCount() {
return questionCount;
}
public void setQuestionCount(Integer questionCount) {
this.questionCount = questionCount;
}
public Integer getScore() {
return score;
}
public void setScore(Integer score) {
this.score = score;
}
public String getCreateTime() {
return createTime;
}
public void setCreateTime(String createTime) {
this.createTime = createTime;
}
public Integer getCreateUser() {
return createUser;
}
public void setCreateUser(Integer createUser) {
this.createUser = createUser;
}
public Integer getSubjectId() {
return subjectId;
}
public void setSubjectId(Integer subjectId) {
this.subjectId = subjectId;
}
public Integer getPaperType() {
return paperType;
}
public void setPaperType(Integer paperType) {
this.paperType = paperType;
}
public Integer getFrameTextContentId() {
return frameTextContentId;
}
public void setFrameTextContentId(Integer frameTextContentId) {
this.frameTextContentId = frameTextContentId;
}
}

View File

@ -0,0 +1,24 @@
package com.mindskip.xzs.viewmodel.admin.paper;
import com.mindskip.xzs.base.BasePage;
public class ExamPaperAnswerPageRequestVM extends BasePage {
private Integer subjectId;
private Integer status;
public Integer getSubjectId() {
return subjectId;
}
public void setSubjectId(Integer subjectId) {
this.subjectId = subjectId;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
}

View File

@ -28,6 +28,8 @@ public class ExamPaperAnswerPageResponseVM {
private String paperName;
private String userName;
public Integer getId() {
return id;
}
@ -131,4 +133,13 @@ public class ExamPaperAnswerPageResponseVM {
public void setPaperName(String paperName) {
this.paperName = paperName;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
}