Search in sources :

Example 1 with VideoVO

use of org.saxing.a0041_wemedia.domain.vo.VideoVO in project java-example by saxingz.

the class VideoController method listVideos.

/**
 * 查看原始视频
 */
@ApiOperation("查看原始视频")
@ApiImplicitParams({ @ApiImplicitParam(name = "page", value = "页码", defaultValue = "1"), @ApiImplicitParam(name = "pageNum", value = "每页条数", defaultValue = "1") })
@PostMapping("/list")
public Page<VideoVO> listVideos(@RequestBody VideoDO video, @RequestParam @Min(value = 1, message = "页码不得少于1") Integer page, @RequestParam @Min(value = 1, message = "每页条数不得少于1") @Max(value = 100, message = "每页条数不大于100") Integer pageNum) {
    LambdaQueryWrapper<VideoDO> queryWrapper = Wrappers.lambdaQuery();
    queryWrapper.setEntity(video);
    queryWrapper.like(StringUtils.isNotBlank(video.getChannelId()), VideoDO::getChannelId, video.getChannelId());
    queryWrapper.like(StringUtils.isNotBlank(video.getChannelTitle()), VideoDO::getChannelTitle, video.getChannelTitle());
    queryWrapper.like(StringUtils.isNotBlank(video.getVideoId()), VideoDO::getVideoId, video.getVideoId());
    queryWrapper.like(StringUtils.isNotBlank(video.getVideoTitle()), VideoDO::getVideoTitle, video.getVideoTitle());
    queryWrapper.like(StringUtils.isNotBlank(video.getDescription()), VideoDO::getDescription, video.getDescription());
    queryWrapper.like(StringUtils.isNotBlank(video.getDownloadedUrl()), VideoDO::getDownloadedUrl, video.getDownloadedUrl());
    video.setChannelId(null).setChannelTitle(null).setVideoId(null).setVideoTitle(null).setDescription(null).setDownloadedUrl(null);
    Page<VideoDO> videoDOPage = videoLogic.page(new Page<>(page, pageNum), queryWrapper).addOrder(OrderItem.desc(TableInfoHelper.getTableInfo(VideoDO.class).getKeyProperty()));
    Page<VideoVO> result = beanMapper.map(videoDOPage, new TypeBuilder<Page<VideoDO>>() {
    }.build(), new TypeBuilder<Page<VideoVO>>() {
    }.build());
    if (result.getSize() > 0) {
        result.getRecords().forEach(r -> r.setTransferList(transferLogic.list(new QueryWrapper<>(new TransferDO().setVideoId(r.getId())))));
    }
    return result;
}
Also used : VideoVO(org.saxing.a0041_wemedia.domain.vo.VideoVO) VideoDO(org.saxing.a0041_wemedia.domain.entity.VideoDO) TypeBuilder(ma.glasnost.orika.metadata.TypeBuilder) Page(com.baomidou.mybatisplus.extension.plugins.pagination.Page) TransferDO(org.saxing.a0041_wemedia.domain.entity.TransferDO) ApiImplicitParams(io.swagger.annotations.ApiImplicitParams) ApiOperation(io.swagger.annotations.ApiOperation)

Aggregations

Page (com.baomidou.mybatisplus.extension.plugins.pagination.Page)1 ApiImplicitParams (io.swagger.annotations.ApiImplicitParams)1 ApiOperation (io.swagger.annotations.ApiOperation)1 TypeBuilder (ma.glasnost.orika.metadata.TypeBuilder)1 TransferDO (org.saxing.a0041_wemedia.domain.entity.TransferDO)1 VideoDO (org.saxing.a0041_wemedia.domain.entity.VideoDO)1 VideoVO (org.saxing.a0041_wemedia.domain.vo.VideoVO)1