feat(api): в сущность FIeld добавлено поле IsMultipleValue для реализации записи повторяющихся полей, как сервер приложений в компонентном составе виртуальных серверов

This commit is contained in:
Mikhail Kuznetsov
2025-09-22 15:25:17 +10:00
parent 8b0f173abe
commit 6ca6e65224
16 changed files with 3996 additions and 87 deletions

View File

@@ -87,7 +87,7 @@ namespace PARR.DAL.Context
#region Job
public DbSet<FieldFilter> FieldFilters { get; set; }
public DbSet<JobFieldFilter> FieldFilters { get; set; }
public DbSet<Job> Jobs { get; set; }

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,52 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace PARR.DAL.Migrations
{
/// <inheritdoc />
public partial class tblUnitFieldsAddIsMultipleValueClmn : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropPrimaryKey(
name: "PK_UnitInValues",
schema: "unit",
table: "UnitInValues");
migrationBuilder.AddColumn<bool>(
name: "IsMultipleValue",
schema: "unit",
table: "Fields",
type: "boolean",
nullable: true);
migrationBuilder.AddPrimaryKey(
name: "PK_UnitInValues",
schema: "unit",
table: "UnitInValues",
columns: new[] { "UnitId", "FieldId", "ValueId" });
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropPrimaryKey(
name: "PK_UnitInValues",
schema: "unit",
table: "UnitInValues");
migrationBuilder.DropColumn(
name: "IsMultipleValue",
schema: "unit",
table: "Fields");
migrationBuilder.AddPrimaryKey(
name: "PK_UnitInValues",
schema: "unit",
table: "UnitInValues",
columns: new[] { "UnitId", "FieldId" });
}
}
}

View File

@@ -1542,40 +1542,6 @@ namespace PARR.DAL.Migrations
b.ToTable("Hosts");
});
modelBuilder.Entity("PARR.DAL.Models.Job.FieldFilter", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<Guid>("FieldId")
.HasColumnType("uuid");
b.Property<Guid>("UnitFilterId")
.HasColumnType("uuid");
b.Property<string>("ValueMask")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("FieldId");
b.HasIndex("UnitFilterId");
b.ToTable("FieldFilters", "job", t =>
{
t.HasComment("Таблица описания критериев выборки аттрибутов ЭК");
});
});
modelBuilder.Entity("PARR.DAL.Models.Job.Job", b =>
{
b.Property<Guid>("Id")
@@ -1631,6 +1597,40 @@ namespace PARR.DAL.Migrations
});
});
modelBuilder.Entity("PARR.DAL.Models.Job.JobFieldFilter", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<Guid>("FieldId")
.HasColumnType("uuid");
b.Property<Guid>("UnitFilterId")
.HasColumnType("uuid");
b.Property<string>("ValueMask")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("FieldId");
b.HasIndex("UnitFilterId");
b.ToTable("FieldFilters", "job", t =>
{
t.HasComment("Таблица описания критериев выборки аттрибутов ЭК");
});
});
modelBuilder.Entity("PARR.DAL.Models.Job.JobGroup", b =>
{
b.Property<Guid>("Id")
@@ -2790,6 +2790,9 @@ namespace PARR.DAL.Migrations
b.Property<string>("EsppName")
.HasColumnType("text");
b.Property<bool?>("IsMultipleValue")
.HasColumnType("boolean");
b.HasKey("Id");
b.HasIndex("AihitName");
@@ -2899,16 +2902,16 @@ namespace PARR.DAL.Migrations
b.Property<Guid>("FieldId")
.HasColumnType("uuid");
b.Property<Guid>("ValueId")
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<Guid>("ValueId")
.HasColumnType("uuid");
b.HasKey("UnitId", "FieldId");
b.HasKey("UnitId", "FieldId", "ValueId");
b.HasIndex("FieldId");
@@ -3237,25 +3240,6 @@ namespace PARR.DAL.Migrations
b.Navigation("WorkGroup");
});
modelBuilder.Entity("PARR.DAL.Models.Job.FieldFilter", b =>
{
b.HasOne("PARR.DAL.Models.Unit.UnitField", "Field")
.WithMany()
.HasForeignKey("FieldId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PARR.DAL.Models.Job.JobUnitFilter", "UnitFilter")
.WithMany("FieldFilters")
.HasForeignKey("UnitFilterId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Field");
b.Navigation("UnitFilter");
});
modelBuilder.Entity("PARR.DAL.Models.Job.Job", b =>
{
b.HasOne("PARR.DAL.Models.Job.JobGroup", "Group")
@@ -3275,6 +3259,25 @@ namespace PARR.DAL.Migrations
b.Navigation("Tnk");
});
modelBuilder.Entity("PARR.DAL.Models.Job.JobFieldFilter", b =>
{
b.HasOne("PARR.DAL.Models.Unit.UnitField", "UnitField")
.WithMany()
.HasForeignKey("FieldId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PARR.DAL.Models.Job.JobUnitFilter", "UnitFilter")
.WithMany("FieldFilters")
.HasForeignKey("UnitFilterId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("UnitField");
b.Navigation("UnitFilter");
});
modelBuilder.Entity("PARR.DAL.Models.Job.JobRelationshipFilter", b =>
{
b.HasOne("PARR.DAL.Models.Unit.UnitField", "UnitField")
@@ -3486,7 +3489,7 @@ namespace PARR.DAL.Migrations
modelBuilder.Entity("PARR.DAL.Models.Unit.UnitFieldInUnitFieldValue", b =>
{
b.HasOne("PARR.DAL.Models.Unit.UnitField", "Field")
.WithMany("FieldValues")
.WithMany("UnitFieldValues")
.HasForeignKey("FieldId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
@@ -3796,10 +3799,10 @@ namespace PARR.DAL.Migrations
modelBuilder.Entity("PARR.DAL.Models.Unit.UnitField", b =>
{
b.Navigation("FieldValues");
b.Navigation("RelationshipFilters");
b.Navigation("UnitFieldValues");
b.Navigation("UnitInValues");
b.Navigation("Units");

View File

@@ -9,7 +9,7 @@ namespace PARR.DAL.Models.Job
{
[Table("FieldFilters", Schema = DataContextSettings.Job)]
[Comment("Таблица описания критериев выборки аттрибутов ЭК")]
public class FieldFilter : IBase//TODO Почему этот не Job тра та та
public class JobFieldFilter : IBase
{
[Key]
public Guid Id { get; set; }
@@ -26,7 +26,7 @@ namespace PARR.DAL.Models.Job
[ForeignKey(nameof(FieldId))]
public UnitField? Field { get; set; }//TODO как-то определитесь уже просто Field или UnitField
public UnitField? UnitField { get; set; }
[ForeignKey(nameof(UnitFilterId))]
public JobUnitFilter? UnitFilter { get; set; }

View File

@@ -8,7 +8,7 @@ namespace PARR.DAL.Models.Job
[Table("RelationshipFilters", Schema = DataContextSettings.Job)]
[Comment("Таблица фильтров связей ЭК")]
[PrimaryKey(nameof(UnitFilterId), nameof(FieldId))]
public class JobRelationshipFilter //: IBase //TODO Почему этот Job тра та та
public class JobRelationshipFilter //: IBase
{
//[Key]
//public Guid Id { get; set; }
@@ -45,7 +45,7 @@ namespace PARR.DAL.Models.Job
[ForeignKey(nameof(FieldId))]
public UnitField? UnitField { get; set; }//TODO как-то определитесь уже просто Field или UnitField
public UnitField? UnitField { get; set; }

View File

@@ -24,7 +24,7 @@ namespace PARR.DAL.Models.Job
[ForeignKey(nameof(JobId))]
public Job? Job { get; set; }
public ICollection<FieldFilter> FieldFilters { get; set; } = new HashSet<FieldFilter>();
public ICollection<JobFieldFilter> FieldFilters { get; set; } = new HashSet<JobFieldFilter>();
public ICollection<JobRelationshipFilter> RelationshipFilters { get; set; } = new HashSet<JobRelationshipFilter>();
}

View File

@@ -41,6 +41,10 @@ namespace PARR.DAL.Models.Unit
/// </summary>
public string? DisplayName { get; set; }
/// <summary>
/// Могут ли принимать несколько значений. Из АИХ ИТ приходят значения разделённые запятой
/// </summary>
public bool? IsMultipleValue { get; set; }
public ICollection<UnitInField> Units { get; set; } = new HashSet<UnitInField>();
@@ -48,7 +52,7 @@ namespace PARR.DAL.Models.Unit
public ICollection<UnitInValue> UnitInValues { get; set; } = new HashSet<UnitInValue>();
public ICollection<UnitFieldInUnitFieldValue> FieldValues { get; set; } = new HashSet<UnitFieldInUnitFieldValue>();
public ICollection<UnitFieldInUnitFieldValue> UnitFieldValues { get; set; } = new HashSet<UnitFieldInUnitFieldValue>();
public ICollection<JobRelationshipFilter> RelationshipFilters { get; set; } = new HashSet<JobRelationshipFilter>();
}

View File

@@ -8,7 +8,7 @@ namespace PARR.DAL.Models.Unit
[Table("UnitInValues", Schema = DataContextSettings.Unit)]
[Comment("Таблица связи ЭК с полями и со значениями")]
[PrimaryKey(nameof(UnitId), nameof(FieldId))]
[PrimaryKey(nameof(UnitId), nameof(FieldId), nameof(ValueId))]
public class UnitInValue : IBaseDateModified, IBaseDateCreated
{
public Guid UnitId { get; set; }

View File

@@ -6,11 +6,11 @@ using PARR.DAL.Services.Interfaces.Job;
namespace PARR.DAL.Services.Implementations.Job
{
internal class FieldFilterService : BaseService<Models.Job.FieldFilter>, IFieldFilterService
internal class FieldFilterService : BaseService<Models.Job.JobFieldFilter>, IFieldFilterService
{
private readonly DataContext dataContext;
protected override DbSet<Models.Job.FieldFilter> EntitySet => dataContext.FieldFilters;
protected override DbSet<Models.Job.JobFieldFilter> EntitySet => dataContext.FieldFilters;
protected override DataContext EntitiContext => dataContext;
public FieldFilterService(DataContext dataContext, ILogger<FieldFilterService> logger) : base(logger)

View File

@@ -2,7 +2,7 @@
namespace PARR.DAL.Services.Interfaces.Job
{
public interface IFieldFilterService : IBaseService<Models.Job.FieldFilter>
public interface IFieldFilterService : IBaseService<Models.Job.JobFieldFilter>
{
}
}