fix(dal): UnitInValueService добавлены include для получение данных с Value, чтобы проверять не только по id но и непосредственно по значению
This commit is contained in:
@@ -78,7 +78,7 @@ namespace PARR.DAL.DomainServices.Implementations
|
||||
// 3. %СВЯЗИ% — отдельная обработка
|
||||
if (shortcodesInMask.Any(m => string.Equals(m.Value, "%СВЯЗИ%", StringComparison.OrdinalIgnoreCase)))
|
||||
{
|
||||
var relatedUnitNames = await unitFilterService.GetRelatedUnitNamesAsync(jobId, unitId);//GetRelatedUnitNamesAsync(job, unit);
|
||||
var relatedUnitNames = await unitFilterService.GetRelatedUnitNamesAsync(jobId, unitId);
|
||||
var linksText = string.Join("\n", relatedUnitNames);
|
||||
resultName = Regex.Replace(resultName, "%СВЯЗИ%", linksText, RegexOptions.IgnoreCase);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using PARR.DAL.Context;
|
||||
using PARR.DAL.Contracts;
|
||||
using PARR.DAL.DomainServices.Interfaces;
|
||||
using PARR.DAL.Models.Job;
|
||||
@@ -154,19 +153,11 @@ namespace PARR.DAL.DomainServices.Implementations
|
||||
continue;
|
||||
}
|
||||
|
||||
// --- НОВАЯ ЛОГИКА: Используем новые сервисы ---
|
||||
|
||||
List<UnitInUnit> relevantLinks;
|
||||
if (rf.IsParent)
|
||||
{
|
||||
// u - родитель, его ребёнок - unitId
|
||||
relevantLinks = await unitInUnitService.GetByChildIdAsync(unitId);
|
||||
}
|
||||
else
|
||||
{
|
||||
// u - ребёнок, его родитель - unitId
|
||||
relevantLinks = await unitInUnitService.GetByParentIdAsync(unitId);
|
||||
}
|
||||
|
||||
logger.LogDebug("Найдено {Count} связей через UnitInUnitService.", relevantLinks.Count);
|
||||
|
||||
|
||||
@@ -22,14 +22,16 @@ namespace PARR.DAL.Services.Implementations.Unit
|
||||
|
||||
public async Task<List<UnitInValue>> GetByUnitIdAsync(Guid unitId)
|
||||
{
|
||||
return await dataContext.UnitInValues
|
||||
return await dataContext.UnitInValues.AsNoTracking()
|
||||
.Include(t => t.Value)
|
||||
.Where(uv => uv.UnitId == unitId)
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<List<UnitInValue>> GetByUnitIdsAsync(IEnumerable<Guid> unitIds)
|
||||
{
|
||||
return await dataContext.UnitInValues
|
||||
return await dataContext.UnitInValues.AsNoTracking()
|
||||
.Include(t=>t.Value)
|
||||
.Where(uv => unitIds.Contains(uv.UnitId))
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user