Răsfoiți Sursa

优化代码

fangqing 5 luni în urmă
părinte
comite
90b9a0f89b

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

@@ -203,7 +203,11 @@ public class CommunityCollectionServiceImpl extends ServiceImpl<CommunityCollect
             int likeCount = communityLikeMapper.selectCount(new QueryWrapper<CommunityLike>().eq("article_id", communityArticle.getId())).intValue();
             collectionArticleVo.setLikeCount(likeCount);
             //设置用户评论数
-            int commentCount = communityArticleCommentMapper.selectCount(new QueryWrapper<CommunityArticleComment>().eq("article_id", communityArticle.getId())).intValue();
+            int commentCount = communityArticleCommentMapper.selectCount(new QueryWrapper<CommunityArticleComment>().eq("article_id", communityArticle.getId()).and((wrapper) -> {
+                wrapper.ne("is_delete", true)
+                        .or()
+                        .isNull("is_delete");
+            })).intValue();
             collectionArticleVo.setCommentCount(commentCount);
             //设置文章封面
             List<CommunityArticleImages> articleImages = communityArticleImagesMapper.selectList(new QueryWrapper<CommunityArticleImages>()