fix commentlist sort

main
wangqing 10 months ago
parent 3d0ca23f6e
commit af8e9d3f96

@ -13,7 +13,7 @@ public interface CommentDao extends MongoRepository<Comment,String> {
public Page<Comment> findByJournalId(String journalId, Pageable pageable);
public List<Comment> findTop5ByJournalIdOrderByThumbupCountDesc(String journalId);
public List<Comment> findTop2ByJournalIdOrderByThumbupCountDesc(String journalId);
public List<Comment> findTop2ByJournalIdOrderByThumbupCountDescPublishTimeDesc(String journalId);
public List<Comment> findByJournalId(String journalId);

@ -20,7 +20,7 @@ import com.luoo.music.pojo.Comment;
public class CommentMapper {
public static List<Comment> getList(String journalId, CommentDao commentDao, UserClient userClient) {
List<Comment> commentList = commentDao.findTop2ByJournalIdOrderByThumbupCountDesc(journalId);
List<Comment> commentList = commentDao.findTop2ByJournalIdOrderByThumbupCountDescPublishTimeDesc(journalId);
if (commentList.size() > 0) {
commentList = commentList.stream().map(comment -> {
UserInfoDTO userInfoDTO = userClient.findByUserId(comment.getUserId());

Loading…
Cancel
Save