Bladeren bron

查询合集下所有文章信息 游览量BUG修复

fangqing 5 maanden geleden
bovenliggende
commit
b276a460c1

+ 8 - 0
ruoyi-generator/src/main/java/com/ruoyi/generator/service/CommunityCollectionServiceImpl.java

@@ -109,6 +109,9 @@ public class CommunityCollectionServiceImpl extends ServiceImpl<CommunityCollect
         updateWrapper.setSql("heat = IFNULL(heat, 0) + 1");
         communityCollectionMapper.update(null, updateWrapper);
 
+
+
+
         //一级层级
         JSONObject collectionObject = new JSONObject();
         collectionObject.put("CollectionName", communityCollection.getCollectionName());
@@ -185,6 +188,11 @@ public class CommunityCollectionServiceImpl extends ServiceImpl<CommunityCollect
         }
         collectionObject.put("articleNumber", communityArticles.size());
 
+        //获取浏览量总数
+        collectionObject.put("pageViews",communityArticles.stream()
+                .mapToLong(CommunityArticle::getPageViews)
+                .sum());
+
         List<CommunityCollectionArticleVo> collectionArticleVos = new ArrayList<>();
         CommunityCollectionArticleVo collectionArticleVo = null;
         for (CommunityArticle communityArticle : communityArticles) {