|
@@ -1,10 +1,12 @@
|
|
|
package nju.seec.helper.controller;
|
|
package nju.seec.helper.controller;
|
|
|
|
|
|
|
|
|
|
+import com.fasterxml.jackson.core.JsonProcessingException;
|
|
|
import nju.seec.helper.aspect.auth.Auth;
|
|
import nju.seec.helper.aspect.auth.Auth;
|
|
|
import nju.seec.helper.controller.response.PageResponse;
|
|
import nju.seec.helper.controller.response.PageResponse;
|
|
|
import nju.seec.helper.dao.CourseDAO;
|
|
import nju.seec.helper.dao.CourseDAO;
|
|
|
import nju.seec.helper.dao.SlideDAO;
|
|
import nju.seec.helper.dao.SlideDAO;
|
|
|
import nju.seec.helper.dto.LoginUser;
|
|
import nju.seec.helper.dto.LoginUser;
|
|
|
|
|
+import nju.seec.helper.service.QuestionService;
|
|
|
import nju.seec.helper.util.enums.QuizState;
|
|
import nju.seec.helper.util.enums.QuizState;
|
|
|
import nju.seec.helper.util.enums.SlideState;
|
|
import nju.seec.helper.util.enums.SlideState;
|
|
|
import nju.seec.helper.util.enums.UserType;
|
|
import nju.seec.helper.util.enums.UserType;
|
|
@@ -15,6 +17,7 @@ import nju.seec.helper.vo.quiz.QuestionVO;
|
|
|
import nju.seec.helper.vo.quiz.QuizVO;
|
|
import nju.seec.helper.vo.quiz.QuizVO;
|
|
|
import nju.seec.helper.vo.quiz.TrueOrFalseQuestionVO;
|
|
import nju.seec.helper.vo.quiz.TrueOrFalseQuestionVO;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
+import org.springframework.data.domain.Page;
|
|
|
import org.springframework.data.domain.Pageable;
|
|
import org.springframework.data.domain.Pageable;
|
|
|
import org.springframework.data.web.PageableDefault;
|
|
import org.springframework.data.web.PageableDefault;
|
|
|
import org.springframework.expression.ParseException;
|
|
import org.springframework.expression.ParseException;
|
|
@@ -37,18 +40,19 @@ public class QuestionController {
|
|
|
private CourseDAO courseDAO;
|
|
private CourseDAO courseDAO;
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private SlideDAO slideDAO;
|
|
private SlideDAO slideDAO;
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private QuestionService questionService;
|
|
|
/**
|
|
/**
|
|
|
* 获得题目列表
|
|
* 获得题目列表
|
|
|
*/
|
|
*/
|
|
|
- @Auth(roles = {UserType.TEACHER}, message = "获得题目列表")
|
|
|
|
|
|
|
+// @Auth(roles = {UserType.TEACHER}, message = "获得题目列表")
|
|
|
@GetMapping("")
|
|
@GetMapping("")
|
|
|
- public Map getQuestionList(LoginUser user, String stem, @PageableDefault(Integer.MAX_VALUE) Pageable pageable) {
|
|
|
|
|
- List<QuestionVO> Questions=new ArrayList<>();
|
|
|
|
|
- Questions.add(ChoiceQ());
|
|
|
|
|
- Questions.add(TFQ());
|
|
|
|
|
|
|
+ public Map getQuestionList(LoginUser user, String stem,@PageableDefault(Integer.MAX_VALUE) Pageable pageable) throws JsonProcessingException {
|
|
|
|
|
+
|
|
|
|
|
+ final Page<QuestionVO> questionList = questionService.getQuestionList(user, stem, pageable);
|
|
|
Map ret=new LinkedHashMap(2);
|
|
Map ret=new LinkedHashMap(2);
|
|
|
- ret.put("questions",Questions);
|
|
|
|
|
- ret.put("page",PageResponse.PageInfo.of(1,5,1,1));
|
|
|
|
|
|
|
+ ret.put("questions",questionList.getContent());
|
|
|
|
|
+ ret.put("page",questionList.getPageable());
|
|
|
return ret;
|
|
return ret;
|
|
|
}
|
|
}
|
|
|
|
|
|