fuliqi
2024-06-07 0879a157fd7c85ec34f1dac51a2b113bf1f5f2f6
src/main/java/com/ycl/jxkg/controller/admin/ExamPaperAnswerController.java
@@ -3,11 +3,14 @@
import com.github.pagehelper.PageInfo;
import com.ycl.jxkg.base.BaseApiController;
import com.ycl.jxkg.base.Result;
import com.ycl.jxkg.domain.entity.ExamPaperAnswer;
import com.ycl.jxkg.domain.vo.admin.exam.ExamPaperEditRequestVO;
import com.ycl.jxkg.domain.vo.admin.paper.ExamPaperAnswerPageRequestVO;
import com.ycl.jxkg.domain.vo.student.exam.ExamPaperReadVO;
import com.ycl.jxkg.domain.vo.student.exam.ExamPaperSubmitVO;
import com.ycl.jxkg.domain.vo.student.exampaper.ExamPaperAnswerPageResponseVO;
import com.ycl.jxkg.service.ExamPaperAnswerService;
import com.ycl.jxkg.service.SubjectService;
import com.ycl.jxkg.service.UserService;
import com.ycl.jxkg.service.ExamPaperService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
@@ -17,8 +20,7 @@
public class ExamPaperAnswerController extends BaseApiController {
    private final ExamPaperAnswerService examPaperAnswerService;
    private final SubjectService subjectService;
    private final UserService userService;
    private final ExamPaperService examPaperService;
    @PostMapping("/pageExamPaper")
    public Result<PageInfo<ExamPaperAnswerPageResponseVO>> pageExamPaper(@RequestBody ExamPaperAnswerPageRequestVO model) {
@@ -30,5 +32,15 @@
        return Result.ok(examPaperAnswerService.adminPage(model));
    }
    @PostMapping("/read/{id}")
    public Result<ExamPaperReadVO> read(@PathVariable Integer id) {
        ExamPaperAnswer examPaperAnswer = examPaperAnswerService.getById(id);
        ExamPaperReadVO vm = new ExamPaperReadVO();
        ExamPaperEditRequestVO paper = examPaperService.examPaperToVM(examPaperAnswer.getExamPaperId());
        ExamPaperSubmitVO answer = examPaperAnswerService.examPaperAnswerToVM(examPaperAnswer.getId());
        vm.setPaper(paper);
        vm.setAnswer(answer);
        return Result.ok(vm);
    }
}