You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
Tiobon.Web.Core/Tiobon.Core.Services/Ghrh/Ghrh_ConfigGroupServices.cs

46 lines
1.7 KiB

namespace Tiobon.Core.Services;
/// <summary>
/// 招聘参数配置组 (服务)
/// </summary>
public class Ghrh_ConfigGroupServices : BaseServices<Ghrh_ConfigGroup, Ghrh_ConfigGroupDto, InsertGhrh_ConfigGroupInput, EditGhrh_ConfigGroupInput>, IGhrh_ConfigGroupServices
{
private readonly IBaseRepository<Ghrh_ConfigGroup> _dal;
public Ghrh_ConfigGroupServices(ICaching caching, IBaseRepository<Ghrh_ConfigGroup> dal)
{
this._dal = dal;
base.BaseDal = dal;
base._caching = caching;
}
public override async Task<ServicePageResult<Ghrh_ConfigGroupDto>> 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<Ghrh_Config>().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<ServiceResult> BulkUpdateValue(List<Ghrh_ConfigGroupDto> entitys)
{
for (int i = 0; i < entitys.Count; i++)
{
for (int j = 0; j < entitys[i].Configs.Count; j++)
{
await Db.Updateable<Ghrh_Config>()
.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();
}
}