package com.mindskip.xzs.controller.student; import com.mindskip.xzs.base.BaseApiController; import com.mindskip.xzs.base.RestResponse; import com.mindskip.xzs.domain.User; import com.mindskip.xzs.service.ExamTemplatesService; import com.mindskip.xzs.viewmodel.admin.exam.ExamPaperEditRequestVM; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; @RestController("StudentExamTemplatesController") @RequestMapping(value = "/api/student/exam/templates") public class ExamTemplatesController extends BaseApiController { private final ExamTemplatesService examTemplatesService; public ExamTemplatesController(ExamTemplatesService examTemplatesService) { this.examTemplatesService = examTemplatesService; } @RequestMapping(value = "/add", method = RequestMethod.GET) public RestResponse select() throws Exception { User currentUser = getCurrentUser(); return RestResponse.ok(examTemplatesService.randomExam(currentUser)); } @RequestMapping(value = "/addTemplates/{id}", method = RequestMethod.GET) public RestResponse select(@PathVariable("id") Integer id) throws Exception { User currentUser = getCurrentUser(); return RestResponse.ok(examTemplatesService.randomExam1(currentUser, id)); } }