错题修改
This commit is contained in:
parent
93f8534643
commit
6e3ae11687
|
|
@ -47,6 +47,7 @@ public class ApiPracticeController extends BaseController {
|
|||
|
||||
/**
|
||||
* 查询练习具体的问题列表
|
||||
*
|
||||
* @param map
|
||||
* @return
|
||||
*/
|
||||
|
|
@ -63,19 +64,15 @@ public class ApiPracticeController extends BaseController {
|
|||
|
||||
/**
|
||||
* 保存错题记录
|
||||
*
|
||||
* @param questionId
|
||||
* @return
|
||||
* @description 练习时答错题就保存到错题记录中
|
||||
* 传入问题id
|
||||
* @param answers
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/v1/practice/answer")
|
||||
public AjaxResult answer(@RequestBody List<Map<String,Object>> answers) {
|
||||
int error = 0;
|
||||
for (Map<String, Object> answer : answers) {
|
||||
String questionId = answer.get("questionId").toString();
|
||||
String userAnswer = answer.get("userAnswer").toString();
|
||||
ExamQuestion examQuestion = examQuestionService.selectById(questionId);
|
||||
if(!examQuestion.getAnswer().equals(userAnswer)){
|
||||
public AjaxResult answer(String questionId) {
|
||||
|
||||
ExamUserErrorQuestion examUserErrorQuestion = new ExamUserErrorQuestion();
|
||||
examUserErrorQuestion.setExamQuestionId(Integer.parseInt(questionId));
|
||||
examUserErrorQuestion.setVipUserId(Integer.parseInt(ShiroUtils.getUserId().toString()));
|
||||
|
|
@ -83,19 +80,18 @@ public class ApiPracticeController extends BaseController {
|
|||
examUserErrorQuestion.setCreateDate(new Date());
|
||||
examUserErrorQuestion.setDelFlag("0");
|
||||
examUserErrorQuestionService.insert(examUserErrorQuestion);
|
||||
error++;
|
||||
}
|
||||
}
|
||||
AjaxResult success = success(error+"题进入错题本");
|
||||
|
||||
AjaxResult success = success("插入错题本成功");
|
||||
return success;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询我的错题列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/v1/practice/{userId}/error")
|
||||
public AjaxResult answer(@PathVariable("userId") String userId) {
|
||||
public AjaxResult queryError(@PathVariable("userId") String userId) {
|
||||
ExamUserErrorQuestion examUserErrorQuestion = new ExamUserErrorQuestion();
|
||||
examUserErrorQuestion.setVipUserId(Integer.parseInt(ShiroUtils.getUserId().toString()));
|
||||
List<ExamUserErrorQuestionVO> list = examUserErrorQuestionService.selectExamUserErrorQuestionDetailPage(examUserErrorQuestion);
|
||||
|
|
@ -106,6 +102,7 @@ public class ApiPracticeController extends BaseController {
|
|||
|
||||
/**
|
||||
* 查询问题详情
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
|
|
|
|||
Loading…
Reference in New Issue