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/controller/student/QuestionAnswerController.java |   16 +++++-----------
 1 files changed, 5 insertions(+), 11 deletions(-)

diff --git a/src/main/java/com/ycl/jxkg/controller/student/QuestionAnswerController.java b/src/main/java/com/ycl/jxkg/controller/student/QuestionAnswerController.java
index 755d6c1..c2b1bad 100644
--- a/src/main/java/com/ycl/jxkg/controller/student/QuestionAnswerController.java
+++ b/src/main/java/com/ycl/jxkg/controller/student/QuestionAnswerController.java
@@ -20,10 +20,12 @@
 import com.ycl.jxkg.vo.student.question.answer.QuestionPageStudentRequestVO;
 import com.ycl.jxkg.vo.student.question.answer.QuestionPageStudentResponseVO;
 import com.github.pagehelper.PageInfo;
+import lombok.RequiredArgsConstructor;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
+@RequiredArgsConstructor
 @RestController("StudentQuestionAnswerController")
 @RequestMapping(value = "/api/student/question/answer")
 public class QuestionAnswerController extends BaseApiController {
@@ -33,24 +35,16 @@
     private final TextContentService textContentService;
     private final SubjectService subjectService;
 
-    @Autowired
-    public QuestionAnswerController(ExamPaperQuestionCustomerAnswerService examPaperQuestionCustomerAnswerService, QuestionService questionService, TextContentService textContentService, SubjectService subjectService) {
-        this.examPaperQuestionCustomerAnswerService = examPaperQuestionCustomerAnswerService;
-        this.questionService = questionService;
-        this.textContentService = textContentService;
-        this.subjectService = subjectService;
-    }
-
     @RequestMapping(value = "/page", method = RequestMethod.POST)
     public Result<PageInfo<QuestionPageStudentResponseVO>> pageList(@RequestBody QuestionPageStudentRequestVO model) {
         model.setCreateUser(getCurrentUser().getId());
         PageInfo<ExamPaperQuestionCustomerAnswer> pageInfo = examPaperQuestionCustomerAnswerService.studentPage(model);
         PageInfo<QuestionPageStudentResponseVO> page = PageInfoHelper.copyMap(pageInfo, q -> {
-            Subject subject = subjectService.selectById(q.getSubjectId());
+            Subject subject = subjectService.getById(q.getSubjectId());
             QuestionPageStudentResponseVO vo = new QuestionPageStudentResponseVO();
             BeanUtils.copyProperties(q, vo);
             vo.setCreateTime(DateTimeUtil.dateFormat(q.getCreateTime()));
-            TextContent textContent = textContentService.selectById(q.getQuestionTextContentId());
+            TextContent textContent = textContentService.getById(q.getQuestionTextContentId());
             QuestionObject questionObject = JsonUtil.toJsonObject(textContent.getContent(), QuestionObject.class);
             String clearHtml = HtmlUtil.clear(questionObject.getTitleContent());
             vo.setShortTitle(clearHtml);
@@ -64,7 +58,7 @@
     @RequestMapping(value = "/select/{id}", method = RequestMethod.POST)
     public Result<QuestionAnswerVO> select(@PathVariable Integer id) {
         QuestionAnswerVO vm = new QuestionAnswerVO();
-        ExamPaperQuestionCustomerAnswer examPaperQuestionCustomerAnswer = examPaperQuestionCustomerAnswerService.selectById(id);
+        ExamPaperQuestionCustomerAnswer examPaperQuestionCustomerAnswer = examPaperQuestionCustomerAnswerService.getById(id);
         ExamPaperSubmitItemVO questionAnswerVM = examPaperQuestionCustomerAnswerService.examPaperQuestionCustomerAnswerToVM(examPaperQuestionCustomerAnswer);
         QuestionEditRequestVO questionVM = questionService.getQuestionEditRequestVM(examPaperQuestionCustomerAnswer.getQuestionId());
         vm.setQuestionVM(questionVM);

--
Gitblit v1.8.0