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/ExamPaperServiceImpl.java |   61 +++++++++++++-----------------
 1 files changed, 27 insertions(+), 34 deletions(-)

diff --git a/src/main/java/com/ycl/jxkg/service/impl/ExamPaperServiceImpl.java b/src/main/java/com/ycl/jxkg/service/impl/ExamPaperServiceImpl.java
index 7776dc5..367300d 100644
--- a/src/main/java/com/ycl/jxkg/service/impl/ExamPaperServiceImpl.java
+++ b/src/main/java/com/ycl/jxkg/service/impl/ExamPaperServiceImpl.java
@@ -1,6 +1,7 @@
 package com.ycl.jxkg.service.impl;
 
-import com.ycl.jxkg.domain.TextContent;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ycl.jxkg.domain.entity.TextContent;
 import com.ycl.jxkg.domain.enums.ExamPaperTypeEnum;
 import com.ycl.jxkg.domain.exam.ExamPaperQuestionItemObject;
 import com.ycl.jxkg.domain.exam.ExamPaperTitleItemObject;
@@ -15,20 +16,20 @@
 import com.ycl.jxkg.utils.DateTimeUtil;
 import com.ycl.jxkg.utils.JsonUtil;
 import com.ycl.jxkg.utils.ExamUtil;
-import com.ycl.jxkg.vo.admin.exam.ExamPaperEditRequestVO;
-import com.ycl.jxkg.vo.admin.exam.ExamPaperPageRequestVO;
-import com.ycl.jxkg.vo.admin.exam.ExamPaperTitleItemVO;
-import com.ycl.jxkg.vo.admin.question.QuestionEditRequestVO;
-import com.ycl.jxkg.vo.student.dashboard.PaperFilter;
-import com.ycl.jxkg.vo.student.dashboard.PaperInfo;
-import com.ycl.jxkg.vo.student.exam.ExamPaperPageVO;
+import com.ycl.jxkg.domain.vo.admin.exam.ExamPaperEditRequestVO;
+import com.ycl.jxkg.domain.vo.admin.exam.ExamPaperPageRequestVO;
+import com.ycl.jxkg.domain.vo.admin.exam.ExamPaperTitleItemVO;
+import com.ycl.jxkg.domain.vo.admin.question.QuestionEditRequestVO;
+import com.ycl.jxkg.domain.vo.student.dashboard.PaperFilter;
+import com.ycl.jxkg.domain.vo.student.dashboard.PaperInfo;
+import com.ycl.jxkg.domain.vo.student.exam.ExamPaperPageVO;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
-import com.ycl.jxkg.domain.ExamPaper;
-import com.ycl.jxkg.domain.Question;
-import com.ycl.jxkg.domain.User;
+import com.ycl.jxkg.domain.entity.ExamPaper;
+import com.ycl.jxkg.domain.entity.Question;
+import com.ycl.jxkg.domain.entity.User;
+import lombok.RequiredArgsConstructor;
 import org.springframework.beans.BeanUtils;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
@@ -39,23 +40,14 @@
 import java.util.stream.Collectors;
 
 @Service
-public class ExamPaperServiceImpl extends BaseServiceImpl<ExamPaper> implements ExamPaperService {
+@RequiredArgsConstructor
+public class ExamPaperServiceImpl extends ServiceImpl<ExamPaperMapper, ExamPaper> implements ExamPaperService {
 
     private final ExamPaperMapper examPaperMapper;
     private final QuestionMapper questionMapper;
     private final TextContentService textContentService;
     private final QuestionService questionService;
     private final SubjectService subjectService;
-
-    @Autowired
-    public ExamPaperServiceImpl(ExamPaperMapper examPaperMapper, QuestionMapper questionMapper, TextContentService textContentService, QuestionService questionService, SubjectService subjectService) {
-        super(examPaperMapper);
-        this.examPaperMapper = examPaperMapper;
-        this.questionMapper = questionMapper;
-        this.textContentService = textContentService;
-        this.questionService = questionService;
-        this.subjectService = subjectService;
-    }
 
 
     @Override
@@ -92,31 +84,30 @@
             TextContent frameTextContent = new TextContent();
             frameTextContent.setContent(frameTextContentStr);
             frameTextContent.setCreateTime(now);
-            textContentService.insertByFilter(frameTextContent);
+            textContentService.save(frameTextContent);
             examPaper.setFrameTextContentId(frameTextContent.getId());
             examPaper.setCreateTime(now);
             examPaper.setCreateUser(user.getId());
-            examPaper.setDeleted(false);
             examPaperFromVM(examPaperEditRequestVO, examPaper, titleItemsVM);
-            examPaperMapper.insertSelective(examPaper);
+            examPaperMapper.insert(examPaper);
         } else {
-            examPaper = examPaperMapper.selectByPrimaryKey(examPaperEditRequestVO.getId());
-            TextContent frameTextContent = textContentService.selectById(examPaper.getFrameTextContentId());
+            examPaper = examPaperMapper.selectById(examPaperEditRequestVO.getId());
+            TextContent frameTextContent = textContentService.getById(examPaper.getFrameTextContentId());
             frameTextContent.setContent(frameTextContentStr);
-            textContentService.updateByIdFilter(frameTextContent);
+            textContentService.updateById(frameTextContent);
             examPaperFromVM(examPaperEditRequestVO, examPaper, titleItemsVM);
-            examPaperMapper.updateByPrimaryKeySelective(examPaper);
+            examPaperMapper.updateById(examPaper);
         }
         return examPaper;
     }
 
     @Override
     public ExamPaperEditRequestVO examPaperToVM(Integer id) {
-        ExamPaper examPaper = examPaperMapper.selectByPrimaryKey(id);
+        ExamPaper examPaper = examPaperMapper.selectById(id);
         ExamPaperEditRequestVO vo = new ExamPaperEditRequestVO();
         BeanUtils.copyProperties(examPaper, vo);
         vo.setLevel(examPaper.getGradeLevel());
-        TextContent frameTextContent = textContentService.selectById(examPaper.getFrameTextContentId());
+        TextContent frameTextContent = textContentService.getById(examPaper.getFrameTextContentId());
         List<ExamPaperTitleItemObject> examPaperTitleItemObjects = JsonUtil.toJsonListObject(frameTextContent.getContent(), ExamPaperTitleItemObject.class);
         List<Integer> questionIds = examPaperTitleItemObjects.stream()
                 .flatMap(t -> t.getQuestionItems().stream()
@@ -137,7 +128,7 @@
         }).collect(Collectors.toList());
         vo.setTitleItems(examPaperTitleItemVOS);
         vo.setScore(ExamUtil.scoreToVM(examPaper.getScore()));
-        if (ExamPaperTypeEnum.TimeLimit == ExamPaperTypeEnum.fromCode(examPaper.getPaperType())) {
+        if (ExamPaperTypeEnum.Random == ExamPaperTypeEnum.fromCode(examPaper.getPaperType())) {
             List<String> limitDateTime = Arrays.asList(DateTimeUtil.dateFormat(examPaper.getLimitStartTime()), DateTimeUtil.dateFormat(examPaper.getLimitEndTime()));
             vo.setLimitDateTime(limitDateTime);
         }
@@ -179,7 +170,7 @@
         examPaper.setScore(score);
         examPaper.setGradeLevel(gradeLevel);
         List<String> dateTimes = examPaperEditRequestVO.getLimitDateTime();
-        if (ExamPaperTypeEnum.TimeLimit == ExamPaperTypeEnum.fromCode(examPaper.getPaperType())) {
+        if (ExamPaperTypeEnum.Random == ExamPaperTypeEnum.fromCode(examPaper.getPaperType())) {
             examPaper.setLimitStartTime(DateTimeUtil.parse(dateTimes.get(0), DateTimeUtil.STANDER_FORMAT));
             examPaper.setLimitEndTime(DateTimeUtil.parse(dateTimes.get(1), DateTimeUtil.STANDER_FORMAT));
         }
@@ -202,4 +193,6 @@
             return titleItem;
         }).collect(Collectors.toList());
     }
+
+
 }

--
Gitblit v1.8.0