feat(dal): добавлена таблица UnitKiiUnits + сервисы. Добавлен шорткод ИНДЕКС. В тбл JobGroups добавлено поле GroupingUnitFieldId
This commit is contained in:
@@ -45,7 +45,7 @@ namespace PARR.API.Controllers.V1
|
||||
if (!shortcodes.Any())
|
||||
return NoContent();
|
||||
|
||||
var response = mapper.Map<List<ShortcodeResponse>>(shortcodes);
|
||||
var response = mapper.Map<List<ShortcodeResponse>>(shortcodes).OrderBy(t => t.Shortcode).ToList();
|
||||
|
||||
return Ok(new Response<List<ShortcodeResponse>>(response, true));
|
||||
}
|
||||
|
||||
@@ -84,6 +84,8 @@ namespace PARR.DAL.Context
|
||||
|
||||
public DbSet<UnitRegionalEkPtkGroup> UnitRegionalEkPtkGroups { get; set; }
|
||||
|
||||
public DbSet<UnitKiiUnit> UnitKiiUnits { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Job
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace PARR.DAL.DomainServices.Implementations
|
||||
|
||||
private static readonly HashSet<string> SupportedShortcodes = new(StringComparer.OrdinalIgnoreCase)
|
||||
{
|
||||
"%ЭК%", "%ГРУППА_РАБОТ%", "%РАБОТА%", "%ТНК%", "%СВЯЗИ%", "%ТНК-КРАТКО%", "%СВЯЗИ-ПН%"
|
||||
"%ЭК%", "%ГРУППА_РАБОТ%", "%РАБОТА%", "%ТНК%", "%СВЯЗИ%", "%ТНК-КРАТКО%", "%СВЯЗИ-ПН%", "%ИНДЕКС%"
|
||||
};
|
||||
|
||||
private readonly ILogger<ShortcodesService> logger;
|
||||
@@ -187,6 +187,9 @@ namespace PARR.DAL.DomainServices.Implementations
|
||||
Type = ShortcodeTypeEnum.Standart },
|
||||
new ShortcodeInfoDto { Shortcode = "%ТНК-КРАТКО%",
|
||||
Description = "Краткое наименование ТНК",
|
||||
Type = ShortcodeTypeEnum.Standart },
|
||||
new ShortcodeInfoDto { Shortcode = "%ИНДЕКС%",
|
||||
Description = "Порядковый индекс шаблона для групповых работ",
|
||||
Type = ShortcodeTypeEnum.Standart }
|
||||
});
|
||||
|
||||
|
||||
3921
PARR.DAL/Migrations/20251218225124_tblKiiUnits.Designer.cs
generated
Normal file
3921
PARR.DAL/Migrations/20251218225124_tblKiiUnits.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
43
PARR.DAL/Migrations/20251218225124_tblKiiUnits.cs
Normal file
43
PARR.DAL/Migrations/20251218225124_tblKiiUnits.cs
Normal file
@@ -0,0 +1,43 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace PARR.DAL.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class tblKiiUnits : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "KiiUnits",
|
||||
schema: "unit",
|
||||
columns: table => new
|
||||
{
|
||||
UnitId = table.Column<Guid>(type: "uuid", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_KiiUnits", x => x.UnitId);
|
||||
table.ForeignKey(
|
||||
name: "FK_KiiUnits_Units_UnitId",
|
||||
column: x => x.UnitId,
|
||||
principalSchema: "unit",
|
||||
principalTable: "Units",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
},
|
||||
comment: "Таблица - Список ЭК КИИ, которые учавствуют в групповых работах. Создавалась как временная");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "KiiUnits",
|
||||
schema: "unit");
|
||||
}
|
||||
}
|
||||
}
|
||||
3924
PARR.DAL/Migrations/20251218230447_tblJobGroupAddUnitFieldId.Designer.cs
generated
Normal file
3924
PARR.DAL/Migrations/20251218230447_tblJobGroupAddUnitFieldId.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,31 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace PARR.DAL.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class tblJobGroupAddUnitFieldId : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "UnitFieldId",
|
||||
schema: "job",
|
||||
table: "Groups",
|
||||
type: "uuid",
|
||||
nullable: true);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "UnitFieldId",
|
||||
schema: "job",
|
||||
table: "Groups");
|
||||
}
|
||||
}
|
||||
}
|
||||
3924
PARR.DAL/Migrations/20251218230702_tblJobGroupAddUnitFieldIdRename.Designer.cs
generated
Normal file
3924
PARR.DAL/Migrations/20251218230702_tblJobGroupAddUnitFieldIdRename.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,30 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace PARR.DAL.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class tblJobGroupAddUnitFieldIdRename : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "UnitFieldId",
|
||||
schema: "job",
|
||||
table: "Groups",
|
||||
newName: "GroupingUnitFieldId");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "GroupingUnitFieldId",
|
||||
schema: "job",
|
||||
table: "Groups",
|
||||
newName: "UnitFieldId");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1685,6 +1685,9 @@ namespace PARR.DAL.Migrations
|
||||
b.Property<Guid>("GroupTypeId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid?>("GroupingUnitFieldId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<bool>("IsAgent")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
@@ -2981,6 +2984,19 @@ namespace PARR.DAL.Migrations
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.Unit.UnitKiiUnit", b =>
|
||||
{
|
||||
b.Property<Guid>("UnitId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("UnitId");
|
||||
|
||||
b.ToTable("KiiUnits", "unit", t =>
|
||||
{
|
||||
t.HasComment("Таблица - Список ЭК КИИ, которые учавствуют в групповых работах. Создавалась как временная");
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.Unit.UnitRegionalEkPtkGroup", b =>
|
||||
{
|
||||
b.Property<Guid>("FieldValueId")
|
||||
@@ -3604,6 +3620,17 @@ namespace PARR.DAL.Migrations
|
||||
b.Navigation("Value");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.Unit.UnitKiiUnit", b =>
|
||||
{
|
||||
b.HasOne("PARR.DAL.Models.Unit.Unit", "Unit")
|
||||
.WithOne("UnitKii")
|
||||
.HasForeignKey("PARR.DAL.Models.Unit.UnitKiiUnit", "UnitId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Unit");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.Unit.UnitRegionalEkPtkGroup", b =>
|
||||
{
|
||||
b.HasOne("PARR.DAL.Models.Unit.UnitFieldValue", "FieldValue")
|
||||
@@ -3852,6 +3879,8 @@ namespace PARR.DAL.Migrations
|
||||
|
||||
b.Navigation("UnitFields");
|
||||
|
||||
b.Navigation("UnitKii");
|
||||
|
||||
b.Navigation("UnitValues");
|
||||
});
|
||||
|
||||
|
||||
@@ -115,8 +115,19 @@ namespace PARR.DAL.Models.Job
|
||||
/// </summary>
|
||||
public string? AgentScript { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Тип группы
|
||||
/// </summary>
|
||||
public Guid GroupTypeId { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Если тип группы - "Сгруппированный", то это поле обязательно, по нему будем группировать
|
||||
/// TODO: !!!! Связь с иаблице UnitField не создавалась! Нужно это переделать и унести в отдельную таблицу
|
||||
/// </summary>
|
||||
public Guid? GroupingUnitFieldId { get; set; }
|
||||
|
||||
|
||||
[ForeignKey(nameof(GroupTypeId))]
|
||||
public JobGroupType? GroupType { get; set; }
|
||||
|
||||
|
||||
@@ -77,6 +77,9 @@ namespace PARR.DAL.Models.Unit
|
||||
/// К одному шаблону привязано несколько ЭК(Груповой тип работы). Многие ко многим
|
||||
/// </summary>
|
||||
public ICollection<UnitsInTemplate> TemplatesInUnit { get; set; } = new HashSet<UnitsInTemplate>();
|
||||
|
||||
|
||||
public UnitKiiUnit? UnitKii { get; set; }
|
||||
}
|
||||
|
||||
|
||||
|
||||
23
PARR.DAL/Models/Unit/UnitKiiUnit.cs
Normal file
23
PARR.DAL/Models/Unit/UnitKiiUnit.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using PARR.DAL.Context;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace PARR.DAL.Models.Unit
|
||||
{
|
||||
/// <summary>
|
||||
/// Список ЭК КИИ, которые учавствуют в групповых работах. Создавалась как временная
|
||||
/// </summary>
|
||||
[Table("KiiUnits", Schema = DataContextSettings.Unit)]
|
||||
[Comment("Таблица - Список ЭК КИИ, которые учавствуют в групповых работах. Создавалась как временная")]
|
||||
public class UnitKiiUnit
|
||||
{
|
||||
//TODO: создавалась как временная таблица
|
||||
|
||||
[Key]
|
||||
public Guid UnitId { get; set; }
|
||||
|
||||
[ForeignKey(nameof(UnitId))]
|
||||
public Unit? Unit { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -101,6 +101,7 @@ namespace PARR.DAL
|
||||
services.AddTransient<IUnitInUnitService, UnitInUnitService>();
|
||||
services.AddTransient<IUnitInValueService, UnitInValueService>();
|
||||
services.AddTransient<IUnitRegionalEkPtkGroupService, UnitRegionalEkPtkGroupService>();
|
||||
services.AddTransient<IUnitKiiUnitService, UnitKiiUnitService>();
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
21
PARR.DAL/Services/Implementations/Unit/UnitKiiUnitService.cs
Normal file
21
PARR.DAL/Services/Implementations/Unit/UnitKiiUnitService.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using PARR.DAL.Context;
|
||||
using PARR.DAL.Models.Unit;
|
||||
using PARR.DAL.Services.Interfaces.Unit;
|
||||
|
||||
namespace PARR.DAL.Services.Implementations.Unit
|
||||
{
|
||||
internal class UnitKiiUnitService : IUnitKiiUnitService
|
||||
{
|
||||
private readonly DataContext dataContext;
|
||||
|
||||
public UnitKiiUnitService(DataContext dataContext)
|
||||
{
|
||||
this.dataContext = dataContext;
|
||||
}
|
||||
|
||||
public IQueryable<UnitKiiUnit> Get()
|
||||
{
|
||||
return dataContext.UnitKiiUnits;
|
||||
}
|
||||
}
|
||||
}
|
||||
9
PARR.DAL/Services/Interfaces/Unit/IUnitKiiUnitService.cs
Normal file
9
PARR.DAL/Services/Interfaces/Unit/IUnitKiiUnitService.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
using PARR.DAL.Models.Unit;
|
||||
|
||||
namespace PARR.DAL.Services.Interfaces.Unit
|
||||
{
|
||||
public interface IUnitKiiUnitService
|
||||
{
|
||||
IQueryable<UnitKiiUnit> Get();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user