diff --git a/luoo_comment/src/main/java/com/luoo/comment/dao/CommentDao.java b/luoo_comment/src/main/java/com/luoo/comment/dao/CommentDao.java index ee83f44..ec7b5ce 100644 --- a/luoo_comment/src/main/java/com/luoo/comment/dao/CommentDao.java +++ b/luoo_comment/src/main/java/com/luoo/comment/dao/CommentDao.java @@ -10,7 +10,7 @@ import java.util.List; public interface CommentDao extends MongoRepository { public Page findByParentId(String parentId, Pageable pageable); - public Page findByRootIdAndReplyToUserIdNotNull(String rootId, Pageable pageable); + public Page findByRootIdAndReplyToUserIdNotNullOrderByPublishTimeDesc(String rootId, Pageable pageable); public Page findByJournalId(String journalId, Pageable pageable); public Page findByJournalIdOrderByPublishTimeDesc(String journalId, Pageable pageable); public Page findByJournalIdOrderByThumbupCountDesc(String journalId, Pageable pageable); diff --git a/luoo_comment/src/main/java/com/luoo/comment/service/CommentService.java b/luoo_comment/src/main/java/com/luoo/comment/service/CommentService.java index 28f2eff..f1fe243 100644 --- a/luoo_comment/src/main/java/com/luoo/comment/service/CommentService.java +++ b/luoo_comment/src/main/java/com/luoo/comment/service/CommentService.java @@ -184,7 +184,7 @@ public class CommentService { public Page findByParentId(String parentId, int page, int size) { Pageable pageable = PageRequest.of(page-1,size); - return commentDao.findByRootIdAndReplyToUserIdNotNull(parentId,pageable); + return commentDao.findByRootIdAndReplyToUserIdNotNullOrderByPublishTimeDesc(parentId,pageable); }