From 21a9aa320b3eeb072bcd7d3fa883587d57b6ccbb Mon Sep 17 00:00:00 2001 From: fuliqi <fuliqi@qq.com> Date: 星期五, 31 五月 2024 14:52:33 +0800 Subject: [PATCH] 日志指定表名,试卷实体类修改 --- src/main/java/com/ycl/jxkg/service/impl/QuestionServiceImpl.java | 28 ++++++++++++---------------- 1 files changed, 12 insertions(+), 16 deletions(-) diff --git a/src/main/java/com/ycl/jxkg/service/impl/QuestionServiceImpl.java b/src/main/java/com/ycl/jxkg/service/impl/QuestionServiceImpl.java index 076b5ed..9d5130d 100644 --- a/src/main/java/com/ycl/jxkg/service/impl/QuestionServiceImpl.java +++ b/src/main/java/com/ycl/jxkg/service/impl/QuestionServiceImpl.java @@ -1,5 +1,6 @@ package com.ycl.jxkg.service.impl; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.ycl.jxkg.domain.other.KeyValue; import com.ycl.jxkg.domain.Question; import com.ycl.jxkg.domain.TextContent; @@ -19,6 +20,7 @@ import com.ycl.jxkg.vo.admin.question.QuestionPageRequestVO; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; +import lombok.RequiredArgsConstructor; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -29,19 +31,13 @@ import java.util.stream.Collectors; @Service -public class QuestionServiceImpl extends BaseServiceImpl<Question> implements QuestionService { +@RequiredArgsConstructor +public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> implements QuestionService { private final QuestionMapper questionMapper; private final TextContentService textContentService; private final SubjectService subjectService; - @Autowired - public QuestionServiceImpl(QuestionMapper questionMapper, TextContentService textContentService, SubjectService subjectService) { - super(questionMapper); - this.textContentService = textContentService; - this.questionMapper = questionMapper; - this.subjectService = subjectService; - } @Override public PageInfo<Question> page(QuestionPageRequestVO requestVM) { @@ -61,7 +57,7 @@ TextContent infoTextContent = new TextContent(); infoTextContent.setCreateTime(now); setQuestionInfoFromVM(infoTextContent, model); - textContentService.insertByFilter(infoTextContent); + textContentService.save(infoTextContent); Question question = new Question(); question.setSubjectId(model.getSubjectId()); @@ -75,7 +71,7 @@ question.setInfoTextContentId(infoTextContent.getId()); question.setCreateUser(userId); question.setDeleted(false); - questionMapper.insertSelective(question); + questionMapper.insert(question); return question; } @@ -83,18 +79,18 @@ @Transactional public Question updateFullQuestion(QuestionEditRequestVO model) { Integer gradeLevel = subjectService.levelBySubjectId(model.getSubjectId()); - Question question = questionMapper.selectByPrimaryKey(model.getId()); + Question question = questionMapper.selectById(model.getId()); question.setSubjectId(model.getSubjectId()); question.setGradeLevel(gradeLevel); question.setScore(ExamUtil.scoreFromVM(model.getScore())); question.setDifficult(model.getDifficult()); question.setCorrectFromVM(model.getCorrect(), model.getCorrectArray()); - questionMapper.updateByPrimaryKeySelective(question); + questionMapper.updateById(question); //棰樺共銆佽В鏋愩�侀�夐」绛� 鏇存柊 - TextContent infoTextContent = textContentService.selectById(question.getInfoTextContentId()); + TextContent infoTextContent = textContentService.getById(question.getInfoTextContentId()); setQuestionInfoFromVM(infoTextContent, model); - textContentService.updateByIdFilter(infoTextContent); + textContentService.updateById(infoTextContent); return question; } @@ -102,14 +98,14 @@ @Override public QuestionEditRequestVO getQuestionEditRequestVM(Integer questionId) { //棰樼洰鏄犲皠 - Question question = questionMapper.selectByPrimaryKey(questionId); + Question question = questionMapper.selectById(questionId); return getQuestionEditRequestVM(question); } @Override public QuestionEditRequestVO getQuestionEditRequestVM(Question question) { //棰樼洰鏄犲皠 - TextContent questionInfoTextContent = textContentService.selectById(question.getInfoTextContentId()); + TextContent questionInfoTextContent = textContentService.getById(question.getInfoTextContentId()); QuestionObject questionObject = JsonUtil.toJsonObject(questionInfoTextContent.getContent(), QuestionObject.class); QuestionEditRequestVO questionEditRequestVO = new QuestionEditRequestVO(); BeanUtils.copyProperties(question, questionEditRequestVO); -- Gitblit v1.8.0