Browse Source

字段对照实体

master
wxd 1 year ago
parent
commit
f2d57a1257
  1. 60
      src/Shentun.Peis.Domain/CommonTableTypes/CommonTableType.cs
  2. 59
      src/Shentun.Peis.Domain/CommonTables/CommonTable.cs
  3. 2
      src/Shentun.Peis.Domain/Shentun.Peis.Domain.csproj
  4. 26
      src/Shentun.Peis.EntityFrameworkCore/DbMapping/CommonTableTypes/CommonTableTypeDbMapping.cs
  5. 36
      src/Shentun.Peis.EntityFrameworkCore/DbMapping/CommonTables/CommonTableDbMapping.cs
  6. 6
      src/Shentun.Peis.EntityFrameworkCore/EntityFrameworkCore/PeisDbContext.cs
  7. 15434
      src/Shentun.Peis.EntityFrameworkCore/Migrations/20240815022647_insert_common_table_common_table_type.Designer.cs
  8. 74
      src/Shentun.Peis.EntityFrameworkCore/Migrations/20240815022647_insert_common_table_common_table_type.cs
  9. 144
      src/Shentun.Peis.EntityFrameworkCore/Migrations/PeisDbContextModelSnapshot.cs

60
src/Shentun.Peis.Domain/CommonTableTypes/CommonTableType.cs

@ -0,0 +1,60 @@
using Microsoft.EntityFrameworkCore;
using Shentun.Peis.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Domain.Entities.Auditing;
using Volo.Abp.Domain.Entities;
namespace Shentun.Peis.Models
{
/// <summary>
/// 通用字段对照类别
/// </summary>
[Table("common_table_type")]
public class CommonTableType : AuditedEntity<string>, IDisplayName, IDisplayOrder, IHasConcurrencyStamp
{
public CommonTableType()
{
CommonTables = new HashSet<CommonTable>();
}
/// <summary>
/// 名称
/// </summary>
[Column("display_name")]
[StringLength(50)]
public string DisplayName { get; set; } = null!;
/// <summary>
/// 名称
/// </summary>
[Column("simple_code")]
[StringLength(50)]
public string SimpleCode { get; set; } = null!;
/// <summary>
///
/// </summary>
[Column("display_order")]
public int DisplayOrder { get; set; }
[Column("concurrency_stamp")]
public string ConcurrencyStamp { get; set; }
[InverseProperty(nameof(CommonTable.CommonTableType))]
public virtual ICollection<CommonTable> CommonTables { get; set; }
}
}

59
src/Shentun.Peis.Domain/CommonTables/CommonTable.cs

@ -0,0 +1,59 @@
using Microsoft.EntityFrameworkCore;
using Shentun.Peis.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Domain.Entities.Auditing;
using Volo.Abp.Domain.Entities;
namespace Shentun.Peis.Models
{
/// <summary>
/// 通用字段对照
/// </summary>
[Table("common_table")]
public class CommonTable : AuditedEntity<Guid>, IDisplayName, IDisplayOrder, IHasConcurrencyStamp
{
/// <summary>
/// 名称
/// </summary>
[Column("data_code")]
[StringLength(50)]
public string DataCode { get; set; } = null!;
/// <summary>
/// 名称
/// </summary>
[Column("display_name")]
[StringLength(50)]
public string DisplayName { get; set; } = null!;
/// <summary>
/// 通用字段对照类别
/// </summary>
[Column("common_table_type_id")]
[StringLength(3)]
public string CommonTableTypeId { get; set; }
[Column("simple_code")]
[StringLength(50)]
public string SimpleCode { get; set; } = null!;
[Column("display_order")]
public int DisplayOrder { get; set; }
[Column("concurrency_stamp")]
public string ConcurrencyStamp { get; set; }
[ForeignKey(nameof(CommonTableTypeId))]
[InverseProperty("CommonTables")]
public virtual CommonTableType CommonTableType { get; set; } = null!;
}
}

2
src/Shentun.Peis.Domain/Shentun.Peis.Domain.csproj

@ -34,8 +34,6 @@
<ItemGroup>
<Folder Include="SysParmTypes\" />
<Folder Include="DataConfigJson\" />
<Folder Include="CommonTableTypes\" />
<Folder Include="CommonTables\" />
</ItemGroup>
</Project>

26
src/Shentun.Peis.EntityFrameworkCore/DbMapping/CommonTableTypes/CommonTableTypeDbMapping.cs

@ -0,0 +1,26 @@
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using Microsoft.EntityFrameworkCore;
using Shentun.Peis.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Shentun.Peis.EntityFrameworkCore;
namespace Shentun.Peis.DbMapping
{
internal class CommonTableTypeDbMapping : IEntityTypeConfiguration<CommonTableType>
{
public void Configure(EntityTypeBuilder<CommonTableType> entity)
{
entity.HasComment("通用字段对照类别");
entity.Property(t => t.DisplayName).HasComment("名称").IsRequired();
entity.Property(e => e.Id).HasMaxLength(3).IsFixedLength().IsRequired();
entity.Property(e => e.DisplayOrder).HasDefaultValueSql("999999").IsRequired();
entity.ConfigureByConvention();
}
}
}

36
src/Shentun.Peis.EntityFrameworkCore/DbMapping/CommonTables/CommonTableDbMapping.cs

@ -0,0 +1,36 @@
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using Microsoft.EntityFrameworkCore;
using Shentun.Peis.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Shentun.Peis.EntityFrameworkCore;
namespace Shentun.Peis.DbMapping
{
internal class CommonTableDbMapping : IEntityTypeConfiguration<CommonTable>
{
public void Configure(EntityTypeBuilder<CommonTable> entity)
{
entity.HasComment("通用字段对照");
entity.Property(t => t.DisplayName).HasComment("名称").IsRequired();
entity.Property(t => t.CommonTableTypeId).HasComment("通用字段对照类别编号").IsRequired();
entity.Property(e => e.Id).IsFixedLength().IsRequired();
entity.Property(e => e.CommonTableTypeId).IsFixedLength();
entity.HasOne(d => d.CommonTableType)
.WithMany(p => p.CommonTables)
.HasForeignKey(d => d.CommonTableTypeId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("fk_common_table_common_table_type");
entity.ConfigureByConvention();
}
}
}

6
src/Shentun.Peis.EntityFrameworkCore/EntityFrameworkCore/PeisDbContext.cs

@ -318,6 +318,8 @@ public class PeisDbContext :
public DbSet<ColumnReference> ColumnReferences { get; set; } = null!;
public DbSet<ColumnReferenceCode> ColumnReferenceCodes { get; set; } = null!;
public DbSet<ColumnReferenceInterface> ColumnReferenceInterfaces { get; set; } = null!;
public DbSet<CommonTable> CommonTables { get; set; } = null!;
public DbSet<CommonTableType> CommonTableTypes { get; set; } = null!;
#endregion
@ -603,7 +605,9 @@ public class PeisDbContext :
.ApplyConfiguration(new PatientPastMedicalHistoryDbMapping())
.ApplyConfiguration(new OcCheckTypeDetailDbMapping())
.ApplyConfiguration(new RoomDetailDbMapping())
.ApplyConfiguration(new FollowUpDbMapping());
.ApplyConfiguration(new FollowUpDbMapping())
.ApplyConfiguration(new CommonTableDbMapping())
.ApplyConfiguration(new CommonTableTypeDbMapping());
#endregion

15434
src/Shentun.Peis.EntityFrameworkCore/Migrations/20240815022647_insert_common_table_common_table_type.Designer.cs
File diff suppressed because it is too large
View File

74
src/Shentun.Peis.EntityFrameworkCore/Migrations/20240815022647_insert_common_table_common_table_type.cs

@ -0,0 +1,74 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Shentun.Peis.Migrations
{
public partial class insert_common_table_common_table_type : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
//migrationBuilder.CreateTable(
// name: "common_table_type",
// columns: table => new
// {
// id = table.Column<string>(type: "character(3)", fixedLength: true, maxLength: 3, nullable: false),
// display_name = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false, comment: "名称"),
// simple_code = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: true),
// display_order = table.Column<int>(type: "integer", nullable: false, defaultValueSql: "999999"),
// concurrency_stamp = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: true),
// creation_time = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
// creator_id = table.Column<Guid>(type: "uuid", nullable: false),
// last_modification_time = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
// last_modifier_id = table.Column<Guid>(type: "uuid", nullable: false)
// },
// constraints: table =>
// {
// table.PrimaryKey("PK_common_table_type", x => x.id);
// },
// comment: "通用字段对照类别");
//migrationBuilder.CreateTable(
// name: "common_table",
// columns: table => new
// {
// id = table.Column<Guid>(type: "uuid", fixedLength: true, nullable: false),
// data_code = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: true),
// display_name = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false, comment: "名称"),
// common_table_type_id = table.Column<string>(type: "character(3)", fixedLength: true, maxLength: 3, nullable: false, comment: "通用字段对照类别编号"),
// simple_code = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: true),
// display_order = table.Column<int>(type: "integer", nullable: false),
// concurrency_stamp = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: true),
// creation_time = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
// creator_id = table.Column<Guid>(type: "uuid", nullable: false),
// last_modification_time = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
// last_modifier_id = table.Column<Guid>(type: "uuid", nullable: false)
// },
// constraints: table =>
// {
// table.PrimaryKey("PK_common_table", x => x.id);
// table.ForeignKey(
// name: "fk_common_table_common_table_type",
// column: x => x.common_table_type_id,
// principalTable: "common_table_type",
// principalColumn: "id");
// },
// comment: "通用字段对照");
//migrationBuilder.CreateIndex(
// name: "IX_common_table_common_table_type_id",
// table: "common_table",
// column: "common_table_type_id");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "common_table");
migrationBuilder.DropTable(
name: "common_table_type");
}
}
}

144
src/Shentun.Peis.EntityFrameworkCore/Migrations/PeisDbContextModelSnapshot.cs

@ -2305,6 +2305,134 @@ namespace Shentun.Peis.Migrations
b.HasComment("常用字符类别");
});
modelBuilder.Entity("Shentun.Peis.Models.CommonTable", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uuid")
.HasColumnName("id")
.IsFixedLength();
b.Property<string>("CommonTableTypeId")
.IsRequired()
.HasMaxLength(3)
.HasColumnType("character(3)")
.HasColumnName("common_table_type_id")
.IsFixedLength()
.HasComment("通用字段对照类别编号");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasMaxLength(40)
.HasColumnType("character varying(40)")
.HasColumnName("concurrency_stamp");
b.Property<DateTime>("CreationTime")
.HasColumnType("timestamp without time zone")
.HasColumnName("creation_time");
b.Property<Guid?>("CreatorId")
.IsRequired()
.HasColumnType("uuid")
.HasColumnName("creator_id");
b.Property<string>("DataCode")
.HasMaxLength(50)
.HasColumnType("character varying(50)")
.HasColumnName("data_code");
b.Property<string>("DisplayName")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)")
.HasColumnName("display_name")
.HasComment("名称");
b.Property<int>("DisplayOrder")
.HasColumnType("integer")
.HasColumnName("display_order");
b.Property<DateTime?>("LastModificationTime")
.IsRequired()
.HasColumnType("timestamp without time zone")
.HasColumnName("last_modification_time");
b.Property<Guid?>("LastModifierId")
.IsRequired()
.HasColumnType("uuid")
.HasColumnName("last_modifier_id");
b.Property<string>("SimpleCode")
.HasMaxLength(50)
.HasColumnType("character varying(50)")
.HasColumnName("simple_code");
b.HasKey("Id");
b.HasIndex("CommonTableTypeId");
b.ToTable("common_table");
b.HasComment("通用字段对照");
});
modelBuilder.Entity("Shentun.Peis.Models.CommonTableType", b =>
{
b.Property<string>("Id")
.HasMaxLength(3)
.HasColumnType("character(3)")
.HasColumnName("id")
.IsFixedLength();
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasMaxLength(40)
.HasColumnType("character varying(40)")
.HasColumnName("concurrency_stamp");
b.Property<DateTime>("CreationTime")
.HasColumnType("timestamp without time zone")
.HasColumnName("creation_time");
b.Property<Guid?>("CreatorId")
.IsRequired()
.HasColumnType("uuid")
.HasColumnName("creator_id");
b.Property<string>("DisplayName")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)")
.HasColumnName("display_name")
.HasComment("名称");
b.Property<int>("DisplayOrder")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasColumnName("display_order")
.HasDefaultValueSql("999999");
b.Property<DateTime?>("LastModificationTime")
.IsRequired()
.HasColumnType("timestamp without time zone")
.HasColumnName("last_modification_time");
b.Property<Guid?>("LastModifierId")
.IsRequired()
.HasColumnType("uuid")
.HasColumnName("last_modifier_id");
b.Property<string>("SimpleCode")
.HasMaxLength(50)
.HasColumnType("character varying(50)")
.HasColumnName("simple_code");
b.HasKey("Id");
b.ToTable("common_table_type");
b.HasComment("通用字段对照类别");
});
modelBuilder.Entity("Shentun.Peis.Models.ContactMethod", b =>
{
b.Property<Guid>("Id")
@ -13745,6 +13873,17 @@ namespace Shentun.Peis.Migrations
b.Navigation("CommonCharType");
});
modelBuilder.Entity("Shentun.Peis.Models.CommonTable", b =>
{
b.HasOne("Shentun.Peis.Models.CommonTableType", "CommonTableType")
.WithMany("CommonTables")
.HasForeignKey("CommonTableTypeId")
.IsRequired()
.HasConstraintName("fk_common_table_common_table_type");
b.Navigation("CommonTableType");
});
modelBuilder.Entity("Shentun.Peis.Models.ContactMethod", b =>
{
b.HasOne("Shentun.Peis.Models.ContactPerson", "ContactPerson")
@ -14936,6 +15075,11 @@ namespace Shentun.Peis.Migrations
b.Navigation("CommonChars");
});
modelBuilder.Entity("Shentun.Peis.Models.CommonTableType", b =>
{
b.Navigation("CommonTables");
});
modelBuilder.Entity("Shentun.Peis.Models.ContactPerson", b =>
{
b.Navigation("ContactMethods");

Loading…
Cancel
Save