feat(aihitMainSyncer): реализована логика синхронизации таблиц unit.* с данными из АИХ ИТ
This commit is contained in:
@@ -19,5 +19,17 @@ namespace PARR.DAL.Services.Implementations.Unit
|
||||
{
|
||||
this.dataContext = dataContext;
|
||||
}
|
||||
|
||||
|
||||
public async Task<UnitFieldValue?> GetByValueNameAsync(string? value)
|
||||
{
|
||||
var query = EntitySet
|
||||
.Include(v => v.FieldValues);
|
||||
|
||||
if (string.IsNullOrWhiteSpace(value))
|
||||
return await query.FirstOrDefaultAsync(uf => uf.Value == null);
|
||||
|
||||
return await query.FirstOrDefaultAsync(uf => uf.Value!.ToLower() == value.ToLower());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,18 +20,20 @@ namespace PARR.DAL.Services.Implementations.Unit
|
||||
}
|
||||
|
||||
|
||||
public async Task<Models.Unit.Unit?> GetUnitWithFieldsAsync(string name)
|
||||
public async Task<Models.Unit.Unit?> GetUnitByName(string name)
|
||||
{
|
||||
return await GetUnitWithIncludeFields()
|
||||
return await GetUnitWithFieldsAndValues()
|
||||
.FirstOrDefaultAsync(u => u.Name.ToLower() == name.ToLower());
|
||||
}
|
||||
|
||||
|
||||
private IQueryable<Models.Unit.Unit> GetUnitWithIncludeFields()
|
||||
private IQueryable<Models.Unit.Unit> GetUnitWithFieldsAndValues()
|
||||
{
|
||||
return EntitySet
|
||||
.Include(t => t.UnitFields)
|
||||
.ThenInclude(f => f.UnitField);
|
||||
.Include(u => u.UnitFields)
|
||||
.ThenInclude(f => f.UnitField)
|
||||
.Include(u => u.UnitValues)
|
||||
.ThenInclude(v => v.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user