|
@@ -38,8 +38,7 @@ public class VideoArticleMatchServiceImpl implements VideoArticleMatchService {
|
|
|
if (!StringUtils.hasText(dt)) {
|
|
if (!StringUtils.hasText(dt)) {
|
|
|
log.info("video_article_match_result 表为空,返回空结果");
|
|
log.info("video_article_match_result 表为空,返回空结果");
|
|
|
return PageResult.of(
|
|
return PageResult.of(
|
|
|
- java.util.Collections.emptyList(), 0,
|
|
|
|
|
- param.getPageNum() != null ? param.getPageNum() : 1,
|
|
|
|
|
|
|
+ java.util.Collections.emptyList(), 0, 1,
|
|
|
param.getPageSize() != null ? param.getPageSize() : 20);
|
|
param.getPageSize() != null ? param.getPageSize() : 20);
|
|
|
}
|
|
}
|
|
|
log.info("dt 未传,自动取最大 dt={}", dt);
|
|
log.info("dt 未传,自动取最大 dt={}", dt);
|
|
@@ -57,13 +56,17 @@ public class VideoArticleMatchServiceImpl implements VideoArticleMatchService {
|
|
|
// 按创建时间倒序
|
|
// 按创建时间倒序
|
|
|
example.setOrderByClause("create_time DESC");
|
|
example.setOrderByClause("create_time DESC");
|
|
|
|
|
|
|
|
- int pageNum = param.getPageNum() != null ? param.getPageNum() : 1;
|
|
|
|
|
- int pageSize = param.getPageSize() != null ? param.getPageSize() : 20;
|
|
|
|
|
-
|
|
|
|
|
- PageHelper.startPage(pageNum, pageSize);
|
|
|
|
|
- List<VideoArticleMatchResult> list = videoArticleMatchResultMapper.selectByExample(example);
|
|
|
|
|
- PageInfo<VideoArticleMatchResult> pageInfo = new PageInfo<>(list);
|
|
|
|
|
-
|
|
|
|
|
- return PageResult.of(list, pageInfo.getTotal(), pageNum, pageSize);
|
|
|
|
|
|
|
+ // 分页参数可选:不传则查询全部
|
|
|
|
|
+ boolean hasPagination = param.getPageNum() != null && param.getPageSize() != null;
|
|
|
|
|
+ if (hasPagination) {
|
|
|
|
|
+ PageHelper.startPage(param.getPageNum(), param.getPageSize());
|
|
|
|
|
+ List<VideoArticleMatchResult> list = videoArticleMatchResultMapper.selectByExample(example);
|
|
|
|
|
+ PageInfo<VideoArticleMatchResult> pageInfo = new PageInfo<>(list);
|
|
|
|
|
+ return PageResult.of(list, pageInfo.getTotal(), param.getPageNum(), param.getPageSize());
|
|
|
|
|
+ } else {
|
|
|
|
|
+ List<VideoArticleMatchResult> list = videoArticleMatchResultMapper.selectByExample(example);
|
|
|
|
|
+ log.info("未传分页参数,返回全部 {} 条记录", list.size());
|
|
|
|
|
+ return PageResult.of(list, list.size(), 1, list.size());
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|