|
|
@@ -44,7 +44,7 @@ public class QuestionController {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 某一测试的题目
|
|
|
+ * 获取某一测试题目
|
|
|
*/
|
|
|
@Auth(roles = {UserType.TEACHER, UserType.STUDENT}, message = "获得测试题目")
|
|
|
@GetMapping("/quiz/{quizId}")
|
|
|
@@ -52,30 +52,45 @@ public class QuestionController {
|
|
|
return questionService.getQuestionsByQuiz(user, quizId);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 获取某一题目信息
|
|
|
+ */
|
|
|
@Auth(roles = UserType.TEACHER, message = "获取题目信息")
|
|
|
@GetMapping("/{questionId}")
|
|
|
public BaseQuestionVO getOneQuestion(LoginUser user, @PathVariable String questionId) {
|
|
|
return questionService.getOneQuestion(user, questionId);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 创建题目
|
|
|
+ */
|
|
|
@Auth(roles = UserType.TEACHER, message = "创建题目")
|
|
|
@PostMapping
|
|
|
public BaseQuestionVO createQuestion(LoginUser user, @Validated(Create.class) @RequestBody BaseQuestionDTO baseQuestionDTO) {
|
|
|
return questionService.createQuestion(user, baseQuestionDTO);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 修改题目
|
|
|
+ */
|
|
|
@Auth(roles = UserType.TEACHER, message = "修改题目")
|
|
|
@PutMapping("/{questionId}")
|
|
|
public BaseQuestionVO modifyQuestion(LoginUser user, @PathVariable String questionId, @Validated(Modify.class) @RequestBody BaseQuestionDTO baseQuestionDTO) {
|
|
|
return questionService.modifyQuestion(user, questionId, baseQuestionDTO);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 删除题目
|
|
|
+ */
|
|
|
@Auth(roles = UserType.TEACHER, message = "删除题目")
|
|
|
@DeleteMapping("/{questionId}")
|
|
|
public void deleteQuestion(LoginUser user, @PathVariable String questionId) {
|
|
|
questionService.deleteQuestion(user, questionId);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 获取创建题目
|
|
|
+ */
|
|
|
@Auth(roles = UserType.TEACHER, message = "获取创建的题目")
|
|
|
@GetMapping("/created")
|
|
|
public PageResponse<BaseQuestionVO> getCreatedQuestions(LoginUser user,
|
|
|
@@ -83,6 +98,9 @@ public class QuestionController {
|
|
|
return PageResponse.of(questionService.getCreatedQuestions(user, pageable));
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 获取创建题目ID
|
|
|
+ */
|
|
|
@Auth(roles = UserType.TEACHER)
|
|
|
@GetMapping("/created/ids")
|
|
|
public Set<String> getCreatedQuestionIds(LoginUser user) {
|