diff --git a/luoo_music/src/main/java/com/luoo/music/dao/CommentDao.java b/luoo_music/src/main/java/com/luoo/music/dao/CommentDao.java index 5568882..c828b34 100644 --- a/luoo_music/src/main/java/com/luoo/music/dao/CommentDao.java +++ b/luoo_music/src/main/java/com/luoo/music/dao/CommentDao.java @@ -13,6 +13,7 @@ public interface CommentDao extends MongoRepository { public Page findByJournalId(String journalId, Pageable pageable); public List findTop5ByJournalIdOrderByThumbupCountDesc(String journalId); + public List findTop2ByJournalIdOrderByThumbupCountDesc(String journalId); public List findByJournalId(String journalId); diff --git a/luoo_music/src/main/java/com/luoo/music/dto/mapper/CommentMapper.java b/luoo_music/src/main/java/com/luoo/music/dto/mapper/CommentMapper.java index 36ea2bb..2268bdf 100644 --- a/luoo_music/src/main/java/com/luoo/music/dto/mapper/CommentMapper.java +++ b/luoo_music/src/main/java/com/luoo/music/dto/mapper/CommentMapper.java @@ -28,7 +28,7 @@ public class CommentMapper { */ CommentDTO commentDTO=new CommentDTO(); - List commentList =commentDao.findTop5ByJournalIdOrderByThumbupCountDesc(journalId); + List commentList =commentDao.findTop2ByJournalIdOrderByThumbupCountDesc(journalId); commentDTO.setCommentList(commentList); /** * 获取期刊总评论数 一级评论数加上父评论的总回复数 @@ -62,7 +62,7 @@ public class CommentMapper { } public static List getList(String journalId,CommentDao commentDao,UserClient userClient){ - List commentList =commentDao.findTop5ByJournalIdOrderByThumbupCountDesc(journalId); + List commentList =commentDao.findTop2ByJournalIdOrderByThumbupCountDesc(journalId); if(commentList.size()>0){ commentList= commentList.stream().map(comment -> { UserInfoDTO userInfoDTO =userClient.findByUserId(comment.getUserId());