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); } } // 第三步 查找评论数