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.domain.ExamPaperQuestionCustomerAnswer;
|
import com.mindskip.xzs.service.*;
|
import com.mindskip.xzs.viewmodel.admin.question.ExamQuestionVO;
|
import com.mindskip.xzs.viewmodel.student.exam.ExamPaperSubmitItemVM;
|
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.*;
|
|
@RestController("StudentQuestionAnswerController")
|
@RequestMapping(value = "/api/student/question/answer")
|
public class QuestionAnswerController extends BaseApiController {
|
|
private final ExamPaperQuestionCustomerAnswerService examPaperQuestionCustomerAnswerService;
|
private final QuestionService questionService;
|
private final TextContentService textContentService;
|
private final SubjectService subjectService;
|
private final QuestionSubjectService questionSubjectService;
|
|
@Autowired
|
public QuestionAnswerController(ExamPaperQuestionCustomerAnswerService examPaperQuestionCustomerAnswerService, QuestionService questionService, TextContentService textContentService, SubjectService subjectService, QuestionSubjectService questionSubjectService) {
|
this.examPaperQuestionCustomerAnswerService = examPaperQuestionCustomerAnswerService;
|
this.questionService = questionService;
|
this.textContentService = textContentService;
|
this.subjectService = subjectService;
|
this.questionSubjectService = questionSubjectService;
|
}
|
|
@RequestMapping(value = "/page", method = RequestMethod.POST)
|
public RestResponse<PageInfo<QuestionPageStudentResponseVM>> pageList(@RequestBody QuestionPageStudentRequestVM model) {
|
model.setCreateUser(getCurrentUser().getId());
|
PageInfo<QuestionPageStudentResponseVM> pageInfo = examPaperQuestionCustomerAnswerService.studentPage(model);
|
return RestResponse.ok(pageInfo);
|
}
|
|
|
@RequestMapping(value = "/select/{id}", method = RequestMethod.POST)
|
public RestResponse<QuestionAnswerVO> select(@PathVariable Integer id) {
|
QuestionAnswerVO vm = new QuestionAnswerVO();
|
ExamPaperQuestionCustomerAnswer examPaperQuestionCustomerAnswer = examPaperQuestionCustomerAnswerService.selectById(id);
|
ExamPaperSubmitItemVM questionAnswerVM = examPaperQuestionCustomerAnswerService.examPaperQuestionCustomerAnswerToVM(examPaperQuestionCustomerAnswer);
|
ExamQuestionVO questionVM = questionService.getQuestionEditRequestVM(examPaperQuestionCustomerAnswer.getQuestionId());
|
vm.setQuestionVM(questionVM);
|
vm.setQuestionAnswerVM(questionAnswerVM);
|
return RestResponse.ok(vm);
|
}
|
|
}
|