namespace Repository;

public interface IConfigRepository : IBaseRepository<ConfigEntity>
{
    /// <summary>
    /// 根据Key获取配置
    /// </summary>
    Task<ConfigEntity?> GetByKeyAsync(string key);
}

public class ConfigRepository(IFreeSql freeSql) : BaseRepository<ConfigEntity>(freeSql), IConfigRepository
{
    public async Task<ConfigEntity?> GetByKeyAsync(string key)
    {
        return await FreeSql.Select<ConfigEntity>()
            .Where(c => c.Key == key)
            .FirstAsync();
    }
}
