feat:添加判断

pg_adapter
wangxy 9 months ago
parent 4afe249ce4
commit ee4181f1eb

@ -109,6 +109,16 @@ public class PaperController extends BaseController {
}
@ApiOperation("检测进行中的考试")
@GetMapping("/checkProcess")
@ResponseBody
public AjaxResult checkProcess() {
return AjaxResult.success(paperManager.checkProcess(getUserId()));
}

@ -15,6 +15,7 @@ import com.ruoyi.system.domain.exam.enums.ExamState;
import com.ruoyi.system.domain.paper.ElPaper;
import com.ruoyi.system.domain.paper.ElPaperQu;
import com.ruoyi.system.domain.paper.ElPaperQuAnswer;
import com.ruoyi.system.domain.paper.dto.PaperDTO;
import com.ruoyi.system.domain.paper.dto.PaperQuDTO;
import com.ruoyi.system.domain.paper.dto.ext.PaperQuAnswerExtDTO;
import com.ruoyi.system.domain.paper.dto.ext.PaperQuDetailDTO;
@ -495,5 +496,18 @@ public class PaperManager {
}
public PaperDTO checkProcess(Long userId) {
QueryWrapper<ElPaper> wrapper = new QueryWrapper<>();
wrapper.lambda()
.eq(ElPaper::getUserId, userId)
.eq(ElPaper::getState, PaperState.ING);
ElPaper paper = paperService.getOne(wrapper, false);
if (Objects.nonNull(paper)) {
return Convert.convert(PaperDTO.class, paper);
}
return null;
}
}

Loading…
Cancel
Save