package com.ruoyi.novel.mapper;

// AdLogMapper.java
@Mapper
public interface AdLogMapper extends BaseMapper<AdLog> {

    @Select("SELECT COUNT(*) FROM novel_ad_log WHERE user_id = #{userId} AND chapter_id = #{chapterId}")
    int countByUserAndChapter(@Param("userId") Long userId, @Param("chapterId") Long chapterId);

    @Select("SELECT * FROM novel_ad_log WHERE sync_status = 0 ORDER BY view_time ASC LIMIT 100")
    List<AdLog> selectUnsyncedLogs();
}