feat:错题列表

pg_adapter
wangxy 9 months ago
parent 8744687b1d
commit 5892979b10

@ -1,7 +1,11 @@
package com.ruoyi.web.controller.exam;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.exam.dto.ExamDTO;
import com.ruoyi.system.domain.userbook.dto.UserBookDTO;
import com.ruoyi.web.controller.manager.UserBookManager;
import io.swagger.annotations.Api;
@ -59,5 +63,13 @@ public class UserBookController extends BaseController {
}
@ApiOperation("查找列表")
@PostMapping("/next")
@ResponseBody
public AjaxResult next(@RequestBody UserBookDTO reqDTO) {
return AjaxResult.success(userBookManager.findNext(reqDTO.getExamId(),reqDTO.getQuId()));
}
}

@ -9,6 +9,7 @@ import com.ruoyi.system.domain.userbook.dto.UserBookDTO;
import com.ruoyi.system.service.ElQuService;
import com.ruoyi.system.service.ElUserBookService;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;
import javax.annotation.Resource;
import java.util.Date;
@ -96,6 +97,34 @@ public class UserBookManager {
}
public String findNext(String examId, String quId) {
Integer sort = 999999;
if(Objects.nonNull(quId)){
QueryWrapper<ElUserBook> wrapper = new QueryWrapper<>();
wrapper.lambda()
.eq(ElUserBook::getUserId, ShiroUtils.getUserId())
.eq(ElUserBook::getExamId, examId)
.eq(ElUserBook::getQuId, quId);
wrapper.last(" ORDER BY `sort` DESC");
ElUserBook last = userBookService.getOne(wrapper, false);
if(last!=null){
sort = last.getSort();
}
}
QueryWrapper<ElUserBook> wrapper = new QueryWrapper<>();
wrapper.lambda()
.eq(ElUserBook::getUserId, ShiroUtils.getUserId())
.eq(ElUserBook::getExamId, examId)
.lt(ElUserBook::getSort, sort);
wrapper.last(" ORDER BY `sort` DESC");
ElUserBook next = userBookService.getOne(wrapper, false);
if(next != null){
return next.getQuId();
}
return null;
}

Loading…
Cancel
Save