TrialQuotaConfigMapper.java 1.0 KB

12345678910111213141516171819202122232425262728293031
  1. package com.xuekairui.user.mapper;
  2. import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  3. import com.xuekairui.user.entity.TrialQuotaConfig;
  4. import org.apache.ibatis.annotations.Mapper;
  5. import org.apache.ibatis.annotations.Select;
  6. import java.time.LocalDateTime;
  7. import java.util.List;
  8. /**
  9. * 体验配额配置Mapper
  10. */
  11. @Mapper
  12. public interface TrialQuotaConfigMapper extends BaseMapper<TrialQuotaConfig> {
  13. /**
  14. * 查询当前生效的默认配置
  15. */
  16. @Select("SELECT * FROM t_trial_quota_config WHERE config_type = 'DEFAULT' AND enabled = true " +
  17. "AND (effective_from IS NULL OR effective_from <= #{now}) " +
  18. "AND (effective_to IS NULL OR effective_to >= #{now}) " +
  19. "ORDER BY create_time DESC LIMIT 1")
  20. TrialQuotaConfig selectActiveDefaultConfig(LocalDateTime now);
  21. /**
  22. * 查询所有启用的配置
  23. */
  24. @Select("SELECT * FROM t_trial_quota_config WHERE enabled = true ORDER BY priority ASC")
  25. List<TrialQuotaConfig> selectEnabledConfigs();
  26. }