|
|
@@ -12,11 +12,13 @@ import cn.reghao.tnb.content.api.constant.VideoStatus;
|
|
|
import cn.reghao.tnb.content.api.dto.UserVideoPost;
|
|
|
import cn.reghao.tnb.content.api.dto.VideoCard;
|
|
|
import cn.reghao.tnb.content.api.dto.VideoPostCard;
|
|
|
+import cn.reghao.tnb.content.app.vod.db.mapper.VideoCategoryPostMapper;
|
|
|
import cn.reghao.tnb.content.app.vod.db.mapper.VideoPostMapper;
|
|
|
import cn.reghao.tnb.content.app.vod.db.mapper.VideoStatisticMapper;
|
|
|
import cn.reghao.tnb.content.app.vod.db.mapper.VideoTagMapper;
|
|
|
import cn.reghao.tnb.content.app.vod.model.po.VideoCategory;
|
|
|
import cn.reghao.tnb.content.app.vod.model.po.VideoPost;
|
|
|
+import cn.reghao.tnb.content.app.vod.model.po.VideoCategoryPost;
|
|
|
import cn.reghao.tnb.content.app.vod.model.po.VideoStatistic;
|
|
|
import cn.reghao.tnb.content.api.dto.BannerVideo;
|
|
|
import cn.reghao.tnb.content.app.vod.model.vo.VideoDetail;
|
|
|
@@ -49,16 +51,18 @@ public class VideoPostQueryImpl implements VideoPostQuery {
|
|
|
private final int pageSize = 12;
|
|
|
private final VideoPostMapper videoPostMapper;
|
|
|
private final VideoStatisticMapper videoStatisticMapper;
|
|
|
+ private final VideoCategoryPostMapper videoCategoryPostMapper;
|
|
|
private final VideoTagMapper videoTagMapper;
|
|
|
private final ContentPermission contentPermission;
|
|
|
private final CategoryService categoryService;
|
|
|
|
|
|
public VideoPostQueryImpl(VideoPostMapper videoPostMapper, VideoTagMapper videoTagMapper,
|
|
|
- VideoStatisticMapper videoStatisticMapper, ContentPermission contentPermission,
|
|
|
- CategoryService categoryService) {
|
|
|
+ VideoStatisticMapper videoStatisticMapper, VideoCategoryPostMapper videoCategoryPostMapper,
|
|
|
+ ContentPermission contentPermission, CategoryService categoryService) {
|
|
|
this.videoPostMapper = videoPostMapper;
|
|
|
this.videoTagMapper = videoTagMapper;
|
|
|
this.videoStatisticMapper = videoStatisticMapper;
|
|
|
+ this.videoCategoryPostMapper = videoCategoryPostMapper;
|
|
|
this.contentPermission = contentPermission;
|
|
|
this.categoryService = categoryService;
|
|
|
}
|
|
|
@@ -110,17 +114,22 @@ public class VideoPostQueryImpl implements VideoPostQuery {
|
|
|
}
|
|
|
|
|
|
private PageList<VideoCard> getVideoCardsByUserGroup(VideoQuery videoQuery, int pageNumber) {
|
|
|
- int total = videoPostMapper.countByCriteriaAndUserGroup(videoQuery).size();
|
|
|
+ // int total = videoPostMapper.countByCriteriaAndUserGroup(videoQuery).size();
|
|
|
+ int total = videoCategoryPostMapper.countByCriteria(videoQuery);
|
|
|
if (total > pageSize*100) {
|
|
|
total = pageSize*100;
|
|
|
-
|
|
|
if (pageNumber > 100) {
|
|
|
pageNumber = 100;
|
|
|
}
|
|
|
+ } else if (total == 0) {
|
|
|
+ return PageList.empty();
|
|
|
}
|
|
|
|
|
|
Page page = new Page(pageNumber, pageSize);
|
|
|
- List<VideoPostCard> list = videoPostMapper.findCriteriaAndUserGroupByPage(page, videoQuery);
|
|
|
+ //List<VideoPostCard> list = videoPostMapper.findCriteriaAndUserGroupByPage(page, videoQuery);
|
|
|
+ List<VideoCategoryPost> list0 = videoCategoryPostMapper.findVideoCategoryPostByPage(page, videoQuery);
|
|
|
+ List<String> videoIds = list0.stream().map(VideoCategoryPost::getVideoId).collect(Collectors.toList());
|
|
|
+ List<VideoPostCard> list = videoPostMapper.findVideoCardByVideoIds(videoIds);
|
|
|
List<VideoCard> list1 = list.stream()
|
|
|
.map(videoPostCard -> getVideoCard(videoPostCard, true))
|
|
|
.collect(Collectors.toList());
|