This commit is contained in:
2025-07-25 16:18:33 +08:00
parent c09cbc3f01
commit a4c6140ed5
50 changed files with 2249 additions and 1599 deletions
@@ -68,4 +68,16 @@ public interface MessageMapper extends BaseMapper<Message> {
List<Message> searchByUserIdAndKeyword(@Param("userId") String userId,
@Param("keyword") String keyword,
@Param("limit") Integer limit);
/**
* 根据用户ID获取最近的消息
*/
@Select("SELECT m.* FROM message m " +
"INNER JOIN conversation c ON m.conversation_id = c.id " +
"WHERE c.user_id = #{userId} " +
"AND m.is_deleted = 0 " +
"ORDER BY m.create_time DESC " +
"LIMIT #{limit}")
List<Message> getRecentByUserId(@Param("userId") String userId,
@Param("limit") Integer limit);
}