use of org.saxing.a0041_wemedia.domain.entity.TransferDO in project java-example by saxingz.
the class CRUDTest method testInsert.
@Test
@Transactional
public void testInsert() {
TransferDO transferDO = new TransferDO().setVideoId(1L).setUrl("https://www.baidu.com").setPublishTime(new Date()).setPlatform(Platform.BILIBILI.getName());
int insert = transferMapper.insert(transferDO);
for (int i = 0; i < 100; i++) {
transferMapper.insert(transferDO);
}
System.out.println(insert);
}
use of org.saxing.a0041_wemedia.domain.entity.TransferDO in project java-example by saxingz.
the class CRUDTest method testUpdate.
@Test
@Transactional
public void testUpdate() {
TransferDO transferDO = new TransferDO().setId(1L);
int insert = transferMapper.updateById(transferDO);
System.out.println(insert);
}
use of org.saxing.a0041_wemedia.domain.entity.TransferDO in project java-example by saxingz.
the class WrapperTest method wrapQueryOne.
@Test
void wrapQueryOne() {
QueryWrapper<TransferDO> wrapper = new QueryWrapper<>();
wrapper.eq("id", 10);
TransferDO transferDO = transferMapper.selectOne(wrapper);
System.out.println(transferDO);
}
use of org.saxing.a0041_wemedia.domain.entity.TransferDO 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;
}
Aggregations