优化
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user