| | |
| | | |
| | | @Override |
| | | public PageInfo<QuestionPageStudentResponseVM> selectQuestion(QuestionPageStudentRequestVM model) { |
| | | return PageHelper.startPage(model.getPageIndex(), model.getPageSize(), "id desc").doSelectPageInfo(() -> |
| | | return PageHelper.startPage(model.getPageIndex(), model.getPageSize()).doSelectPageInfo(() -> |
| | | questionMapper.selectQuestion(model).stream().peek( |
| | | q -> q.setShortTitle(HtmlUtil.clear(q.getShortTitle())) |
| | | ).collect(Collectors.toList()) |
| | |
| | | |
| | | @Override |
| | | public RestResponse selectContentById(Integer id) { |
| | | QuestionVO vo = questionMapper.selectContentById(id); |
| | | jsonQuestion(vo); |
| | | return RestResponse.ok(vo); |
| | | QuestionVO questionVO = questionMapper.selectContentById(id); |
| | | jsonQuestion(questionVO); |
| | | if (QuestionTypeEnum.MultipleChoice.getCode().equals(questionVO.getQuestionType())) { |
| | | // 多选题需要返回答案数量,学员选中对应数量才查询答案 |
| | | if (StringUtils.hasText(questionVO.getCorrect())) { |
| | | questionVO.setAnswerNum(questionVO.getCorrect().split(",").length); |
| | | } |
| | | } |
| | | questionVO.setContentJson(""); |
| | | questionVO.setCorrect(""); |
| | | questionVO.getContent().setCorrect(""); |
| | | questionVO.getContent().setAnalyze(""); |
| | | return RestResponse.ok(questionVO); |
| | | } |
| | | |
| | | @Override |
| | | public RestResponse getAnswer(Integer id) { |
| | | String content = questionMapper.getAnswer(id); |
| | | if (StringUtils.hasText(content)) { |
| | | QuestionContentVO vo = JSON.parseObject(content, QuestionContentVO.class); |
| | | QuestionVO questionVO = questionMapper.getAnswer(id); |
| | | if (Objects.nonNull(questionVO) && StringUtils.hasText(questionVO.getCorrect())) { |
| | | QuestionContentVO vo = JSON.parseObject(questionVO.getContentJson(), QuestionContentVO.class); |
| | | vo.setQuestionItemObjects(null); |
| | | vo.setTitleContent(null); |
| | | vo.setCorrect(questionVO.getCorrect()); |
| | | return RestResponse.ok(vo); |
| | | } |
| | | return RestResponse.ok(null); |