namespace Tiobon.Core.Services;
///
/// 招聘参数配置组 (服务)
///
public class Ghrh_ConfigGroupServices : BaseServices, IGhrh_ConfigGroupServices
{
private readonly IBaseRepository _dal;
public Ghrh_ConfigGroupServices(ICaching caching, IBaseRepository dal)
{
this._dal = dal;
base.BaseDal = dal;
base._caching = caching;
}
public override async Task> QueryFilterPage(QueryBody filter, string condition, bool? IsEnable = true)
{
filter.orderBy = "SortNo ASC";
var result = await base.QueryFilterPage(filter, condition, IsEnable);
var configs = await Db.Queryable().OrderBy(x => x.Sequence).ToListAsync();
result.result.DT_TableDataT1.ForEach(x =>
{
x.Configs = configs.Where(o => o.GroupId == x.Id).ToList();
});
return result;
}
public async Task BulkUpdateValue(List entitys)
{
for (int i = 0; i < entitys.Count; i++)
{
for (int j = 0; j < entitys[i].Configs.Count; j++)
{
await Db.Updateable()
.SetColumns(it => new Ghrh_Config()
{
ConfigValue = entitys[i].Configs[j].ConfigValue
}, true)
.Where(x => x.Id == entitys[i].Configs[j].Id)
.ExecuteCommandAsync();
}
}
return ServiceResult.OprateSuccess();
}
}