package com.xuekairui.user.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.xuekairui.user.entity.TrialQuotaConfig; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Select; import java.time.LocalDateTime; import java.util.List; /** * 体验配额配置Mapper */ @Mapper public interface TrialQuotaConfigMapper extends BaseMapper { /** * 查询当前生效的默认配置 */ @Select("SELECT * FROM t_trial_quota_config WHERE config_type = 'DEFAULT' AND enabled = true " + "AND (effective_from IS NULL OR effective_from <= #{now}) " + "AND (effective_to IS NULL OR effective_to >= #{now}) " + "ORDER BY create_time DESC LIMIT 1") TrialQuotaConfig selectActiveDefaultConfig(LocalDateTime now); /** * 查询所有启用的配置 */ @Select("SELECT * FROM t_trial_quota_config WHERE enabled = true ORDER BY priority ASC") List selectEnabledConfigs(); }