diff --git a/PARR.DAL/DomainServices/Implementations/ShortcodesService.cs b/PARR.DAL/DomainServices/Implementations/ShortcodesService.cs index 24a45144..dc8ad1ae 100644 --- a/PARR.DAL/DomainServices/Implementations/ShortcodesService.cs +++ b/PARR.DAL/DomainServices/Implementations/ShortcodesService.cs @@ -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); } diff --git a/PARR.DAL/DomainServices/Implementations/UnitFilterService.cs b/PARR.DAL/DomainServices/Implementations/UnitFilterService.cs index d6c071e9..d04180dc 100644 --- a/PARR.DAL/DomainServices/Implementations/UnitFilterService.cs +++ b/PARR.DAL/DomainServices/Implementations/UnitFilterService.cs @@ -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 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); diff --git a/PARR.DAL/Services/Implementations/Unit/UnitInValueService.cs b/PARR.DAL/Services/Implementations/Unit/UnitInValueService.cs index 6af29be5..25f2b41b 100644 --- a/PARR.DAL/Services/Implementations/Unit/UnitInValueService.cs +++ b/PARR.DAL/Services/Implementations/Unit/UnitInValueService.cs @@ -22,14 +22,16 @@ namespace PARR.DAL.Services.Implementations.Unit public async Task> 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> GetByUnitIdsAsync(IEnumerable unitIds) { - return await dataContext.UnitInValues + return await dataContext.UnitInValues.AsNoTracking() + .Include(t=>t.Value) .Where(uv => unitIds.Contains(uv.UnitId)) .ToListAsync(); }