From 841af683f37553b8493dbc0d63a3f09389fb7b19 Mon Sep 17 00:00:00 2001 From: wenc000 <450292408@qq.com> Date: Fri, 17 Apr 2020 17:32:58 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=96=87=E7=AB=A0?= =?UTF-8?q?=E7=BB=9F=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ArticleContentController.java | 26 ++++++++++++++---- .../ArticleContentAppController.java | 27 ++++++++++++++----- .../ArticleContentResourceController.java | 27 ++++++++++++++----- .../articlecontent/IArticleContentDao.java | 10 ++++++- .../IArticleContentService.java | 8 ++++++ .../impl/ArticleContentServiceImpl.java | 6 +++++ .../articlecontent/articlecontent-mapper.xml | 18 +++++++++++++ 7 files changed, 104 insertions(+), 18 deletions(-) diff --git a/cloud-common-article/src/main/java/com/cm/common/article/controller/apis/articlecontent/ArticleContentController.java b/cloud-common-article/src/main/java/com/cm/common/article/controller/apis/articlecontent/ArticleContentController.java index c27dc22..1b9778b 100644 --- a/cloud-common-article/src/main/java/com/cm/common/article/controller/apis/articlecontent/ArticleContentController.java +++ b/cloud-common-article/src/main/java/com/cm/common/article/controller/apis/articlecontent/ArticleContentController.java @@ -11,6 +11,7 @@ import com.cm.common.pojo.ListPage; import com.cm.common.pojo.dtos.CurrentUserIdInfoDTO; import com.cm.common.result.ErrorResult; import com.cm.common.result.SuccessResult; +import com.cm.common.result.SuccessResultData; import com.cm.common.result.SuccessResultList; import com.cm.common.article.pojo.dtos.articlecontent.ArticleContentDTO; import com.cm.common.article.pojo.vos.articlecontent.ArticleContentVO; @@ -102,6 +103,9 @@ public class ArticleContentController extends AbstractController { @ApiOperation(value = "文章内容列表", notes = "文章内容列表接口") @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) + @ApiImplicitParams({ + @ApiImplicitParam(name = "articleCategoryId", value = "文章目录", paramType = "form", dataType = "String") + }) @GetMapping("listarticlecontent") public List listArticleContent() throws SearchException { Map params = requestParams(); @@ -110,11 +114,12 @@ public class ArticleContentController extends AbstractController { @ApiOperation(value = "文章内容分页列表", notes = "文章内容分页列表接口") @ApiImplicitParams({ - @ApiImplicitParam(name = "page", value = "当前页码", paramType = "form", dataType = "Integer", defaultValue = "1"), - @ApiImplicitParam(name = "rows", value = "显示数量", paramType = "form", dataType = "Integer", defaultValue = "20"), - @ApiImplicitParam(name = "keywords", value = "关键字", paramType = "form", dataType = "String"), - @ApiImplicitParam(name = "startTime", value = "开始时间", paramType = "form", dataType = "String"), - @ApiImplicitParam(name = "endTime", value = "结束时间", paramType = "form", dataType = "String") + @ApiImplicitParam(name = "page", value = "当前页码", paramType = "query", dataType = "Integer", defaultValue = "1"), + @ApiImplicitParam(name = "rows", value = "显示数量", paramType = "query", dataType = "Integer", defaultValue = "20"), + @ApiImplicitParam(name = "keywords", value = "关键字", paramType = "query", dataType = "String"), + @ApiImplicitParam(name = "startTime", value = "开始时间", paramType = "query", dataType = "String"), + @ApiImplicitParam(name = "endTime", value = "结束时间", paramType = "query", dataType = "String"), + @ApiImplicitParam(name = "articleCategoryId", value = "文章目录", paramType = "query", dataType = "String") }) @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) @GetMapping("listpagearticlecontent") @@ -131,4 +136,15 @@ public class ArticleContentController extends AbstractController { return securityComponent.getCurrentUserIdInfo(); } + @ApiOperation(value = "统计文章数量", notes = "统计文章数量接口") + @ApiImplicitParams({ + @ApiImplicitParam(name = "articleCategoryId", value = "文章目录", paramType = "form", dataType = "String") + }) + @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) + @GetMapping("countarticlecount") + public SuccessResultData countArticleCount() { + Map params = requestParams(); + return articleContentService.countArticleCount(params); + } + } \ No newline at end of file diff --git a/cloud-common-article/src/main/java/com/cm/common/article/controller/app/apis/articlecontent/ArticleContentAppController.java b/cloud-common-article/src/main/java/com/cm/common/article/controller/app/apis/articlecontent/ArticleContentAppController.java index c2f737d..d6e7475 100644 --- a/cloud-common-article/src/main/java/com/cm/common/article/controller/app/apis/articlecontent/ArticleContentAppController.java +++ b/cloud-common-article/src/main/java/com/cm/common/article/controller/app/apis/articlecontent/ArticleContentAppController.java @@ -8,6 +8,7 @@ import com.cm.common.exception.SearchException; import com.cm.common.pojo.ListPage; import com.cm.common.result.ErrorResult; import com.cm.common.result.SuccessResult; +import com.cm.common.result.SuccessResultData; import com.cm.common.result.SuccessResultList; import com.cm.common.article.pojo.dtos.articlecontent.ArticleContentDTO; import com.cm.common.article.pojo.vos.articlecontent.ArticleContentVO; @@ -82,7 +83,8 @@ public class ArticleContentAppController extends AbstractController { @ApiOperation(value = "文章内容列表", notes = "文章内容列表接口") @ApiImplicitParams({ - @ApiImplicitParam(name = "token", value = "token", paramType = "header") + @ApiImplicitParam(name = "token", value = "token", paramType = "header"), + @ApiImplicitParam(name = "articleCategoryId", value = "文章目录", paramType = "query", dataType = "String") }) @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) @GetMapping("listarticlecontent") @@ -94,11 +96,12 @@ public class ArticleContentAppController extends AbstractController { @ApiOperation(value = "文章内容分页列表", notes = "文章内容分页列表接口") @ApiImplicitParams({ @ApiImplicitParam(name = "token", value = "token", paramType = "header"), - @ApiImplicitParam(name = "page", value = "当前页码", paramType = "form", dataType = "Integer", defaultValue = "1"), - @ApiImplicitParam(name = "rows", value = "显示数量", paramType = "form", dataType = "Integer", defaultValue = "20"), - @ApiImplicitParam(name = "keywords", value = "关键字", paramType = "form", dataType = "String"), - @ApiImplicitParam(name = "startTime", value = "开始时间", paramType = "form", dataType = "String"), - @ApiImplicitParam(name = "endTime", value = "结束时间", paramType = "form", dataType = "String") + @ApiImplicitParam(name = "page", value = "当前页码", paramType = "query", dataType = "Integer", defaultValue = "1"), + @ApiImplicitParam(name = "rows", value = "显示数量", paramType = "query", dataType = "Integer", defaultValue = "20"), + @ApiImplicitParam(name = "keywords", value = "关键字", paramType = "query", dataType = "String"), + @ApiImplicitParam(name = "startTime", value = "开始时间", paramType = "query", dataType = "String"), + @ApiImplicitParam(name = "endTime", value = "结束时间", paramType = "query", dataType = "String"), + @ApiImplicitParam(name = "articleCategoryId", value = "文章目录", paramType = "query", dataType = "String") }) @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) @GetMapping("listpagearticlecontent") @@ -108,4 +111,16 @@ public class ArticleContentAppController extends AbstractController { return articleContentService.listPageArticleContent(page); } + @ApiOperation(value = "统计文章数量", notes = "统计文章数量接口") + @ApiImplicitParams({ + @ApiImplicitParam(name = "token", value = "token", paramType = "header"), + @ApiImplicitParam(name = "articleCategoryId", value = "文章目录", paramType = "form", dataType = "String") + }) + @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) + @GetMapping("countarticlecount") + public SuccessResultData countArticleCount() { + Map params = requestParams(); + return articleContentService.countArticleCount(params); + } + } \ No newline at end of file diff --git a/cloud-common-article/src/main/java/com/cm/common/article/controller/resources/articlecontent/ArticleContentResourceController.java b/cloud-common-article/src/main/java/com/cm/common/article/controller/resources/articlecontent/ArticleContentResourceController.java index 0208a4d..a310b08 100644 --- a/cloud-common-article/src/main/java/com/cm/common/article/controller/resources/articlecontent/ArticleContentResourceController.java +++ b/cloud-common-article/src/main/java/com/cm/common/article/controller/resources/articlecontent/ArticleContentResourceController.java @@ -8,6 +8,7 @@ import com.cm.common.exception.SearchException; import com.cm.common.pojo.ListPage; import com.cm.common.result.ErrorResult; import com.cm.common.result.SuccessResult; +import com.cm.common.result.SuccessResultData; import com.cm.common.result.SuccessResultList; import com.cm.common.article.pojo.dtos.articlecontent.ArticleContentDTO; import com.cm.common.article.pojo.vos.articlecontent.ArticleContentVO; @@ -82,7 +83,8 @@ public class ArticleContentResourceController extends AbstractController { @ApiOperation(value = "文章内容列表", notes = "文章内容列表接口") @ApiImplicitParams({ - @ApiImplicitParam(name = "access_token", value = "access_token", paramType = "query") + @ApiImplicitParam(name = "access_token", value = "access_token", paramType = "query"), + @ApiImplicitParam(name = "articleCategoryId", value = "文章目录", paramType = "query", dataType = "String") }) @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) @GetMapping("listarticlecontent") @@ -94,11 +96,12 @@ public class ArticleContentResourceController extends AbstractController { @ApiOperation(value = "文章内容分页列表", notes = "文章内容分页列表接口") @ApiImplicitParams({ @ApiImplicitParam(name = "access_token", value = "access_token", paramType = "query"), - @ApiImplicitParam(name = "page", value = "当前页码", paramType = "form", dataType = "Integer", defaultValue = "1"), - @ApiImplicitParam(name = "rows", value = "显示数量", paramType = "form", dataType = "Integer", defaultValue = "20"), - @ApiImplicitParam(name = "keywords", value = "关键字", paramType = "form", dataType = "String"), - @ApiImplicitParam(name = "startTime", value = "开始时间", paramType = "form", dataType = "String"), - @ApiImplicitParam(name = "endTime", value = "结束时间", paramType = "form", dataType = "String") + @ApiImplicitParam(name = "page", value = "当前页码", paramType = "query", dataType = "Integer", defaultValue = "1"), + @ApiImplicitParam(name = "rows", value = "显示数量", paramType = "query", dataType = "Integer", defaultValue = "20"), + @ApiImplicitParam(name = "keywords", value = "关键字", paramType = "query", dataType = "String"), + @ApiImplicitParam(name = "startTime", value = "开始时间", paramType = "query", dataType = "String"), + @ApiImplicitParam(name = "endTime", value = "结束时间", paramType = "query", dataType = "String"), + @ApiImplicitParam(name = "articleCategoryId", value = "文章目录", paramType = "query", dataType = "String") }) @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) @GetMapping("listpagearticlecontent") @@ -108,4 +111,16 @@ public class ArticleContentResourceController extends AbstractController { return articleContentService.listPageArticleContent(page); } + @ApiOperation(value = "统计文章数量", notes = "统计文章数量接口") + @ApiImplicitParams({ + @ApiImplicitParam(name = "access_token", value = "access_token", paramType = "query"), + @ApiImplicitParam(name = "articleCategoryId", value = "文章目录", paramType = "form", dataType = "String") + }) + @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) + @GetMapping("countarticlecount") + public SuccessResultData countArticleCount() { + Map params = requestParams(); + return articleContentService.countArticleCount(params); + } + } \ No newline at end of file diff --git a/cloud-common-article/src/main/java/com/cm/common/article/dao/articlecontent/IArticleContentDao.java b/cloud-common-article/src/main/java/com/cm/common/article/dao/articlecontent/IArticleContentDao.java index 8af5bd2..4d11aa2 100644 --- a/cloud-common-article/src/main/java/com/cm/common/article/dao/articlecontent/IArticleContentDao.java +++ b/cloud-common-article/src/main/java/com/cm/common/article/dao/articlecontent/IArticleContentDao.java @@ -62,5 +62,13 @@ public interface IArticleContentDao { * @throws SearchException */ List listArticleContent(Map params) throws SearchException; - + + /** + * 统计文章数量 + * + * @param params + * @return + * @throws SearchException + */ + Integer countArticleCount(Map params) throws SearchException; } diff --git a/cloud-common-article/src/main/java/com/cm/common/article/service/articlecontent/IArticleContentService.java b/cloud-common-article/src/main/java/com/cm/common/article/service/articlecontent/IArticleContentService.java index 9fbeedb..c880f6f 100644 --- a/cloud-common-article/src/main/java/com/cm/common/article/service/articlecontent/IArticleContentService.java +++ b/cloud-common-article/src/main/java/com/cm/common/article/service/articlecontent/IArticleContentService.java @@ -119,4 +119,12 @@ public interface IArticleContentService { */ SuccessResultList> listPageArticleContent(ListPage page) throws SearchException; + /** + * 统计文章数量 + * + * @param params + * @return + * @throws SearchException + */ + SuccessResultData countArticleCount(Map params) throws SearchException; } diff --git a/cloud-common-article/src/main/java/com/cm/common/article/service/articlecontent/impl/ArticleContentServiceImpl.java b/cloud-common-article/src/main/java/com/cm/common/article/service/articlecontent/impl/ArticleContentServiceImpl.java index e9b6935..e2170ee 100644 --- a/cloud-common-article/src/main/java/com/cm/common/article/service/articlecontent/impl/ArticleContentServiceImpl.java +++ b/cloud-common-article/src/main/java/com/cm/common/article/service/articlecontent/impl/ArticleContentServiceImpl.java @@ -10,6 +10,7 @@ import com.cm.common.exception.SearchException; import com.cm.common.exception.UpdateException; import com.cm.common.pojo.ListPage; import com.cm.common.result.SuccessResult; +import com.cm.common.result.SuccessResultData; import com.cm.common.result.SuccessResultList; import com.cm.common.utils.HashMapUtil; import com.cm.common.utils.UUIDUtil; @@ -154,4 +155,9 @@ public class ArticleContentServiceImpl extends AbstractService implements IArtic return new SuccessResultList<>(articleContentDTOs, pageInfo.getPageNum(), pageInfo.getTotal()); } + @Override + public SuccessResultData countArticleCount(Map params) throws SearchException { + Integer countArticleCount = articleContentDao.countArticleCount(params); + return new SuccessResultData<>(countArticleCount == null ? 0 : countArticleCount); + } } diff --git a/cloud-common-article/src/main/resources/mybatis/mapper/articlecontent/articlecontent-mapper.xml b/cloud-common-article/src/main/resources/mybatis/mapper/articlecontent/articlecontent-mapper.xml index 1d492c4..deb38fc 100644 --- a/cloud-common-article/src/main/resources/mybatis/mapper/articlecontent/articlecontent-mapper.xml +++ b/cloud-common-article/src/main/resources/mybatis/mapper/articlecontent/articlecontent-mapper.xml @@ -191,4 +191,22 @@ + + + \ No newline at end of file From 060426c189333fb3b97e9826efac4f4573f022eb Mon Sep 17 00:00:00 2001 From: wenc000 <450292408@qq.com> Date: Fri, 17 Apr 2020 17:35:01 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E8=B0=83=E6=95=B4import?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../apis/articlecontent/ArticleContentController.java | 7 +++---- .../apis/articlecontent/ArticleContentAppController.java | 7 +++---- .../articlecontent/ArticleContentResourceController.java | 7 +++---- .../article/dao/articlecontent/IArticleContentDao.java | 3 +-- .../service/articlecontent/IArticleContentService.java | 5 ++--- 5 files changed, 12 insertions(+), 17 deletions(-) diff --git a/cloud-common-article/src/main/java/com/cm/common/article/controller/apis/articlecontent/ArticleContentController.java b/cloud-common-article/src/main/java/com/cm/common/article/controller/apis/articlecontent/ArticleContentController.java index 1b9778b..1e07138 100644 --- a/cloud-common-article/src/main/java/com/cm/common/article/controller/apis/articlecontent/ArticleContentController.java +++ b/cloud-common-article/src/main/java/com/cm/common/article/controller/apis/articlecontent/ArticleContentController.java @@ -1,6 +1,9 @@ package com.cm.common.article.controller.apis.articlecontent; import com.cm.common.annotation.CheckRequestBodyAnnotation; +import com.cm.common.article.pojo.dtos.articlecontent.ArticleContentDTO; +import com.cm.common.article.pojo.vos.articlecontent.ArticleContentVO; +import com.cm.common.article.service.articlecontent.IArticleContentService; import com.cm.common.base.AbstractController; import com.cm.common.component.SecurityComponent; import com.cm.common.constants.ISystemConstant; @@ -13,16 +16,12 @@ import com.cm.common.result.ErrorResult; import com.cm.common.result.SuccessResult; import com.cm.common.result.SuccessResultData; import com.cm.common.result.SuccessResultList; -import com.cm.common.article.pojo.dtos.articlecontent.ArticleContentDTO; -import com.cm.common.article.pojo.vos.articlecontent.ArticleContentVO; -import com.cm.common.article.service.articlecontent.IArticleContentService; import com.cm.common.utils.RegexUtil; import io.swagger.annotations.*; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; -import java.util.Arrays; import java.util.List; import java.util.Map; diff --git a/cloud-common-article/src/main/java/com/cm/common/article/controller/app/apis/articlecontent/ArticleContentAppController.java b/cloud-common-article/src/main/java/com/cm/common/article/controller/app/apis/articlecontent/ArticleContentAppController.java index d6e7475..cd48412 100644 --- a/cloud-common-article/src/main/java/com/cm/common/article/controller/app/apis/articlecontent/ArticleContentAppController.java +++ b/cloud-common-article/src/main/java/com/cm/common/article/controller/app/apis/articlecontent/ArticleContentAppController.java @@ -1,6 +1,9 @@ package com.cm.common.article.controller.app.apis.articlecontent; import com.cm.common.annotation.CheckRequestBodyAnnotation; +import com.cm.common.article.pojo.dtos.articlecontent.ArticleContentDTO; +import com.cm.common.article.pojo.vos.articlecontent.ArticleContentVO; +import com.cm.common.article.service.articlecontent.IArticleContentService; import com.cm.common.base.AbstractController; import com.cm.common.constants.ISystemConstant; import com.cm.common.exception.RemoveException; @@ -10,14 +13,10 @@ import com.cm.common.result.ErrorResult; import com.cm.common.result.SuccessResult; import com.cm.common.result.SuccessResultData; import com.cm.common.result.SuccessResultList; -import com.cm.common.article.pojo.dtos.articlecontent.ArticleContentDTO; -import com.cm.common.article.pojo.vos.articlecontent.ArticleContentVO; -import com.cm.common.article.service.articlecontent.IArticleContentService; import io.swagger.annotations.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; -import java.util.Arrays; import java.util.List; import java.util.Map; diff --git a/cloud-common-article/src/main/java/com/cm/common/article/controller/resources/articlecontent/ArticleContentResourceController.java b/cloud-common-article/src/main/java/com/cm/common/article/controller/resources/articlecontent/ArticleContentResourceController.java index a310b08..7af216d 100644 --- a/cloud-common-article/src/main/java/com/cm/common/article/controller/resources/articlecontent/ArticleContentResourceController.java +++ b/cloud-common-article/src/main/java/com/cm/common/article/controller/resources/articlecontent/ArticleContentResourceController.java @@ -1,6 +1,9 @@ package com.cm.common.article.controller.resources.articlecontent; import com.cm.common.annotation.CheckRequestBodyAnnotation; +import com.cm.common.article.pojo.dtos.articlecontent.ArticleContentDTO; +import com.cm.common.article.pojo.vos.articlecontent.ArticleContentVO; +import com.cm.common.article.service.articlecontent.IArticleContentService; import com.cm.common.base.AbstractController; import com.cm.common.constants.ISystemConstant; import com.cm.common.exception.RemoveException; @@ -10,14 +13,10 @@ import com.cm.common.result.ErrorResult; import com.cm.common.result.SuccessResult; import com.cm.common.result.SuccessResultData; import com.cm.common.result.SuccessResultList; -import com.cm.common.article.pojo.dtos.articlecontent.ArticleContentDTO; -import com.cm.common.article.pojo.vos.articlecontent.ArticleContentVO; -import com.cm.common.article.service.articlecontent.IArticleContentService; import io.swagger.annotations.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; -import java.util.Arrays; import java.util.List; import java.util.Map; diff --git a/cloud-common-article/src/main/java/com/cm/common/article/dao/articlecontent/IArticleContentDao.java b/cloud-common-article/src/main/java/com/cm/common/article/dao/articlecontent/IArticleContentDao.java index 4d11aa2..dad894e 100644 --- a/cloud-common-article/src/main/java/com/cm/common/article/dao/articlecontent/IArticleContentDao.java +++ b/cloud-common-article/src/main/java/com/cm/common/article/dao/articlecontent/IArticleContentDao.java @@ -1,11 +1,10 @@ package com.cm.common.article.dao.articlecontent; +import com.cm.common.article.pojo.dtos.articlecontent.ArticleContentDTO; import com.cm.common.exception.RemoveException; import com.cm.common.exception.SaveException; import com.cm.common.exception.SearchException; import com.cm.common.exception.UpdateException; -import com.cm.common.result.SuccessResultList; -import com.cm.common.article.pojo.dtos.articlecontent.ArticleContentDTO; import org.springframework.stereotype.Repository; import java.util.List; diff --git a/cloud-common-article/src/main/java/com/cm/common/article/service/articlecontent/IArticleContentService.java b/cloud-common-article/src/main/java/com/cm/common/article/service/articlecontent/IArticleContentService.java index c880f6f..0dac3e2 100644 --- a/cloud-common-article/src/main/java/com/cm/common/article/service/articlecontent/IArticleContentService.java +++ b/cloud-common-article/src/main/java/com/cm/common/article/service/articlecontent/IArticleContentService.java @@ -1,15 +1,14 @@ package com.cm.common.article.service.articlecontent; +import com.cm.common.article.pojo.dtos.articlecontent.ArticleContentDTO; +import com.cm.common.article.pojo.vos.articlecontent.ArticleContentVO; import com.cm.common.exception.RemoveException; -import com.cm.common.exception.SaveException; import com.cm.common.exception.SearchException; import com.cm.common.exception.UpdateException; import com.cm.common.pojo.ListPage; import com.cm.common.result.SuccessResult; import com.cm.common.result.SuccessResultData; import com.cm.common.result.SuccessResultList; -import com.cm.common.article.pojo.dtos.articlecontent.ArticleContentDTO; -import com.cm.common.article.pojo.vos.articlecontent.ArticleContentVO; import java.util.List; import java.util.Map;