From 0a9882d4667f1c615509fec73b730e85a88ec459 Mon Sep 17 00:00:00 2001 From: ronger Date: Thu, 3 Jun 2021 09:27:20 +0800 Subject: [PATCH] =?UTF-8?q?:art:=20=E4=BD=9C=E5=93=81=E9=9B=86=E6=8E=92?= =?UTF-8?q?=E5=BA=8F=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../forest/web/api/common/CommonApiController.java | 13 +++++++++++++ src/main/java/mapper/PortfolioMapper.xml | 3 ++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/rymcu/forest/web/api/common/CommonApiController.java b/src/main/java/com/rymcu/forest/web/api/common/CommonApiController.java index ec2d5a7..27980fa 100644 --- a/src/main/java/com/rymcu/forest/web/api/common/CommonApiController.java +++ b/src/main/java/com/rymcu/forest/web/api/common/CommonApiController.java @@ -7,6 +7,7 @@ import com.rymcu.forest.core.result.GlobalResultGenerator; import com.rymcu.forest.core.result.GlobalResultMessage; import com.rymcu.forest.core.service.log.annotation.VisitLogger; import com.rymcu.forest.dto.*; +import com.rymcu.forest.entity.Portfolio; import com.rymcu.forest.entity.User; import com.rymcu.forest.service.*; import com.rymcu.forest.util.UserUtils; @@ -142,4 +143,16 @@ public class CommonApiController { Map map = Utils.getArticlesGlobalResult(pageInfo); return GlobalResultGenerator.genSuccessResult(map); } + + @GetMapping("/portfolios") + public GlobalResult portfolios(@RequestParam(defaultValue = "0") Integer page, @RequestParam(defaultValue = "12") Integer rows) { + PageHelper.startPage(page, rows); + List list = portfolioService.findPortfolios(); + PageInfo pageInfo = new PageInfo(list); + Map map = new HashMap(2); + map.put("portfolios", pageInfo.getList()); + Map pagination = Utils.getPagination(pageInfo); + map.put("pagination", pagination); + return GlobalResultGenerator.genSuccessResult(map); + } } diff --git a/src/main/java/mapper/PortfolioMapper.xml b/src/main/java/mapper/PortfolioMapper.xml index ac07b15..ad1ebbc 100644 --- a/src/main/java/mapper/PortfolioMapper.xml +++ b/src/main/java/mapper/PortfolioMapper.xml @@ -52,6 +52,7 @@ select ifnull(max(sort_no),0) + 1 from forest_portfolio_article where id_portfolio = #{idPortfolio} \ No newline at end of file