处理列表图片问题

This commit is contained in:
WenG 2020-11-30 23:41:43 +08:00
parent 95136bda9e
commit e3c00ce7e7
2 changed files with 6 additions and 9 deletions

View File

@ -197,9 +197,6 @@ public class NewsContentAppDTO implements Serializable {
} }
public List<NewsLabelConfigDTO> getNewsContentLabelList() { public List<NewsLabelConfigDTO> getNewsContentLabelList() {
if(this.newsContentLabelList == null) {
this.newsContentLabelList = new ArrayList<>();
}
return newsContentLabelList; return newsContentLabelList;
} }

View File

@ -414,19 +414,19 @@ public class NewsContentServiceImpl extends BaseService implements INewsContentS
} }
for (NewsContentAppDTO appDTO : newsContentDTOs) { for (NewsContentAppDTO appDTO : newsContentDTOs) {
// 第一步 查找封面图片 // 第一步 查找封面图片
List<NewsContentCoverDTO> newsContentCoverDTOs = new ArrayList<>();
appDTO.setNewsContentCoverList(newsContentCoverDTOs);
for (NewsContentCoverDTO newsContentCoverDTO : converList) { for (NewsContentCoverDTO newsContentCoverDTO : converList) {
if (StringUtils.equals(appDTO.getNewsContentId(), newsContentCoverDTO.getNewsContentId())) { if (StringUtils.equals(appDTO.getNewsContentId(), newsContentCoverDTO.getNewsContentId())) {
if(appDTO.getNewsContentCoverList().isEmpty()) { newsContentCoverDTOs.add(newsContentCoverDTO);
appDTO.getNewsContentCoverList().add(newsContentCoverDTO);
} else {
break;
}
} }
} }
// 第二步 查找配置的标签项 // 第二步 查找配置的标签项
List<NewsLabelConfigDTO> newsLabelConfigDTOs = new ArrayList<>();
appDTO.setNewsContentLabelList(newsLabelConfigDTOs);
for (NewsLabelConfigDTO newsLabelConfigDTO : configList) { for (NewsLabelConfigDTO newsLabelConfigDTO : configList) {
if (StringUtils.equals(appDTO.getNewsContentId(), newsLabelConfigDTO.getNewsContentId())) { if (StringUtils.equals(appDTO.getNewsContentId(), newsLabelConfigDTO.getNewsContentId())) {
appDTO.getNewsContentLabelList().add(newsLabelConfigDTO); newsLabelConfigDTOs.add(newsLabelConfigDTO);
} }
} }
// 第三步 查找评论数 // 第三步 查找评论数