From c9d04bc519b73f7fc4841c34e2f15fca9db7aad2 Mon Sep 17 00:00:00 2001 From: xiangpei <xiangpei@timesnew.cn> Date: 星期五, 31 五月 2024 14:08:30 +0800 Subject: [PATCH] 重构:service、mapper plus化,xml删除多余sql --- src/main/java/com/ycl/jxkg/service/impl/ExamPaperQuestionCustomerAnswerServiceImpl.java | 16 ++++++---------- 1 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/ycl/jxkg/service/impl/ExamPaperQuestionCustomerAnswerServiceImpl.java b/src/main/java/com/ycl/jxkg/service/impl/ExamPaperQuestionCustomerAnswerServiceImpl.java index bad9048..98aab39 100644 --- a/src/main/java/com/ycl/jxkg/service/impl/ExamPaperQuestionCustomerAnswerServiceImpl.java +++ b/src/main/java/com/ycl/jxkg/service/impl/ExamPaperQuestionCustomerAnswerServiceImpl.java @@ -1,5 +1,6 @@ package com.ycl.jxkg.service.impl; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.ycl.jxkg.domain.ExamPaperQuestionCustomerAnswer; import com.ycl.jxkg.domain.other.ExamPaperAnswerUpdate; import com.ycl.jxkg.domain.other.KeyValue; @@ -15,6 +16,7 @@ import com.ycl.jxkg.vo.student.question.answer.QuestionPageStudentRequestVO; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; +import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -23,17 +25,11 @@ import java.util.stream.Collectors; @Service -public class ExamPaperQuestionCustomerAnswerServiceImpl extends BaseServiceImpl<ExamPaperQuestionCustomerAnswer> implements ExamPaperQuestionCustomerAnswerService { +@RequiredArgsConstructor +public class ExamPaperQuestionCustomerAnswerServiceImpl extends ServiceImpl<ExamPaperQuestionCustomerAnswerMapper, ExamPaperQuestionCustomerAnswer> implements ExamPaperQuestionCustomerAnswerService { private final ExamPaperQuestionCustomerAnswerMapper examPaperQuestionCustomerAnswerMapper; private final TextContentService textContentService; - - @Autowired - public ExamPaperQuestionCustomerAnswerServiceImpl(ExamPaperQuestionCustomerAnswerMapper examPaperQuestionCustomerAnswerMapper, TextContentService textContentService) { - super(examPaperQuestionCustomerAnswerMapper); - this.examPaperQuestionCustomerAnswerMapper = examPaperQuestionCustomerAnswerMapper; - this.textContentService = textContentService; - } @Override @@ -97,13 +93,13 @@ examPaperSubmitItemVO.setContentArray(ExamUtil.contentToArray(examPaperQuestionCustomerAnswer.getAnswer())); break; case GapFilling: - TextContent textContent = textContentService.selectById(examPaperQuestionCustomerAnswer.getTextContentId()); + TextContent textContent = textContentService.getById(examPaperQuestionCustomerAnswer.getTextContentId()); List<String> correctAnswer = JsonUtil.toJsonListObject(textContent.getContent(), String.class); examPaperSubmitItemVO.setContentArray(correctAnswer); break; default: if (QuestionTypeEnum.needSaveTextContent(examPaperQuestionCustomerAnswer.getQuestionType())) { - TextContent content = textContentService.selectById(examPaperQuestionCustomerAnswer.getTextContentId()); + TextContent content = textContentService.getById(examPaperQuestionCustomerAnswer.getTextContentId()); examPaperSubmitItemVO.setContent(content.getContent()); } else { examPaperSubmitItemVO.setContent(examPaperQuestionCustomerAnswer.getAnswer()); -- Gitblit v1.8.0