From e3c00ce7e7750b0bb439cfdffc3b4d41eb94ffcc Mon Sep 17 00:00:00 2001 From: WenG <450292408@qq.com> Date: Mon, 30 Nov 2020 23:41:43 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=84=E7=90=86=E5=88=97=E8=A1=A8=E5=9B=BE?= =?UTF-8?q?=E7=89=87=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pojo/dtos/newscontent/NewsContentAppDTO.java | 3 --- .../newscontent/impl/NewsContentServiceImpl.java | 12 ++++++------ 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/cm/news/pojo/dtos/newscontent/NewsContentAppDTO.java b/src/main/java/com/cm/news/pojo/dtos/newscontent/NewsContentAppDTO.java index ca5fa1e..b306332 100644 --- a/src/main/java/com/cm/news/pojo/dtos/newscontent/NewsContentAppDTO.java +++ b/src/main/java/com/cm/news/pojo/dtos/newscontent/NewsContentAppDTO.java @@ -197,9 +197,6 @@ public class NewsContentAppDTO implements Serializable { } public List getNewsContentLabelList() { - if(this.newsContentLabelList == null) { - this.newsContentLabelList = new ArrayList<>(); - } return newsContentLabelList; } diff --git a/src/main/java/com/cm/news/service/newscontent/impl/NewsContentServiceImpl.java b/src/main/java/com/cm/news/service/newscontent/impl/NewsContentServiceImpl.java index 0c14523..147ba4c 100644 --- a/src/main/java/com/cm/news/service/newscontent/impl/NewsContentServiceImpl.java +++ b/src/main/java/com/cm/news/service/newscontent/impl/NewsContentServiceImpl.java @@ -414,19 +414,19 @@ public class NewsContentServiceImpl extends BaseService implements INewsContentS } for (NewsContentAppDTO appDTO : newsContentDTOs) { // 第一步 查找封面图片 + List newsContentCoverDTOs = new ArrayList<>(); + appDTO.setNewsContentCoverList(newsContentCoverDTOs); for (NewsContentCoverDTO newsContentCoverDTO : converList) { if (StringUtils.equals(appDTO.getNewsContentId(), newsContentCoverDTO.getNewsContentId())) { - if(appDTO.getNewsContentCoverList().isEmpty()) { - appDTO.getNewsContentCoverList().add(newsContentCoverDTO); - } else { - break; - } + newsContentCoverDTOs.add(newsContentCoverDTO); } } // 第二步 查找配置的标签项 + List newsLabelConfigDTOs = new ArrayList<>(); + appDTO.setNewsContentLabelList(newsLabelConfigDTOs); for (NewsLabelConfigDTO newsLabelConfigDTO : configList) { if (StringUtils.equals(appDTO.getNewsContentId(), newsLabelConfigDTO.getNewsContentId())) { - appDTO.getNewsContentLabelList().add(newsLabelConfigDTO); + newsLabelConfigDTOs.add(newsLabelConfigDTO); } } // 第三步 查找评论数