Prechádzať zdrojové kódy

getNewsArticleById 增加返回字段 urlList

xusonglin 5 rokov pred
rodič
commit
022de1f9ea

+ 1 - 0
src/main/java/com/jkcredit/sysnews/model/vo/newsArticle/NewsArticleVo.java

@@ -31,4 +31,5 @@ public class NewsArticleVo implements Serializable {
 
     private String content;
 
+    private List<String> urlList;
 }

+ 10 - 0
src/main/java/com/jkcredit/sysnews/service/newsArticle/NewsArticleServiceImpl.java

@@ -88,8 +88,18 @@ public class NewsArticleServiceImpl extends BaseService implements NewsArticleSe
             String url = accessPath + accessResource + newsArticlePo.getPhotoUrl().replace("/","");
             newsArticleVo.setPhotoUrl(url);
         }
+        // 查询新闻所属导航
         List<Long> navigationBarIdList = newsArticleNavigationBarService.getNavigationBarIdByNewsId(id);
         newsArticleVo.setNavigationBarIds(navigationBarIdList);
+        // 查询新闻内图片url地址
+        List<NewsArticlePhotoPo> newsArticlePhotoPoList = newsArticlePhotoService.getArticlePhotoByNewsId(id);
+        List<String> urlList = new ArrayList<>();
+        for (NewsArticlePhotoPo po : newsArticlePhotoPoList) {
+            PhotoVo photoVo = photoService.getPhotoById(po.getPhotoId());
+            String url = accessPath + accessResource + photoVo.getUrl().replace("/","");
+            urlList.add(url);
+        }
+        newsArticleVo.setUrlList(urlList);
         return newsArticleVo;
     }