Skip to content

Commit

Permalink
+查询文章评论总数
Browse files Browse the repository at this point in the history
  • Loading branch information
zaoangod committed Oct 20, 2018
1 parent 74da260 commit 5fed7ca
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/main/java/com/tale/service/CommentsService.java
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,18 @@ public Page<Comment> getComments(Integer cid, int page, int limit) {
return commentsPage.map(this::apply);
}

/**
* 获取文章下的评论统计
*
* @param cid 文章ID
*/
public long getCommentCount(Integer cid) {
if (null == cid) {
return 0;
}
return select().from(Comments.class).where(Comments::getCid, cid).count();
}

/**
* 获取该评论下的追加评论
*
Expand Down

0 comments on commit 5fed7ca

Please sign in to comment.