From 81b6f1cc38a941b65f989ecdd40529f2648bdd8c Mon Sep 17 00:00:00 2001
From: xiangpei <xiangpei@timesnew.cn>
Date: 星期二, 04 六月 2024 11:42:47 +0800
Subject: [PATCH] 班级成员管理代码生成,成员管理查询数据接口

---
 src/main/java/com/ycl/jxkg/service/impl/ExamPaperAnswerServiceImpl.java |   45 +++++++++++++++++++--------------------------
 1 files changed, 19 insertions(+), 26 deletions(-)

diff --git a/src/main/java/com/ycl/jxkg/service/impl/ExamPaperAnswerServiceImpl.java b/src/main/java/com/ycl/jxkg/service/impl/ExamPaperAnswerServiceImpl.java
index 3e57906..2d977e5 100644
--- a/src/main/java/com/ycl/jxkg/service/impl/ExamPaperAnswerServiceImpl.java
+++ b/src/main/java/com/ycl/jxkg/service/impl/ExamPaperAnswerServiceImpl.java
@@ -1,6 +1,8 @@
 package com.ycl.jxkg.service.impl;
 
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.ycl.jxkg.domain.*;
+import com.ycl.jxkg.domain.entity.*;
 import com.ycl.jxkg.domain.enums.ExamPaperAnswerStatusEnum;
 import com.ycl.jxkg.domain.enums.ExamPaperTypeEnum;
 import com.ycl.jxkg.domain.enums.QuestionTypeEnum;
@@ -18,13 +20,13 @@
 import com.ycl.jxkg.utils.DateTimeUtil;
 import com.ycl.jxkg.utils.ExamUtil;
 import com.ycl.jxkg.utils.JsonUtil;
-import com.ycl.jxkg.vo.admin.paper.ExamPaperAnswerPageRequestVO;
-import com.ycl.jxkg.vo.student.exam.ExamPaperSubmitItemVO;
-import com.ycl.jxkg.vo.student.exam.ExamPaperSubmitVO;
-import com.ycl.jxkg.vo.student.exampaper.ExamPaperAnswerPageVO;
+import com.ycl.jxkg.domain.vo.admin.paper.ExamPaperAnswerPageRequestVO;
+import com.ycl.jxkg.domain.vo.student.exam.ExamPaperSubmitItemVO;
+import com.ycl.jxkg.domain.vo.student.exam.ExamPaperSubmitVO;
+import com.ycl.jxkg.domain.vo.student.exampaper.ExamPaperAnswerPageVO;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
-import org.springframework.beans.factory.annotation.Autowired;
+import lombok.RequiredArgsConstructor;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
@@ -34,7 +36,8 @@
 import java.util.stream.Collectors;
 
 @Service
-public class ExamPaperAnswerServiceImpl extends BaseServiceImpl<ExamPaperAnswer> implements ExamPaperAnswerService {
+@RequiredArgsConstructor
+public class ExamPaperAnswerServiceImpl extends ServiceImpl<ExamPaperAnswerMapper , ExamPaperAnswer> implements ExamPaperAnswerService {
 
     private final ExamPaperAnswerMapper examPaperAnswerMapper;
     private final ExamPaperMapper examPaperMapper;
@@ -43,16 +46,6 @@
     private final ExamPaperQuestionCustomerAnswerService examPaperQuestionCustomerAnswerService;
     private final TaskExamCustomerAnswerMapper taskExamCustomerAnswerMapper;
 
-    @Autowired
-    public ExamPaperAnswerServiceImpl(ExamPaperAnswerMapper examPaperAnswerMapper, ExamPaperMapper examPaperMapper, TextContentService textContentService, QuestionMapper questionMapper, ExamPaperQuestionCustomerAnswerService examPaperQuestionCustomerAnswerService, TaskExamCustomerAnswerMapper taskExamCustomerAnswerMapper) {
-        super(examPaperAnswerMapper);
-        this.examPaperAnswerMapper = examPaperAnswerMapper;
-        this.examPaperMapper = examPaperMapper;
-        this.textContentService = textContentService;
-        this.questionMapper = questionMapper;
-        this.examPaperQuestionCustomerAnswerService = examPaperQuestionCustomerAnswerService;
-        this.taskExamCustomerAnswerMapper = taskExamCustomerAnswerMapper;
-    }
 
     @Override
     public PageInfo<ExamPaperAnswer> studentPage(ExamPaperAnswerPageVO requestVM) {
@@ -65,15 +58,15 @@
     public ExamPaperAnswerInfo calculateExamPaperAnswer(ExamPaperSubmitVO examPaperSubmitVO, User user) {
         ExamPaperAnswerInfo examPaperAnswerInfo = new ExamPaperAnswerInfo();
         Date now = new Date();
-        ExamPaper examPaper = examPaperMapper.selectByPrimaryKey(examPaperSubmitVO.getId());
+        ExamPaper examPaper = examPaperMapper.selectById(examPaperSubmitVO.getId());
         ExamPaperTypeEnum paperTypeEnum = ExamPaperTypeEnum.fromCode(examPaper.getPaperType());
         //浠诲姟璇曞嵎鍙兘鍋氫竴娆�
-        if (paperTypeEnum == ExamPaperTypeEnum.Task) {
+        if (paperTypeEnum == ExamPaperTypeEnum.RandomOrder) {
             ExamPaperAnswer examPaperAnswer = examPaperAnswerMapper.getByPidUid(examPaperSubmitVO.getId(), user.getId());
             if (null != examPaperAnswer)
                 return null;
         }
-        String frameTextContent = textContentService.selectById(examPaper.getFrameTextContentId()).getContent();
+        String frameTextContent = textContentService.getById(examPaper.getFrameTextContentId()).getContent();
         List<ExamPaperTitleItemObject> examPaperTitleItemObjects = JsonUtil.toJsonListObject(frameTextContent, ExamPaperTitleItemObject.class);
         List<Integer> questionIds = examPaperTitleItemObjects.stream().flatMap(t -> t.getQuestionItems().stream().map(q -> q.getId())).collect(Collectors.toList());
         List<Question> questions = questionMapper.selectByIds(questionIds);
@@ -100,7 +93,7 @@
     @Override
     @Transactional
     public String judge(ExamPaperSubmitVO examPaperSubmitVO) {
-        ExamPaperAnswer examPaperAnswer = examPaperAnswerMapper.selectByPrimaryKey(examPaperSubmitVO.getId());
+        ExamPaperAnswer examPaperAnswer = examPaperAnswerMapper.selectById(examPaperSubmitVO.getId());
         List<ExamPaperSubmitItemVO> judgeItems = examPaperSubmitVO.getAnswerItems().stream().filter(d -> d.getDoRight() == null).collect(Collectors.toList());
         List<ExamPaperAnswerUpdate> examPaperAnswerUpdates = new ArrayList<>(judgeItems.size());
         Integer customerScore = examPaperAnswer.getUserScore();
@@ -120,24 +113,24 @@
         examPaperAnswer.setUserScore(customerScore);
         examPaperAnswer.setQuestionCorrect(questionCorrect);
         examPaperAnswer.setStatus(ExamPaperAnswerStatusEnum.Complete.getCode());
-        examPaperAnswerMapper.updateByPrimaryKeySelective(examPaperAnswer);
+        examPaperAnswerMapper.updateById(examPaperAnswer);
         examPaperQuestionCustomerAnswerService.updateScore(examPaperAnswerUpdates);
 
         ExamPaperTypeEnum examPaperTypeEnum = ExamPaperTypeEnum.fromCode(examPaperAnswer.getPaperType());
         switch (examPaperTypeEnum) {
-            case Task:
+            case RandomOrder:
                 //浠诲姟璇曞嵎鎵规敼瀹屾垚鍚庯紝闇�瑕佹洿鏂颁换鍔$殑鐘舵��
-                ExamPaper examPaper = examPaperMapper.selectByPrimaryKey(examPaperAnswer.getExamPaperId());
+                ExamPaper examPaper = examPaperMapper.selectById(examPaperAnswer.getExamPaperId());
                 Integer taskId = examPaper.getTaskExamId();
                 Integer userId = examPaperAnswer.getCreateUser();
                 TaskExamCustomerAnswer taskExamCustomerAnswer = taskExamCustomerAnswerMapper.getByTUid(taskId, userId);
-                TextContent textContent = textContentService.selectById(taskExamCustomerAnswer.getTextContentId());
+                TextContent textContent = textContentService.getById(taskExamCustomerAnswer.getTextContentId());
                 List<TaskItemAnswerObject> taskItemAnswerObjects = JsonUtil.toJsonListObject(textContent.getContent(), TaskItemAnswerObject.class);
                 taskItemAnswerObjects.stream()
                         .filter(d -> d.getExamPaperAnswerId().equals(examPaperAnswer.getId()))
                         .findFirst().ifPresent(taskItemAnswerObject -> taskItemAnswerObject.setStatus(examPaperAnswer.getStatus()));
                 textContentService.jsonConvertUpdate(textContent, taskItemAnswerObjects, null);
-                textContentService.updateByIdFilter(textContent);
+                textContentService.updateById(textContent);
                 break;
             default:
                 break;
@@ -148,7 +141,7 @@
     @Override
     public ExamPaperSubmitVO examPaperAnswerToVM(Integer id) {
         ExamPaperSubmitVO examPaperSubmitVO = new ExamPaperSubmitVO();
-        ExamPaperAnswer examPaperAnswer = examPaperAnswerMapper.selectByPrimaryKey(id);
+        ExamPaperAnswer examPaperAnswer = examPaperAnswerMapper.selectById(id);
         examPaperSubmitVO.setId(examPaperAnswer.getId());
         examPaperSubmitVO.setDoTime(examPaperAnswer.getDoTime());
         examPaperSubmitVO.setScore(ExamUtil.scoreToVM(examPaperAnswer.getUserScore()));

--
Gitblit v1.8.0