diff --git a/luoo_user/src/main/java/com/luoo/user/dao/UserMessageDao.java b/luoo_user/src/main/java/com/luoo/user/dao/UserMessageDao.java index bdc5112..cd3f9f2 100644 --- a/luoo_user/src/main/java/com/luoo/user/dao/UserMessageDao.java +++ b/luoo_user/src/main/java/com/luoo/user/dao/UserMessageDao.java @@ -13,7 +13,7 @@ public interface UserMessageDao extends MongoRepository { List findAllByUserId(String userId); - Page findByUserId(String userId, Pageable pageable); + Page findByUserIdOrderBySendTimeDesc(String userId, Pageable pageable); } diff --git a/luoo_user/src/main/java/com/luoo/user/service/UserMessageService.java b/luoo_user/src/main/java/com/luoo/user/service/UserMessageService.java index 98ef26a..5ec6e24 100644 --- a/luoo_user/src/main/java/com/luoo/user/service/UserMessageService.java +++ b/luoo_user/src/main/java/com/luoo/user/service/UserMessageService.java @@ -53,7 +53,7 @@ public class UserMessageService { PageRequest pageRequest = PageRequest.of(page-1,size); - return userMessageDao.findByUserId(userId,pageRequest); + return userMessageDao.findByUserIdOrderBySendTimeDesc(userId,pageRequest); }