9 changed files with 15838 additions and 3 deletions
-
60src/Shentun.Peis.Domain/CommonTableTypes/CommonTableType.cs
-
59src/Shentun.Peis.Domain/CommonTables/CommonTable.cs
-
2src/Shentun.Peis.Domain/Shentun.Peis.Domain.csproj
-
26src/Shentun.Peis.EntityFrameworkCore/DbMapping/CommonTableTypes/CommonTableTypeDbMapping.cs
-
36src/Shentun.Peis.EntityFrameworkCore/DbMapping/CommonTables/CommonTableDbMapping.cs
-
6src/Shentun.Peis.EntityFrameworkCore/EntityFrameworkCore/PeisDbContext.cs
-
15434src/Shentun.Peis.EntityFrameworkCore/Migrations/20240815022647_insert_common_table_common_table_type.Designer.cs
-
74src/Shentun.Peis.EntityFrameworkCore/Migrations/20240815022647_insert_common_table_common_table_type.cs
-
144src/Shentun.Peis.EntityFrameworkCore/Migrations/PeisDbContextModelSnapshot.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; } |
|||
|
|||
|
|||
} |
|||
} |
|||
@ -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!; |
|||
|
|||
|
|||
} |
|||
} |
|||
@ -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(); |
|||
} |
|||
} |
|||
} |
|||
@ -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(); |
|||
} |
|||
} |
|||
} |
|||
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
File diff suppressed because it is too large
View File
@ -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"); |
|||
} |
|||
} |
|||
} |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue