blob: 74234188332656e89a4c0a25eb281710d5eb392a [file] [log] [blame]
夜雨声烦f4b8b6f2025-04-24 00:58:36 +08001package com.example.g8backend.mapper;
2
3import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4import com.example.g8backend.entity.PostView;
5import org.apache.ibatis.annotations.Mapper;
6import org.apache.ibatis.annotations.Param;
7import org.apache.ibatis.annotations.Select;
8
9import java.util.List;
10
11@Mapper
12public interface PostViewMapper extends BaseMapper<PostView> {
13
14
15 @Select("SELECT post_id FROM post_views WHERE user_id = #{userId}")
16 List<Long> findViewedPostIds(@Param("userId") Long userId);
17
18
19 @Select("SELECT * FROM post_views WHERE user_id = #{userId} ORDER BY view_time DESC LIMIT #{limit}")
20 List<PostView> selectRecentViews(@Param("userId") Long userId, @Param("limit") int limit);
21}