Răsfoiți Sursa

修改学生端相关接口规则按照框架改造,包括答题查卷查分等

zhaosongshan 7 luni în urmă
părinte
comite
1815f45a50
21 a modificat fișierele cu 174 adăugiri și 79 ștergeri
  1. 5 4
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/controller/student/EducationController.java
  2. 20 20
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/controller/student/ExamPaperAnswerController.java
  3. 7 11
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/controller/student/ExamPaperController.java
  4. 18 16
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/controller/student/QuestionAnswerController.java
  5. 3 2
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/domain/ExamPaperAnswer.java
  6. 30 0
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/domain/ExamPaperQuestionCustomerAnswer.java
  7. 1 1
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/mapper/ExamPaperAnswerMapper.java
  8. 1 1
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/mapper/ExamPaperMapper.java
  9. 2 1
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/mapper/ExamPaperQuestionCustomerAnswerMapper.java
  10. 4 3
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/mapper/mapping/ExamPaperAnswerMapper.xml
  11. 5 5
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/mapper/mapping/ExamPaperMapper.xml
  12. 2 1
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/mapper/mapping/ExamPaperQuestionCustomerAnswerMapper.xml
  13. 1 1
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/service/ExamPaperAnswerService.java
  14. 2 2
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/service/ExamPaperQuestionCustomerAnswerService.java
  15. 1 1
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/service/ExamPaperService.java
  16. 4 3
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/service/impl/ExamPaperAnswerServiceImpl.java
  17. 6 4
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/service/impl/ExamPaperQuestionCustomerAnswerServiceImpl.java
  18. 4 3
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/service/impl/ExamPaperServiceImpl.java
  19. 19 0
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/viewmodel/student/exam/ExamPaperPageVM.java
  20. 20 0
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/viewmodel/student/exampaper/ExamPaperAnswerPageVM.java
  21. 19 0
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/viewmodel/student/question/answer/QuestionPageStudentRequestVM.java

+ 5 - 4
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/controller/student/EducationController.java

@@ -7,6 +7,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
 import vip.xiaonuo.auth.core.pojo.SaBaseLoginUser;
+import vip.xiaonuo.common.pojo.CommonResult;
 import vip.xiaonuo.exam.base.BaseApiController;
 import vip.xiaonuo.exam.base.RestResponse;
 import vip.xiaonuo.exam.domain.Subject;
@@ -29,7 +30,7 @@ public class EducationController extends BaseApiController {
     }
 
     @RequestMapping(value = "/subject/list", method = RequestMethod.POST)
-    public RestResponse<List<SubjectVM>> list() {
+    public CommonResult<List<SubjectVM>> list() {
         SaBaseLoginUser user = getCurrentUser();
         List<Subject> subjects = subjectService.getSubjectByLevel(user.getSortCode());
         List<SubjectVM> subjectVMS = subjects.stream().map(d -> {
@@ -37,14 +38,14 @@ public class EducationController extends BaseApiController {
             subjectVM.setId(String.valueOf(d.getId()));
             return subjectVM;
         }).collect(Collectors.toList());
-        return RestResponse.ok(subjectVMS);
+        return CommonResult.data(subjectVMS);
     }
 
     @RequestMapping(value = "/subject/select/{id}", method = RequestMethod.POST)
-    public RestResponse<SubjectEditRequestVM> select(@PathVariable Integer id) {
+    public CommonResult<SubjectEditRequestVM> select(@PathVariable Integer id) {
         Subject subject = subjectService.selectById(id);
         SubjectEditRequestVM vm = modelMapper.map(subject, SubjectEditRequestVM.class);
-        return RestResponse.ok(vm);
+        return CommonResult.data(vm);
     }
 
 }

+ 20 - 20
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/controller/student/ExamPaperAnswerController.java

@@ -1,6 +1,8 @@
 package vip.xiaonuo.exam.controller.student;
 
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import vip.xiaonuo.auth.core.pojo.SaBaseLoginUser;
+import vip.xiaonuo.common.pojo.CommonResult;
 import vip.xiaonuo.exam.base.BaseApiController;
 import vip.xiaonuo.exam.base.RestResponse;
 
@@ -46,30 +48,28 @@ public class ExamPaperAnswerController extends BaseApiController {
 
 
     @RequestMapping(value = "/pageList", method = RequestMethod.POST)
-    public RestResponse<PageInfo<ExamPaperAnswerPageResponseVM>> pageList(@RequestBody @Valid ExamPaperAnswerPageVM model) {
+    public CommonResult<Page<ExamPaperAnswer>> pageList(@RequestBody @Valid ExamPaperAnswerPageVM model) {
         model.setCreateUser(getCurrentUser().getId());
-        PageInfo<ExamPaperAnswer> pageInfo = examPaperAnswerService.studentPage(model);
-        PageInfo<ExamPaperAnswerPageResponseVM> page = PageInfoHelper.copyMap(pageInfo, e -> {
-            ExamPaperAnswerPageResponseVM vm = modelMapper.map(e, ExamPaperAnswerPageResponseVM.class);
+        Page<ExamPaperAnswer> pageInfo = examPaperAnswerService.studentPage(model);
+        pageInfo.getRecords().forEach(vm -> {
             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.setDoTimeStr(ExamUtil.secondToVM(vm.getDoTime()));
+            vm.setSystemScoreStr(ExamUtil.scoreToVM(vm.getSystemScore()));
+            vm.setUserScoreStr(ExamUtil.scoreToVM(vm.getUserScore()));
+            vm.setPaperScoreStr(ExamUtil.scoreToVM(vm.getPaperScore()));
             vm.setSubjectName(subject.getName());
-            vm.setCreateTime(DateTimeUtil.dateFormat(e.getCreateTime()));
-            return vm;
+            vm.setCreateTimeStr(DateTimeUtil.dateFormat(vm.getCreateTime()));
         });
-        return RestResponse.ok(page);
+        return CommonResult.data(pageInfo);
     }
 
 
     @RequestMapping(value = "/answerSubmit", method = RequestMethod.POST)
-    public RestResponse answerSubmit(@RequestBody @Valid ExamPaperSubmitVM examPaperSubmitVM) {
+    public CommonResult<String> answerSubmit(@RequestBody @Valid ExamPaperSubmitVM examPaperSubmitVM) {
         SaBaseLoginUser user = getCurrentUser();
         ExamPaperAnswerInfo examPaperAnswerInfo = examPaperAnswerService.calculateExamPaperAnswer(examPaperSubmitVM, user);
         if (null == examPaperAnswerInfo) {
-            return RestResponse.fail(2, "试卷不能重复做");
+            return CommonResult.error( "试卷不能重复做");
         }
         ExamPaperAnswer examPaperAnswer = examPaperAnswerInfo.getExamPaperAnswer();
         Integer userScore = examPaperAnswer.getUserScore();
@@ -81,21 +81,21 @@ public class ExamPaperAnswerController extends BaseApiController {
         userEventLog.setContent(content);
         eventPublisher.publishEvent(new CalculateExamPaperAnswerCompleteEvent(examPaperAnswerInfo));
         eventPublisher.publishEvent(new UserEvent(userEventLog));
-        return RestResponse.ok(scoreVm);
+        return CommonResult.ok(scoreVm);
     }
 
 
     @RequestMapping(value = "/edit", method = RequestMethod.POST)
-    public RestResponse edit(@RequestBody @Valid ExamPaperSubmitVM examPaperSubmitVM) {
+    public CommonResult<String> edit(@RequestBody @Valid ExamPaperSubmitVM examPaperSubmitVM) {
         boolean notJudge = examPaperSubmitVM.getAnswerItems().stream().anyMatch(i -> i.getDoRight() == null && i.getScore() == null);
         if (notJudge) {
-            return RestResponse.fail(2, "有未批改题目");
+            return CommonResult.error("有未批改题目");
         }
 
         ExamPaperAnswer examPaperAnswer = examPaperAnswerService.selectById(examPaperSubmitVM.getId());
         ExamPaperAnswerStatusEnum examPaperAnswerStatusEnum = ExamPaperAnswerStatusEnum.fromCode(examPaperAnswer.getStatus());
         if (examPaperAnswerStatusEnum == ExamPaperAnswerStatusEnum.Complete) {
-            return RestResponse.fail(3, "试卷已完成");
+            return CommonResult.error("试卷已完成");
         }
         String score = examPaperAnswerService.judge(examPaperSubmitVM);
         SaBaseLoginUser user = getCurrentUser();
@@ -103,18 +103,18 @@ public class ExamPaperAnswerController extends BaseApiController {
         String content = user.getName() + " 批改试卷:" + examPaperAnswer.getPaperName() + " 得分:" + score;
         userEventLog.setContent(content);
         eventPublisher.publishEvent(new UserEvent(userEventLog));
-        return RestResponse.ok(score);
+        return CommonResult.ok(score);
     }
 
     @RequestMapping(value = "/read/{id}", method = RequestMethod.POST)
-    public RestResponse<ExamPaperReadVM> read(@PathVariable Integer id) {
+    public CommonResult<ExamPaperReadVM> read(@PathVariable Integer id) {
         ExamPaperAnswer examPaperAnswer = examPaperAnswerService.selectById(id);
         ExamPaperReadVM vm = new ExamPaperReadVM();
         ExamPaperEditRequestVM paper = examPaperService.examPaperToVM(examPaperAnswer.getExamPaperId());
         ExamPaperSubmitVM answer = examPaperAnswerService.examPaperAnswerToVM(examPaperAnswer.getId());
         vm.setPaper(paper);
         vm.setAnswer(answer);
-        return RestResponse.ok(vm);
+        return CommonResult.data(vm);
     }
 
 

+ 7 - 11
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/controller/student/ExamPaperController.java

@@ -1,5 +1,7 @@
 package vip.xiaonuo.exam.controller.student;
 
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import vip.xiaonuo.common.pojo.CommonResult;
 import vip.xiaonuo.exam.base.BaseApiController;
 import vip.xiaonuo.exam.base.RestResponse;
 import vip.xiaonuo.exam.domain.ExamPaper;
@@ -10,7 +12,7 @@ import vip.xiaonuo.exam.utility.PageInfoHelper;
 import vip.xiaonuo.exam.viewmodel.admin.exam.ExamPaperEditRequestVM;
 import vip.xiaonuo.exam.viewmodel.student.exam.ExamPaperPageResponseVM;
 import vip.xiaonuo.exam.viewmodel.student.exam.ExamPaperPageVM;
-import com.github.pagehelper.PageInfo;
+
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.ApplicationEventPublisher;
 import org.springframework.web.bind.annotation.*;
@@ -34,20 +36,14 @@ public class ExamPaperController extends BaseApiController {
 
 
     @RequestMapping(value = "/select/{id}", method = RequestMethod.POST)
-    public RestResponse<ExamPaperEditRequestVM> select(@PathVariable Integer id) {
+    public CommonResult<ExamPaperEditRequestVM> select(@PathVariable Integer id) {
         ExamPaperEditRequestVM vm = examPaperService.examPaperToVM(id);
-        return RestResponse.ok(vm);
+        return CommonResult.data(vm);
     }
 
 
     @RequestMapping(value = "/pageList", method = RequestMethod.POST)
-    public RestResponse<PageInfo<ExamPaperPageResponseVM>> pageList(@RequestBody @Valid ExamPaperPageVM model) {
-        PageInfo<ExamPaper> pageInfo = examPaperService.studentPage(model);
-        PageInfo<ExamPaperPageResponseVM> page = PageInfoHelper.copyMap(pageInfo, e -> {
-            ExamPaperPageResponseVM vm = modelMapper.map(e, ExamPaperPageResponseVM.class);
-            vm.setCreateTime(DateTimeUtil.dateFormat(e.getCreateTime()));
-            return vm;
-        });
-        return RestResponse.ok(page);
+    public CommonResult<Page<ExamPaper>> pageList(@RequestBody @Valid ExamPaperPageVM model) {
+        return CommonResult.data(examPaperService.studentPage(model));
     }
 }

+ 18 - 16
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/controller/student/QuestionAnswerController.java

@@ -1,5 +1,7 @@
 package vip.xiaonuo.exam.controller.student;
 
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import vip.xiaonuo.common.pojo.CommonResult;
 import vip.xiaonuo.exam.base.BaseApiController;
 import vip.xiaonuo.exam.base.RestResponse;
 import vip.xiaonuo.exam.domain.ExamPaperQuestionCustomerAnswer;
@@ -10,10 +12,7 @@ import vip.xiaonuo.exam.service.ExamPaperQuestionCustomerAnswerService;
 import vip.xiaonuo.exam.service.QuestionService;
 import vip.xiaonuo.exam.service.SubjectService;
 import vip.xiaonuo.exam.service.TextContentService;
-import vip.xiaonuo.exam.utility.DateTimeUtil;
-import vip.xiaonuo.exam.utility.HtmlUtil;
-import vip.xiaonuo.exam.utility.JsonUtil;
-import vip.xiaonuo.exam.utility.PageInfoHelper;
+import vip.xiaonuo.exam.utility.*;
 import vip.xiaonuo.exam.viewmodel.admin.question.QuestionEditRequestVM;
 import vip.xiaonuo.exam.viewmodel.student.exam.ExamPaperSubmitItemVM;
 import vip.xiaonuo.exam.viewmodel.student.question.answer.QuestionAnswerVM;
@@ -41,33 +40,36 @@ public class QuestionAnswerController extends BaseApiController {
     }
 
     @RequestMapping(value = "/page", method = RequestMethod.POST)
-    public RestResponse<PageInfo<QuestionPageStudentResponseVM>> pageList(@RequestBody QuestionPageStudentRequestVM model) {
+    public CommonResult<Page<ExamPaperQuestionCustomerAnswer>> pageList(@RequestBody QuestionPageStudentRequestVM model) {
         model.setCreateUser(getCurrentUser().getId());
-        PageInfo<ExamPaperQuestionCustomerAnswer> pageInfo = examPaperQuestionCustomerAnswerService.studentPage(model);
-        PageInfo<QuestionPageStudentResponseVM> page = PageInfoHelper.copyMap(pageInfo, q -> {
-            Subject subject = subjectService.selectById(q.getSubjectId());
-            QuestionPageStudentResponseVM vm = modelMapper.map(q, QuestionPageStudentResponseVM.class);
-            vm.setCreateTime(DateTimeUtil.dateFormat(q.getCreateTime()));
-            TextContent textContent = textContentService.selectById(q.getQuestionTextContentId());
+        Page<ExamPaperQuestionCustomerAnswer> pageInfo = examPaperQuestionCustomerAnswerService.studentPage(model);
+
+        pageInfo.getRecords().forEach(vm -> {
+            Subject subject = subjectService.selectById(vm.getSubjectId());
+
+            vm.setCreateTimeStr(DateTimeUtil.dateFormat(vm.getCreateTime()));
+            TextContent textContent = textContentService.selectById(vm.getQuestionTextContentId());
+            String clearHtml = "";
             QuestionObject questionObject = JsonUtil.toJsonObject(textContent.getContent(), QuestionObject.class);
-            String clearHtml = HtmlUtil.clear(questionObject.getTitleContent());
+            if(questionObject != null && questionObject.getTitleContent() != null && !questionObject.getTitleContent().isEmpty()){
+                clearHtml = HtmlUtil.clear(questionObject.getTitleContent());
+            }
             vm.setShortTitle(clearHtml);
             vm.setSubjectName(subject.getName());
-            return vm;
         });
-        return RestResponse.ok(page);
+        return CommonResult.data(pageInfo);
     }
 
 
     @RequestMapping(value = "/select/{id}", method = RequestMethod.POST)
-    public RestResponse<QuestionAnswerVM> select(@PathVariable Integer id) {
+    public CommonResult<QuestionAnswerVM> select(@PathVariable Integer id) {
         QuestionAnswerVM vm = new QuestionAnswerVM();
         ExamPaperQuestionCustomerAnswer examPaperQuestionCustomerAnswer = examPaperQuestionCustomerAnswerService.selectById(id);
         ExamPaperSubmitItemVM questionAnswerVM = examPaperQuestionCustomerAnswerService.examPaperQuestionCustomerAnswerToVM(examPaperQuestionCustomerAnswer);
         QuestionEditRequestVM questionVM = questionService.getQuestionEditRequestVM(examPaperQuestionCustomerAnswer.getQuestionId());
         vm.setQuestionVM(questionVM);
         vm.setQuestionAnswerVM(questionAnswerVM);
-        return RestResponse.ok(vm);
+        return CommonResult.data(vm);
     }
 
 }

+ 3 - 2
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/domain/ExamPaperAnswer.java

@@ -62,6 +62,7 @@ public class ExamPaperAnswer implements Serializable {
      */
     private Integer doTime;
 
+    private String doTimeStr;
     /**
      * 试卷状态(1待判分 2完成)
      */
@@ -81,8 +82,6 @@ public class ExamPaperAnswer implements Serializable {
 
     private Integer taskExamId;
 
-    private String doTimeStr;
-
     public Integer getId() {
         return id;
     }
@@ -250,4 +249,6 @@ public class ExamPaperAnswer implements Serializable {
     public void setCreateTimeStr(String createTimeStr) {
         this.createTimeStr = createTimeStr;
     }
+
+
 }

+ 30 - 0
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/domain/ExamPaperQuestionCustomerAnswer.java

@@ -71,8 +71,14 @@ public class ExamPaperQuestionCustomerAnswer implements Serializable {
 
     private Date createTime;
 
+    private String createTimeStr;
+
     private Integer itemOrder;
 
+    private String shortTitle;
+
+    private String subjectName;
+
     public Integer getId() {
         return id;
     }
@@ -192,4 +198,28 @@ public class ExamPaperQuestionCustomerAnswer implements Serializable {
     public void setItemOrder(Integer itemOrder) {
         this.itemOrder = itemOrder;
     }
+
+    public String getCreateTimeStr() {
+        return createTimeStr;
+    }
+
+    public void setCreateTimeStr(String createTimeStr) {
+        this.createTimeStr = createTimeStr;
+    }
+
+    public String getShortTitle() {
+        return shortTitle;
+    }
+
+    public void setShortTitle(String shortTitle) {
+        this.shortTitle = shortTitle;
+    }
+
+    public String getSubjectName() {
+        return subjectName;
+    }
+
+    public void setSubjectName(String subjectName) {
+        this.subjectName = subjectName;
+    }
 }

+ 1 - 1
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/mapper/ExamPaperAnswerMapper.java

@@ -14,7 +14,7 @@ import java.util.List;
 @Mapper
 public interface ExamPaperAnswerMapper extends BaseMapper<ExamPaperAnswer> {
 
-    List<ExamPaperAnswer> studentPage(ExamPaperAnswerPageVM requestVM);
+    Page<ExamPaperAnswer> studentPage(@Param("bo") ExamPaperAnswerPageVM requestVM , @Param("page") Page<ExamPaperAnswer> page);
 
     Integer selectAllCount();
 

+ 1 - 1
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/mapper/ExamPaperMapper.java

@@ -21,7 +21,7 @@ public interface ExamPaperMapper extends BaseMapper<ExamPaper> {
 
     Page<ExamPaper> taskExamPage(@Param("bo")ExamPaperPageRequestVM requestVM, @Param("page") Page<ExamPaper> page);
 
-    List<ExamPaper> studentPage(ExamPaperPageVM requestVM);
+    Page<ExamPaper> studentPage(@Param("bo")ExamPaperPageVM requestVM, @Param("page") Page<ExamPaper> page);
 
     List<PaperInfo> indexPaper(PaperFilter paperFilter);
 

+ 2 - 1
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/mapper/ExamPaperQuestionCustomerAnswerMapper.java

@@ -1,5 +1,6 @@
 package vip.xiaonuo.exam.mapper;
 
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import vip.xiaonuo.exam.domain.ExamPaperQuestionCustomerAnswer;
 import vip.xiaonuo.exam.domain.other.ExamPaperAnswerUpdate;
 import vip.xiaonuo.exam.domain.other.KeyValue;
@@ -15,7 +16,7 @@ public interface ExamPaperQuestionCustomerAnswerMapper extends BaseMapper<ExamPa
 
     List<ExamPaperQuestionCustomerAnswer> selectListByPaperAnswerId(Integer id);
 
-    List<ExamPaperQuestionCustomerAnswer> studentPage(QuestionPageStudentRequestVM requestVM);
+    Page<ExamPaperQuestionCustomerAnswer> studentPage(@Param("bo") QuestionPageStudentRequestVM requestVM, @Param("page") Page<ExamPaperQuestionCustomerAnswer> page);
 
     int insertList(List<ExamPaperQuestionCustomerAnswer> list);
 

+ 4 - 3
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/mapper/mapping/ExamPaperAnswerMapper.xml

@@ -220,11 +220,12 @@
     <include refid="Base_Column_List"/>
     FROM t_exam_paper_answer
     <where>
-        and create_user = #{createUser}
-     <if test="subjectId != null">
-         and subject_id = #{subjectId}
+        and create_user = #{bo.createUser}
+     <if test="bo.subjectId != null">
+         and subject_id = #{bo.subjectId}
      </if>
     </where>
+    ORDER BY create_time DESC
   </select>
 
 

+ 5 - 5
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/mapper/mapping/ExamPaperMapper.xml

@@ -271,13 +271,13 @@
     FROM t_exam_paper
     <where>
        and deleted=0
-      <if test="subjectId != null ">
-        and subject_id=#{subjectId}
+      <if test="bo.subjectId != null ">
+        and subject_id=#{bo.subjectId}
       </if>
-      <if test="levelId != null ">
-        and grade_level=#{levelId}
+      <if test="bo.levelId != null ">
+        and grade_level=#{bo.levelId}
       </if>
-       and paper_type=#{paperType}
+       and paper_type=#{bo.paperType}
     </where>
   </select>
 

+ 2 - 1
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/mapper/mapping/ExamPaperQuestionCustomerAnswerMapper.xml

@@ -234,8 +234,9 @@
     FROM t_exam_paper_question_customer_answer
     <where>
       and do_right=FALSE
-      and create_user=#{createUser}
+      and create_user=#{bo.createUser}
     </where>
+    order by create_time desc
   </select>
 
 

+ 1 - 1
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/service/ExamPaperAnswerService.java

@@ -19,7 +19,7 @@ public interface ExamPaperAnswerService extends BaseService<ExamPaperAnswer> {
      * @param requestVM 过滤条件
      * @return PageInfo<ExamPaperAnswer>
      */
-    PageInfo<ExamPaperAnswer> studentPage(ExamPaperAnswerPageVM requestVM);
+    Page<ExamPaperAnswer> studentPage(ExamPaperAnswerPageVM requestVM);
 
     /**
      * 计算试卷提交结果(不入库)

+ 2 - 2
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/service/ExamPaperQuestionCustomerAnswerService.java

@@ -4,13 +4,13 @@ import vip.xiaonuo.exam.domain.ExamPaperQuestionCustomerAnswer;
 import vip.xiaonuo.exam.domain.other.ExamPaperAnswerUpdate;
 import vip.xiaonuo.exam.viewmodel.student.exam.ExamPaperSubmitItemVM;
 import vip.xiaonuo.exam.viewmodel.student.question.answer.QuestionPageStudentRequestVM;
-import com.github.pagehelper.PageInfo;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 
 import java.util.List;
 
 public interface ExamPaperQuestionCustomerAnswerService extends BaseService<ExamPaperQuestionCustomerAnswer> {
 
-    PageInfo<ExamPaperQuestionCustomerAnswer> studentPage(QuestionPageStudentRequestVM requestVM);
+    Page<ExamPaperQuestionCustomerAnswer> studentPage(QuestionPageStudentRequestVM requestVM);
 
     List<ExamPaperQuestionCustomerAnswer> selectListByPaperAnswerId(Integer id);
 

+ 1 - 1
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/service/ExamPaperService.java

@@ -19,7 +19,7 @@ public interface ExamPaperService extends BaseService<ExamPaper> {
 
     Page<ExamPaper> taskExamPage(ExamPaperPageRequestVM requestVM);
 
-    PageInfo<ExamPaper> studentPage(ExamPaperPageVM requestVM);
+    Page<ExamPaper> studentPage(ExamPaperPageVM requestVM);
 
     ExamPaper savePaperFromVM(ExamPaperEditRequestVM examPaperEditRequestVM, SaBaseLoginUser user);
 

+ 4 - 3
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/service/impl/ExamPaperAnswerServiceImpl.java

@@ -58,9 +58,10 @@ public class ExamPaperAnswerServiceImpl extends BaseServiceImpl<ExamPaperAnswer>
     }
 
     @Override
-    public PageInfo<ExamPaperAnswer> studentPage(ExamPaperAnswerPageVM requestVM) {
-        return PageHelper.startPage(requestVM.getPageIndex(), requestVM.getPageSize(), "id desc").doSelectPageInfo(() ->
-                examPaperAnswerMapper.studentPage(requestVM));
+    public Page<ExamPaperAnswer> studentPage(ExamPaperAnswerPageVM requestVM) {
+        Page<ExamPaperAnswer> page = new Page<ExamPaperAnswer>(requestVM.getCurrent(), requestVM.getSize());
+        page.setSearchCount(true); // 设置计算总记录数
+        return examPaperAnswerMapper.studentPage(requestVM,page);
     }
 
 

+ 6 - 4
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/service/impl/ExamPaperQuestionCustomerAnswerServiceImpl.java

@@ -1,5 +1,7 @@
 package vip.xiaonuo.exam.service.impl;
 
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import vip.xiaonuo.exam.domain.ExamPaperAnswer;
 import vip.xiaonuo.exam.domain.ExamPaperQuestionCustomerAnswer;
 import vip.xiaonuo.exam.domain.other.ExamPaperAnswerUpdate;
 import vip.xiaonuo.exam.domain.other.KeyValue;
@@ -37,10 +39,10 @@ public class ExamPaperQuestionCustomerAnswerServiceImpl extends BaseServiceImpl<
 
 
     @Override
-    public PageInfo<ExamPaperQuestionCustomerAnswer> studentPage(QuestionPageStudentRequestVM requestVM) {
-        return PageHelper.startPage(requestVM.getPageIndex(), requestVM.getPageSize(), "id desc").doSelectPageInfo(() ->
-                examPaperQuestionCustomerAnswerMapper.studentPage(requestVM)
-        );
+    public Page<ExamPaperQuestionCustomerAnswer> studentPage(QuestionPageStudentRequestVM requestVM) {
+        Page<ExamPaperQuestionCustomerAnswer> page = new Page<ExamPaperQuestionCustomerAnswer>(requestVM.getCurrent(), requestVM.getSize());
+        page.setSearchCount(true); // 设置计算总记录数
+        return examPaperQuestionCustomerAnswerMapper.studentPage(requestVM,page);
     }
 
     @Override

+ 4 - 3
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/service/impl/ExamPaperServiceImpl.java

@@ -83,9 +83,10 @@ public class ExamPaperServiceImpl extends BaseServiceImpl<ExamPaper> implements
     }
 
     @Override
-    public PageInfo<ExamPaper> studentPage(ExamPaperPageVM requestVM) {
-        return PageHelper.startPage(requestVM.getPageIndex(), requestVM.getPageSize(), "id desc").doSelectPageInfo(() ->
-                examPaperMapper.studentPage(requestVM));
+    public Page<ExamPaper> studentPage(ExamPaperPageVM requestVM) {
+        Page<ExamPaper> page = new Page<ExamPaper>(requestVM.getCurrent(), requestVM.getSize());
+        page.setSearchCount(true); // 设置计算总记录数
+        return examPaperMapper.studentPage(requestVM,page);
     }
 
 

+ 19 - 0
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/viewmodel/student/exam/ExamPaperPageVM.java

@@ -10,6 +10,9 @@ public class ExamPaperPageVM extends BasePage {
     private Integer subjectId;
     private Integer levelId;
 
+    private Integer current;
+    private Integer size;
+
     public Integer getPaperType() {
         return paperType;
     }
@@ -33,4 +36,20 @@ public class ExamPaperPageVM extends BasePage {
     public void setLevelId(Integer levelId) {
         this.levelId = levelId;
     }
+
+    public Integer getCurrent() {
+        return current;
+    }
+
+    public void setCurrent(Integer current) {
+        this.current = current;
+    }
+
+    public Integer getSize() {
+        return size;
+    }
+
+    public void setSize(Integer size) {
+        this.size = size;
+    }
 }

+ 20 - 0
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/viewmodel/student/exampaper/ExamPaperAnswerPageVM.java

@@ -8,6 +8,10 @@ public class ExamPaperAnswerPageVM extends BasePage {
 
     private String createUser;
 
+    private Integer current;
+
+    private Integer size;
+
     public Integer getSubjectId() {
         return subjectId;
     }
@@ -23,4 +27,20 @@ public class ExamPaperAnswerPageVM extends BasePage {
     public void setCreateUser(String createUser) {
         this.createUser = createUser;
     }
+
+    public Integer getCurrent() {
+        return current;
+    }
+
+    public void setCurrent(Integer current) {
+        this.current = current;
+    }
+
+    public Integer getSize() {
+        return size;
+    }
+
+    public void setSize(Integer size) {
+        this.size = size;
+    }
 }

+ 19 - 0
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/viewmodel/student/question/answer/QuestionPageStudentRequestVM.java

@@ -5,6 +5,9 @@ import vip.xiaonuo.exam.base.BasePage;
 public class QuestionPageStudentRequestVM extends BasePage {
     private String createUser;
 
+    private Integer current;
+    private Integer size;
+
     public String getCreateUser() {
         return createUser;
     }
@@ -12,4 +15,20 @@ public class QuestionPageStudentRequestVM extends BasePage {
     public void setCreateUser(String createUser) {
         this.createUser = createUser;
     }
+
+    public Integer getCurrent() {
+        return current;
+    }
+
+    public void setCurrent(Integer current) {
+        this.current = current;
+    }
+
+    public Integer getSize() {
+        return size;
+    }
+
+    public void setSize(Integer size) {
+        this.size = size;
+    }
 }