feat(aihitMainSyncer): Написана логика создания новых Unit и Field.

This commit is contained in:
Mikhail Kuznetsov
2025-05-19 16:09:55 +10:00
parent 082bc9bf15
commit 1ce8fcb284
18 changed files with 328 additions and 12 deletions

View File

@@ -19,5 +19,10 @@ namespace PARR.DAL.Services.Implementations.Unit
{
this.dataContext = dataContext;
}
public async Task<UnitField?> GetByAihitNameAsync(string name)
{
return await EntitySet.FirstOrDefaultAsync(uf => uf.AihitName.ToLower() == name.ToLower());
}
}
}

View File

@@ -18,5 +18,20 @@ namespace PARR.DAL.Services.Implementations.Unit
{
this.dataContext = dataContext;
}
public async Task<Models.Unit.Unit?> GetUnitWithFieldsAsync(string name)
{
return await GetUnitWithIncludeFields()
.FirstOrDefaultAsync(u => u.Name.ToLower() == name.ToLower());
}
private IQueryable<Models.Unit.Unit> GetUnitWithIncludeFields()
{
return EntitySet
.Include(t => t.UnitFields)
.ThenInclude(f => f.UnitField);
}
}
}

View File

@@ -3,7 +3,8 @@ using PARR.DAL.Services.Interfaces.Base;
namespace PARR.DAL.Services.Interfaces.Unit
{
public interface IUnitFieldService: IBaseService<UnitField>
public interface IUnitFieldService : IBaseService<UnitField>
{
Task<UnitField?> GetByAihitNameAsync(string name);
}
}

View File

@@ -4,5 +4,6 @@ namespace PARR.DAL.Services.Interfaces.Unit
{
public interface IUnitService : IBaseService<Models.Unit.Unit>
{
Task<Models.Unit.Unit?> GetUnitWithFieldsAsync(string name);
}
}