Kaynağa Gözat

优化代码

fangzhen 5 ay önce
ebeveyn
işleme
ec42799afd

+ 6 - 1
ruoyi-generator/src/main/java/com/ruoyi/generator/service/CommunityCollectionServiceImpl.java

@@ -257,7 +257,12 @@ public class CommunityCollectionServiceImpl extends ServiceImpl<CommunityCollect
 
     @Override
     public List<CommunityCollectionVo> selectUserCollection(Long userId, Long articleId) {
-        return communityCollectionMapper.selectUserCollection(userId, articleId);
+        List<CommunityCollectionVo> communityCollectionVos = communityCollectionMapper.selectUserCollection(userId, articleId);
+        for (CommunityCollectionVo communityCollectionVo : communityCollectionVos) {
+            JSONArray objects = selectArticleInfoInCollection(communityCollectionVo.getId(), 1L);
+            communityCollectionVo.setArticleCount(objects.getJSONObject(0).getLong("articleNumber"));
+        }
+        return communityCollectionVos;
     }