From d8f67066ff42e2feea708982c161df8f79d6b430 Mon Sep 17 00:00:00 2001 From: zhaoqifeng Date: Fri, 5 Jun 2020 17:20:53 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=87=E7=AB=A0=E5=88=97=E8=A1=A8=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/result/PublishedListResultDTO.java | 7 +++++ .../main/java/com/epmet/dao/ArticleDao.java | 11 +++++--- .../service/impl/ArticleServiceImpl.java | 10 +++++-- .../src/main/resources/mapper/ArticleDao.xml | 26 +++++++++++++++++++ 4 files changed, 48 insertions(+), 6 deletions(-) diff --git a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/PublishedListResultDTO.java b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/PublishedListResultDTO.java index 4241ebac0c..c566028269 100644 --- a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/PublishedListResultDTO.java +++ b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/PublishedListResultDTO.java @@ -1,9 +1,11 @@ package com.epmet.dto.result; +import com.fasterxml.jackson.annotation.JsonIgnore; import lombok.Data; import lombok.NoArgsConstructor; import java.io.Serializable; +import java.util.List; /** * @author zhaoqifeng @@ -34,7 +36,12 @@ public class PublishedListResultDTO implements Serializable { /** * 文章标签串 */ + @JsonIgnore private String tags; + /** + * 文章标签列表 + */ + private List tagNameList; /** * 概要内容 */ diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/ArticleDao.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/ArticleDao.java index 31c744610a..cc255c2c0e 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/ArticleDao.java +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/ArticleDao.java @@ -68,21 +68,24 @@ public interface ArticleDao extends BaseDao { * @author zhaoqifeng * @date 2020/6/2 16:59 * @param customerId + * @param tagIdList * @return java.util.List */ - @DataFilter(tableAliases = "a") - List selectArticleListForAgency(@Param("customerId") String customerId); + //@DataFilter(tableAliases = "a") + List selectArticleListForAgency(@Param("customerId") String customerId, @Param("tagIdList") List tagIdList); /** * 已发布列表---网格工作人员 * @author zhaoqifeng - * @date 2020/6/2 16:59 + * @date 2020/6/5 16:35 * @param customerId + * @param tagIdList * @param gridList * @return java.util.List */ @DataFilter(tableAliases = {"a", "apr"}, gridIdArgName = "gridList") - List selectArticleListForGrid(@Param("customerId") String customerId, Set gridList); + List selectArticleListForGrid(@Param("customerId") String customerId, + @Param("tagIdList") List tagIdList, Set gridList); /** * 已下线文章列表 diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java index a9b056a74e..6926d35fc4 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java @@ -590,10 +590,16 @@ public class ArticleServiceImpl extends BaseServiceImpl { + String tags = result.getTags(); + List tagList = new ArrayList<>(); + tagList= Arrays.asList(tags.split("[|]")); + result.setTagNameList(tagList); + }); PageInfo pageInfo = new PageInfo<>(resultList); return new PageData<>(resultList, pageInfo.getTotal()); } diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/ArticleDao.xml b/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/ArticleDao.xml index cb1817ed58..08abf54b28 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/ArticleDao.xml +++ b/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/ArticleDao.xml @@ -58,6 +58,20 @@ WHERE a.DEL_FLAG = '0' AND a.STATUS_FLAG = 'published' AND a.CUSTOMER_ID = #{customerId} + + AND EXISTS ( + SELECT DISTINCT + at.ARTICLE_ID + FROM article_tags at + WHERE at.DEL_FLAG = '0' + AND at.ARTICLE_ID = a.ID + + at.TAG_ID = #{tagId} + + ) + + + ORDER BY PUBLISH_DATE DESC, UPDATED_TIME DESC