namespace Tiobon.Core.Services;

/// <summary>
/// 参数配置 (服务)
/// </summary>
public class Ghre_ConfigServices : BaseServices<Ghre_Config, Ghre_ConfigDto, InsertGhre_ConfigInput, EditGhre_ConfigInput>, IGhre_ConfigServices
{
    private readonly IBaseRepository<Ghre_Config> _dal;
    public Ghre_ConfigServices(ICaching caching, IBaseRepository<Ghre_Config> dal)
    {
        this._dal = dal;
        base.BaseDal = dal;
        base._caching = caching;
    }

    public async Task<ServiceResult> BulkUpdateValue(List<Ghre_ConfigDto> entitys)
    {
        for (int i = 0; i < entitys.Count; i++)
        {
            await Db.Updateable<Ghre_Config>()
                .SetColumns(it => new Ghre_Config()
               {
                   ConfigValue = entitys[i].ConfigValue
               })
               .Where(x => x.Id == entitys[i].Id).ExecuteCommandAsync();
        }
        return ServiceResult.OprateSuccess();
    }
}