namespace Tiobon.Core.Services;

/// <summary>
/// 招聘参数配置 (服务)
/// </summary>
public class Ghrh_ConfigServices : BaseServices<Ghrh_Config, Ghrh_ConfigDto, InsertGhrh_ConfigInput, EditGhrh_ConfigInput>, IGhrh_ConfigServices
{
    private readonly IBaseRepository<Ghrh_Config> _dal;
    public Ghrh_ConfigServices(ICaching caching, IBaseRepository<Ghrh_Config> dal)
    {
        this._dal = dal;
        base.BaseDal = dal;
        base._caching = caching;
    }

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