展示当前站点最新发布的文章

master
rong.liu 2 years ago
parent b184ed7498
commit bee2634885
  1. 6
      src/main/java/com/huoran/iasf/controller/SysContentController.java
  2. 3
      src/main/java/com/huoran/iasf/service/SysContentService.java
  3. 11
      src/main/java/com/huoran/iasf/service/impl/SysContentServiceImpl.java

@ -76,5 +76,11 @@ public class SysContentController {
public R checkIfTheTitleIsRepeat(@RequestBody @Valid ContentHeavyTitleReqVO content) {
return service.checkIfTheTitleIsRepeat(content) ? R.success() : R.fail("该标题已重复!");
}
@PostMapping("/newlyPublishedArticles")
@ApiOperation(value = "站点最新发布的文章", response = PageContentReqVO.class)
public R newlyPublishedArticles(@RequestBody @Valid PageContentReqVO content) {
return service.newlyPublishedArticles(content);
}
}

@ -16,4 +16,7 @@ public interface SysContentService extends IService<SysContent> {
//分页栏目列表
R articlePaginationList(PageContentReqVO reqVO);
//站点最新发布的文章
R newlyPublishedArticles(PageContentReqVO reqVO);
}

@ -53,6 +53,17 @@ public class SysContentServiceImpl extends ServiceImpl<SysContentMapper, SysCont
IPage<PageContentRespVO> pageList = baseMapper.articlePaginationList(page, reqVO);
return R.success(pageList);
}
@Override
public R newlyPublishedArticles(PageContentReqVO reqVO) {
QueryWrapper<SysContent> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("site_id", reqVO.getSiteId());
queryWrapper.eq("is_release", 1);
queryWrapper.eq("deleted", 1).orderByDesc("create_time");
Page<PageContentRespVO> page = new Page<PageContentRespVO>(reqVO.getPageNum(), reqVO.getPageSize());
IPage<PageContentRespVO> pageList = baseMapper.articlePaginationList(page, reqVO);
return R.success(pageList);
}
}

Loading…
Cancel
Save