Sfoglia il codice sorgente

获取文章评论代码更新

fangqing 3 giorni fa
parent
commit
be19d4b0e2

+ 5 - 1
ruoyi-generator/src/main/java/com/ruoyi/generator/controller/CommunityCommentController.java

@@ -132,6 +132,10 @@ public class CommunityCommentController extends BaseController {
             userId = SecurityUtils.getUserId();
         }
 
+        //设置评论回复数量
+        int total =  communityArticleCommentMapper.queryCommentCount(Long.valueOf(articleId));
+
+
         try {
             Page<CommunityArticleComment> page = new Page<>(currentPage, limit);
             QueryWrapper<CommunityArticleComment> queryWrapper = new QueryWrapper<CommunityArticleComment>()
@@ -219,7 +223,7 @@ public class CommunityCommentController extends BaseController {
             throw new ProjectException();
         }
 
-        return AjaxResult.success(commentVos);
+        return AjaxResult.successByCounts(commentVos,total);
     }
 
     /**

+ 1 - 1
ruoyi-generator/src/main/resources/mapper/community/CommunityArticleCommentMapper.xml

@@ -10,7 +10,7 @@
                      (select count(1) as replyCount
                       from community_article_comment a
                                left join community_comment_reply b on a.id = b.comment_id
-                      where a.article_id = #{articleId}
+                      where a.article_id = #{articleId}  and a.is_delete != 1
                         and b.is_delete != 1) as replyCount from community_article_comment c
         where c.article_id = #{articleId} and c.is_delete != 1 ) as d
     </select>