Browse Source

图片地址

xusonglin 5 năm trước cách đây
mục cha
commit
1c3ab75a1a

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

@@ -58,8 +58,13 @@ public class NewsArticleServiceImpl extends BaseService implements NewsArticleSe
         return newsArticlePoIPage.convert(this::convert);
     }
     private NewsArticleVo convert(NewsArticlePo po) {
+
         NewsArticleVo vo = new NewsArticleVo();
         BeanUtils.copyProperties(po, vo);
+        if (po.getPhotoUrl() != null) {
+            String url = accessPath + accessResource + po.getPhotoUrl().replace("/","");
+            vo.setPhotoUrl(url);
+        }
         return vo;
     }
 
@@ -68,6 +73,10 @@ public class NewsArticleServiceImpl extends BaseService implements NewsArticleSe
         NewsArticlePo newsArticlePo = mapper.getNewsArticleById(id);
         NewsArticleVo newsArticleVo = new NewsArticleVo();
         BeanUtil.copyProperties(newsArticleVo, newsArticlePo);
+        if (newsArticlePo.getPhotoUrl() != null) {
+            String url = accessPath + accessResource + newsArticlePo.getPhotoUrl().replace("/","");
+            newsArticleVo.setPhotoUrl(url);
+        }
         return newsArticleVo;
     }