From bee26348854e7df23843444ea4950c2522cb460f Mon Sep 17 00:00:00 2001 From: "rong.liu" Date: Sun, 9 Oct 2022 15:56:20 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B1=95=E7=A4=BA=E5=BD=93=E5=89=8D=E7=AB=99?= =?UTF-8?q?=E7=82=B9=E6=9C=80=E6=96=B0=E5=8F=91=E5=B8=83=E7=9A=84=E6=96=87?= =?UTF-8?q?=E7=AB=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../huoran/iasf/controller/SysContentController.java | 6 ++++++ .../com/huoran/iasf/service/SysContentService.java | 3 +++ .../iasf/service/impl/SysContentServiceImpl.java | 11 +++++++++++ 3 files changed, 20 insertions(+) diff --git a/src/main/java/com/huoran/iasf/controller/SysContentController.java b/src/main/java/com/huoran/iasf/controller/SysContentController.java index cbbc7f4..e6a0c06 100644 --- a/src/main/java/com/huoran/iasf/controller/SysContentController.java +++ b/src/main/java/com/huoran/iasf/controller/SysContentController.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); + } } diff --git a/src/main/java/com/huoran/iasf/service/SysContentService.java b/src/main/java/com/huoran/iasf/service/SysContentService.java index 93d6570..278804c 100644 --- a/src/main/java/com/huoran/iasf/service/SysContentService.java +++ b/src/main/java/com/huoran/iasf/service/SysContentService.java @@ -16,4 +16,7 @@ public interface SysContentService extends IService { //分页栏目列表 R articlePaginationList(PageContentReqVO reqVO); + + //站点最新发布的文章 + R newlyPublishedArticles(PageContentReqVO reqVO); } \ No newline at end of file diff --git a/src/main/java/com/huoran/iasf/service/impl/SysContentServiceImpl.java b/src/main/java/com/huoran/iasf/service/impl/SysContentServiceImpl.java index 5e377fe..3e8a9b9 100644 --- a/src/main/java/com/huoran/iasf/service/impl/SysContentServiceImpl.java +++ b/src/main/java/com/huoran/iasf/service/impl/SysContentServiceImpl.java @@ -53,6 +53,17 @@ public class SysContentServiceImpl extends ServiceImpl pageList = baseMapper.articlePaginationList(page, reqVO); return R.success(pageList); } + + @Override + public R newlyPublishedArticles(PageContentReqVO reqVO) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("site_id", reqVO.getSiteId()); + queryWrapper.eq("is_release", 1); + queryWrapper.eq("deleted", 1).orderByDesc("create_time"); + Page page = new Page(reqVO.getPageNum(), reqVO.getPageSize()); + IPage pageList = baseMapper.articlePaginationList(page, reqVO); + return R.success(pageList); + } }