feat(dal): ShortcodesService добавлена обработка динамичесих составляющих "%СВЯЗИ%", "%ТНК-КРАТКО%"
This commit is contained in:
40
PARR.DAL/Services/Implementations/Unit/UnitInUnitService.cs
Normal file
40
PARR.DAL/Services/Implementations/Unit/UnitInUnitService.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using PARR.DAL.Context;
|
||||
using PARR.DAL.Models.Unit;
|
||||
using PARR.DAL.Services.Abstracts;
|
||||
using PARR.DAL.Services.Interfaces.Unit;
|
||||
|
||||
namespace PARR.DAL.Services.Implementations.Unit
|
||||
{
|
||||
internal class UnitInUnitService : IUnitInUnitService
|
||||
{
|
||||
private readonly DataContext dataContext;
|
||||
private readonly ILogger<UnitInUnitService> logger;
|
||||
|
||||
public UnitInUnitService(
|
||||
DataContext dataContext,
|
||||
ILogger<UnitInUnitService> logger
|
||||
)
|
||||
{
|
||||
this.dataContext = dataContext;
|
||||
this.logger = logger;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public Task<List<UnitInUnit>> GetByParentIdAsync(Guid parentId)
|
||||
{
|
||||
return dataContext.UnitInUnits
|
||||
.Where(u => u.ParentUnitId == parentId)
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
public Task<List<UnitInUnit>> GetByChildIdAsync(Guid childId)
|
||||
{
|
||||
return dataContext.UnitInUnits
|
||||
.Where(u => u.ChildUnitId == childId)
|
||||
.ToListAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
37
PARR.DAL/Services/Implementations/Unit/UnitInValueService.cs
Normal file
37
PARR.DAL/Services/Implementations/Unit/UnitInValueService.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using PARR.DAL.Context;
|
||||
using PARR.DAL.Models.Unit;
|
||||
using PARR.DAL.Services.Interfaces.Unit;
|
||||
|
||||
namespace PARR.DAL.Services.Implementations.Unit
|
||||
{
|
||||
internal class UnitInValueService : IUnitInValueService
|
||||
{
|
||||
private readonly ILogger<UnitInValueService> logger;
|
||||
private readonly DataContext dataContext;
|
||||
|
||||
public UnitInValueService(
|
||||
ILogger<UnitInValueService> logger,
|
||||
DataContext dataContext
|
||||
)
|
||||
{
|
||||
this.logger = logger;
|
||||
this.dataContext = dataContext;
|
||||
}
|
||||
|
||||
public async Task<List<UnitInValue>> GetByUnitIdAsync(Guid unitId)
|
||||
{
|
||||
return await dataContext.UnitInValues
|
||||
.Where(uv => uv.UnitId == unitId)
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<List<UnitInValue>> GetByUnitIdsAsync(IEnumerable<Guid> unitIds)
|
||||
{
|
||||
return await dataContext.UnitInValues
|
||||
.Where(uv => unitIds.Contains(uv.UnitId))
|
||||
.ToListAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
11
PARR.DAL/Services/Interfaces/Unit/IUnitInUnitService.cs
Normal file
11
PARR.DAL/Services/Interfaces/Unit/IUnitInUnitService.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
using PARR.DAL.Models.Unit;
|
||||
using PARR.DAL.Services.Interfaces.Base;
|
||||
|
||||
namespace PARR.DAL.Services.Interfaces.Unit
|
||||
{
|
||||
public interface IUnitInUnitService
|
||||
{
|
||||
Task<List<UnitInUnit>> GetByParentIdAsync(Guid parentId);
|
||||
Task<List<UnitInUnit>> GetByChildIdAsync(Guid childId);
|
||||
}
|
||||
}
|
||||
15
PARR.DAL/Services/Interfaces/Unit/IUnitInValueService.cs
Normal file
15
PARR.DAL/Services/Interfaces/Unit/IUnitInValueService.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using PARR.DAL.Models.Unit;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace PARR.DAL.Services.Interfaces.Unit
|
||||
{
|
||||
public interface IUnitInValueService
|
||||
{
|
||||
Task<List<UnitInValue>> GetByUnitIdsAsync(IEnumerable<Guid> unitIds);
|
||||
Task<List<UnitInValue>> GetByUnitIdAsync(Guid unitId);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user