fix: childrenCommentList order by publishTimeDesc

main
wangqing 9 months ago
parent faa7c7cfa7
commit 59a15cca4f

@ -10,7 +10,7 @@ import java.util.List;
public interface CommentDao extends MongoRepository<Comment,String> { public interface CommentDao extends MongoRepository<Comment,String> {
public Page<Comment> findByParentId(String parentId, Pageable pageable); public Page<Comment> findByParentId(String parentId, Pageable pageable);
public Page<Comment> findByRootIdAndReplyToUserIdNotNull(String rootId, Pageable pageable); public Page<Comment> findByRootIdAndReplyToUserIdNotNullOrderByPublishTimeDesc(String rootId, Pageable pageable);
public Page<Comment> findByJournalId(String journalId, Pageable pageable); public Page<Comment> findByJournalId(String journalId, Pageable pageable);
public Page<Comment> findByJournalIdOrderByPublishTimeDesc(String journalId, Pageable pageable); public Page<Comment> findByJournalIdOrderByPublishTimeDesc(String journalId, Pageable pageable);
public Page<Comment> findByJournalIdOrderByThumbupCountDesc(String journalId, Pageable pageable); public Page<Comment> findByJournalIdOrderByThumbupCountDesc(String journalId, Pageable pageable);

@ -184,7 +184,7 @@ public class CommentService {
public Page<Comment> findByParentId(String parentId, int page, int size) { public Page<Comment> findByParentId(String parentId, int page, int size) {
Pageable pageable = PageRequest.of(page-1,size); Pageable pageable = PageRequest.of(page-1,size);
return commentDao.findByRootIdAndReplyToUserIdNotNull(parentId,pageable); return commentDao.findByRootIdAndReplyToUserIdNotNullOrderByPublishTimeDesc(parentId,pageable);
} }

Loading…
Cancel
Save