| | |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * @author gonghl |
| | |
| | | new LambdaQueryChainWrapper<>(questionAnswerMapper) |
| | | .like(StringUtils.hasText(questionAnswerVO.getQuestion()), QuestionAnswer::getQuestion, questionAnswerVO.getQuestion()) |
| | | .or(StringUtils.hasText(questionAnswerVO.getQuestion()), wrapper -> wrapper.like(QuestionAnswer::getAnswer, questionAnswerVO.getQuestion())) |
| | | .orderByDesc(QuestionAnswer::getId) |
| | | .orderByAsc(QuestionAnswer::getSequence) |
| | | .list()); |
| | | } |
| | | |
| | |
| | | public List<QuestionAnswer> list() { |
| | | return new LambdaQueryChainWrapper<>(questionAnswerMapper) |
| | | .eq(QuestionAnswer::getStatus, QuestionAnswerStatusEnum.ENABLE.getCode()) |
| | | .orderByAsc(QuestionAnswer::getSequence) |
| | | .list(); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public Integer getLastSequence() { |
| | | QuestionAnswer one = new LambdaQueryChainWrapper<>(questionAnswerMapper) |
| | | .orderByDesc(QuestionAnswer::getSequence) |
| | | .last("limit 1") |
| | | .one(); |
| | | return Objects.isNull(one) ? 1 : one.getSequence() + 1; |
| | | } |
| | | |
| | | } |
| | | |
| | | |