| | |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Optional; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Service |
| | |
| | | * 条件查询错题 |
| | | * */ |
| | | @Override |
| | | public WrongResponseVO page(WrongRequestVo wrongRequestVo) { |
| | | public WrongResponseVO list(WrongRequestVo wrongRequestVo) { |
| | | WrongResponseVO wrongResponseVO = new WrongResponseVO(); |
| | | // 查询该用户的所有考试 |
| | | List<ExamPaperScore> examPaperScores = examPaperScoreMapper.selectByUserId(wrongRequestVo.getUserId()); |
| | |
| | | List<DoQuestionVO> doQuestionVOS = questions.stream() |
| | | // 标题不为空或空字符串,模糊查询 |
| | | .filter(question -> { |
| | | if (wrongRequestVo.getTitle() == null || wrongRequestVo.getTitle().trim().equals("")) { |
| | | if (wrongRequestVo.getTitle() == null || wrongRequestVo.getTitle().trim().isEmpty()) { |
| | | return true; |
| | | } |
| | | return question.getTitle().toLowerCase().contains(wrongRequestVo.getTitle().toLowerCase()); |
| | | return Optional.ofNullable(question.getTitle()).orElse("").toLowerCase().contains(wrongRequestVo.getTitle().toLowerCase()); |
| | | }) |
| | | .filter(question -> { |
| | | if (wrongRequestVo.getQuestionType() == null) { |
| | |
| | | return question.getQuestionType().equals(wrongRequestVo.getQuestionType()); |
| | | }) |
| | | .filter(question -> { |
| | | if (wrongRequestVo.getExamName() == null || wrongRequestVo.getExamName().trim().equals("")) { |
| | | if (wrongRequestVo.getExamName() == null || wrongRequestVo.getExamName().trim().isEmpty()) { |
| | | return true; |
| | | } |
| | | return question.getExamName().toLowerCase().contains(wrongRequestVo.getExamName().toLowerCase()); |
| | | return Optional.ofNullable(question.getExamName()).orElse("").toLowerCase().contains(wrongRequestVo.getExamName().toLowerCase()); |
| | | }) |
| | | .collect(Collectors.toList()); |
| | | // 分页 |