From 3ec909b27b3eba956aa9d00cc7a94c179bd04bbf Mon Sep 17 00:00:00 2001 From: 龚焕茏 <2842157468@qq.com> Date: 星期三, 03 七月 2024 18:29:31 +0800 Subject: [PATCH] feat:新增随机时间题目配置 --- src/main/java/com/mindskip/xzs/controller/student/QuestionController.java | 47 ++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 46 insertions(+), 1 deletions(-) diff --git a/src/main/java/com/mindskip/xzs/controller/student/QuestionController.java b/src/main/java/com/mindskip/xzs/controller/student/QuestionController.java index a597bd6..b6d6095 100644 --- a/src/main/java/com/mindskip/xzs/controller/student/QuestionController.java +++ b/src/main/java/com/mindskip/xzs/controller/student/QuestionController.java @@ -1,7 +1,14 @@ package com.mindskip.xzs.controller.student; +import com.github.pagehelper.PageInfo; import com.mindskip.xzs.base.BaseApiController; +import com.mindskip.xzs.base.RestResponse; import com.mindskip.xzs.service.QuestionService; +import com.mindskip.xzs.service.SubjectService; +import com.mindskip.xzs.viewmodel.admin.question.ExamQuestionVO; +import com.mindskip.xzs.viewmodel.student.question.answer.QuestionAnswerVO; +import com.mindskip.xzs.viewmodel.student.question.answer.QuestionPageStudentRequestVM; +import com.mindskip.xzs.viewmodel.student.question.answer.QuestionPageStudentResponseVM; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -10,9 +17,47 @@ public class QuestionController extends BaseApiController { private final QuestionService questionService; + private final SubjectService subjectService; @Autowired - public QuestionController(QuestionService questionService) { + public QuestionController(QuestionService questionService, SubjectService subjectService) { this.questionService = questionService; + this.subjectService = subjectService; } + + @RequestMapping(value = "/select/question", method = RequestMethod.POST) + public RestResponse<PageInfo<QuestionPageStudentResponseVM>> selectQuestion(@RequestBody QuestionPageStudentRequestVM model) { + return RestResponse.ok(questionService.selectQuestion(model)); + } + + @RequestMapping(value = "/select/question/{id}", method = RequestMethod.GET) + public RestResponse<QuestionAnswerVO> selectQuestionById(@PathVariable Integer id) { + QuestionAnswerVO vm = new QuestionAnswerVO(); + ExamQuestionVO question = questionService.getQuestionEditRequestVM(id); + vm.setQuestionVM(question); + return RestResponse.ok(vm); + } + + /** + * 鏌ヨ棰樼洰鍐呭 + * + * @param id + * @return + */ + @GetMapping("/{id}") + public RestResponse getContentById(@PathVariable("id") Integer id) { + return questionService.selectContentById(id); + } + + /** + * 鑾峰彇棰樼洰绛旀 + * + * @param id + * @return + */ + @GetMapping("/answer/{id}") + public RestResponse getAnswer(@PathVariable("id") Integer id) { + return questionService.getAnswer(id); + } + } -- Gitblit v1.8.0