feat:商户管理

This commit is contained in:
2025-12-29 16:40:27 +08:00
parent 57f4c2d394
commit dd91c1010a
62 changed files with 10536 additions and 165 deletions

View File

@@ -0,0 +1,244 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace TakeoutSaaS.Infrastructure.Migrations
{
/// <inheritdoc />
public partial class AddMerchantManagement : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<int>(
name: "OperatingMode",
table: "tenants",
type: "integer",
nullable: true,
comment: "经营模式(同一主体/不同主体)。");
migrationBuilder.AddColumn<string>(
name: "BusinessLicenseImageUrl",
table: "stores",
type: "character varying(500)",
maxLength: 500,
nullable: true,
comment: "门店营业执照图片地址(主体不一致模式使用)。");
migrationBuilder.AddColumn<string>(
name: "BusinessLicenseNumber",
table: "stores",
type: "character varying(50)",
maxLength: 50,
nullable: true,
comment: "门店营业执照号(主体不一致模式使用)。");
migrationBuilder.AddColumn<string>(
name: "LegalRepresentative",
table: "stores",
type: "character varying(100)",
maxLength: 100,
nullable: true,
comment: "门店法人(主体不一致模式使用)。");
migrationBuilder.AddColumn<string>(
name: "RegisteredAddress",
table: "stores",
type: "character varying(500)",
maxLength: 500,
nullable: true,
comment: "门店注册地址(主体不一致模式使用)。");
migrationBuilder.AddColumn<DateTime>(
name: "ApprovedAt",
table: "merchants",
type: "timestamp with time zone",
nullable: true,
comment: "审核通过时间。");
migrationBuilder.AddColumn<long>(
name: "ApprovedBy",
table: "merchants",
type: "bigint",
nullable: true,
comment: "审核通过人。");
migrationBuilder.AddColumn<DateTime>(
name: "ClaimExpiresAt",
table: "merchants",
type: "timestamp with time zone",
nullable: true,
comment: "领取过期时间。");
migrationBuilder.AddColumn<DateTime>(
name: "ClaimedAt",
table: "merchants",
type: "timestamp with time zone",
nullable: true,
comment: "领取时间。");
migrationBuilder.AddColumn<long>(
name: "ClaimedBy",
table: "merchants",
type: "bigint",
nullable: true,
comment: "当前领取人。");
migrationBuilder.AddColumn<string>(
name: "ClaimedByName",
table: "merchants",
type: "character varying(100)",
maxLength: 100,
nullable: true,
comment: "当前领取人姓名。");
migrationBuilder.AddColumn<DateTime>(
name: "FrozenAt",
table: "merchants",
type: "timestamp with time zone",
nullable: true,
comment: "冻结时间。");
migrationBuilder.AddColumn<string>(
name: "FrozenReason",
table: "merchants",
type: "character varying(500)",
maxLength: 500,
nullable: true,
comment: "冻结原因。");
migrationBuilder.AddColumn<bool>(
name: "IsFrozen",
table: "merchants",
type: "boolean",
nullable: false,
defaultValue: false,
comment: "是否冻结业务。");
migrationBuilder.AddColumn<long>(
name: "LastReviewedBy",
table: "merchants",
type: "bigint",
nullable: true,
comment: "最近一次审核人。");
migrationBuilder.AddColumn<int>(
name: "OperatingMode",
table: "merchants",
type: "integer",
nullable: true,
comment: "经营模式(同一主体/不同主体)。");
migrationBuilder.AddColumn<byte[]>(
name: "RowVersion",
table: "merchants",
type: "bytea",
rowVersion: true,
nullable: false,
defaultValue: new byte[0],
comment: "并发控制版本。");
migrationBuilder.CreateIndex(
name: "IX_stores_MerchantId_BusinessLicenseNumber",
table: "stores",
columns: new[] { "MerchantId", "BusinessLicenseNumber" },
unique: true,
filter: "\"BusinessLicenseNumber\" IS NOT NULL AND \"Status\" <> 3");
migrationBuilder.CreateIndex(
name: "IX_merchants_ClaimedBy",
table: "merchants",
column: "ClaimedBy");
migrationBuilder.CreateIndex(
name: "IX_merchants_TenantId_Status",
table: "merchants",
columns: new[] { "TenantId", "Status" });
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropIndex(
name: "IX_stores_MerchantId_BusinessLicenseNumber",
table: "stores");
migrationBuilder.DropIndex(
name: "IX_merchants_ClaimedBy",
table: "merchants");
migrationBuilder.DropIndex(
name: "IX_merchants_TenantId_Status",
table: "merchants");
migrationBuilder.DropColumn(
name: "OperatingMode",
table: "tenants");
migrationBuilder.DropColumn(
name: "BusinessLicenseImageUrl",
table: "stores");
migrationBuilder.DropColumn(
name: "BusinessLicenseNumber",
table: "stores");
migrationBuilder.DropColumn(
name: "LegalRepresentative",
table: "stores");
migrationBuilder.DropColumn(
name: "RegisteredAddress",
table: "stores");
migrationBuilder.DropColumn(
name: "ApprovedAt",
table: "merchants");
migrationBuilder.DropColumn(
name: "ApprovedBy",
table: "merchants");
migrationBuilder.DropColumn(
name: "ClaimExpiresAt",
table: "merchants");
migrationBuilder.DropColumn(
name: "ClaimedAt",
table: "merchants");
migrationBuilder.DropColumn(
name: "ClaimedBy",
table: "merchants");
migrationBuilder.DropColumn(
name: "ClaimedByName",
table: "merchants");
migrationBuilder.DropColumn(
name: "FrozenAt",
table: "merchants");
migrationBuilder.DropColumn(
name: "FrozenReason",
table: "merchants");
migrationBuilder.DropColumn(
name: "IsFrozen",
table: "merchants");
migrationBuilder.DropColumn(
name: "LastReviewedBy",
table: "merchants");
migrationBuilder.DropColumn(
name: "OperatingMode",
table: "merchants");
migrationBuilder.DropColumn(
name: "RowVersion",
table: "merchants");
}
}
}

View File

@@ -0,0 +1,454 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using TakeoutSaaS.Infrastructure.Logs.Persistence;
#nullable disable
namespace TakeoutSaaS.Infrastructure.Migrations.LogsDb
{
[DbContext(typeof(TakeoutLogsDbContext))]
[Migration("20251229071940_AddMerchantManagementLogs")]
partial class AddMerchantManagementLogs
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "10.0.1")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("TakeoutSaaS.Domain.Membership.Entities.MemberGrowthLog", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint")
.HasComment("实体唯一标识。");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
b.Property<int>("ChangeValue")
.HasColumnType("integer")
.HasComment("变动数量。");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone")
.HasComment("创建时间UTC。");
b.Property<long?>("CreatedBy")
.HasColumnType("bigint")
.HasComment("创建人用户标识,匿名或系统操作时为 null。");
b.Property<int>("CurrentValue")
.HasColumnType("integer")
.HasComment("当前成长值。");
b.Property<DateTime?>("DeletedAt")
.HasColumnType("timestamp with time zone")
.HasComment("软删除时间UTC未删除时为 null。");
b.Property<long?>("DeletedBy")
.HasColumnType("bigint")
.HasComment("删除人用户标识(软删除),未删除时为 null。");
b.Property<long>("MemberId")
.HasColumnType("bigint")
.HasComment("会员标识。");
b.Property<string>("Notes")
.HasMaxLength(256)
.HasColumnType("character varying(256)")
.HasComment("备注。");
b.Property<DateTime>("OccurredAt")
.HasColumnType("timestamp with time zone")
.HasComment("发生时间。");
b.Property<long>("TenantId")
.HasColumnType("bigint")
.HasComment("所属租户 ID。");
b.Property<DateTime?>("UpdatedAt")
.HasColumnType("timestamp with time zone")
.HasComment("最近一次更新时间UTC从未更新时为 null。");
b.Property<long?>("UpdatedBy")
.HasColumnType("bigint")
.HasComment("最后更新人用户标识,匿名或系统操作时为 null。");
b.HasKey("Id");
b.HasIndex("TenantId", "MemberId", "OccurredAt");
b.ToTable("member_growth_logs", null, t =>
{
t.HasComment("成长值变动日志。");
});
});
modelBuilder.Entity("TakeoutSaaS.Domain.Merchants.Entities.MerchantAuditLog", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint")
.HasComment("实体唯一标识。");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
b.Property<int>("Action")
.HasColumnType("integer")
.HasComment("动作类型。");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone")
.HasComment("创建时间UTC。");
b.Property<long?>("CreatedBy")
.HasColumnType("bigint")
.HasComment("创建人用户标识,匿名或系统操作时为 null。");
b.Property<DateTime?>("DeletedAt")
.HasColumnType("timestamp with time zone")
.HasComment("软删除时间UTC未删除时为 null。");
b.Property<long?>("DeletedBy")
.HasColumnType("bigint")
.HasComment("删除人用户标识(软删除),未删除时为 null。");
b.Property<string>("Description")
.HasMaxLength(1024)
.HasColumnType("character varying(1024)")
.HasComment("详情描述。");
b.Property<string>("IpAddress")
.HasMaxLength(50)
.HasColumnType("character varying(50)")
.HasComment("操作 IP。");
b.Property<long>("MerchantId")
.HasColumnType("bigint")
.HasComment("商户标识。");
b.Property<long?>("OperatorId")
.HasColumnType("bigint")
.HasComment("操作人 ID。");
b.Property<string>("OperatorName")
.HasMaxLength(100)
.HasColumnType("character varying(100)")
.HasComment("操作人名称。");
b.Property<long>("TenantId")
.HasColumnType("bigint")
.HasComment("所属租户 ID。");
b.Property<string>("Title")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("character varying(200)")
.HasComment("标题。");
b.Property<DateTime?>("UpdatedAt")
.HasColumnType("timestamp with time zone")
.HasComment("最近一次更新时间UTC从未更新时为 null。");
b.Property<long?>("UpdatedBy")
.HasColumnType("bigint")
.HasComment("最后更新人用户标识,匿名或系统操作时为 null。");
b.HasKey("Id");
b.HasIndex("MerchantId", "CreatedAt");
b.HasIndex("TenantId", "CreatedAt");
b.HasIndex("TenantId", "MerchantId");
b.ToTable("merchant_audit_logs", null, t =>
{
t.HasComment("商户入驻审核日志。");
});
});
modelBuilder.Entity("TakeoutSaaS.Domain.Merchants.Entities.MerchantChangeLog", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint")
.HasComment("实体唯一标识。");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
b.Property<string>("ChangeReason")
.HasMaxLength(512)
.HasColumnType("character varying(512)")
.HasComment("变更原因。");
b.Property<string>("ChangeType")
.IsRequired()
.HasMaxLength(20)
.HasColumnType("character varying(20)")
.HasComment("变更类型。");
b.Property<long?>("ChangedBy")
.HasColumnType("bigint")
.HasComment("变更人 ID。");
b.Property<string>("ChangedByName")
.HasMaxLength(100)
.HasColumnType("character varying(100)")
.HasComment("变更人名称。");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone")
.HasComment("创建时间UTC。");
b.Property<long?>("CreatedBy")
.HasColumnType("bigint")
.HasComment("创建人用户标识,匿名或系统操作时为 null。");
b.Property<DateTime?>("DeletedAt")
.HasColumnType("timestamp with time zone")
.HasComment("软删除时间UTC未删除时为 null。");
b.Property<long?>("DeletedBy")
.HasColumnType("bigint")
.HasComment("删除人用户标识(软删除),未删除时为 null。");
b.Property<string>("FieldName")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)")
.HasComment("变更字段名。");
b.Property<long>("MerchantId")
.HasColumnType("bigint")
.HasComment("商户标识。");
b.Property<string>("NewValue")
.HasColumnType("text")
.HasComment("变更后值。");
b.Property<string>("OldValue")
.HasColumnType("text")
.HasComment("变更前值。");
b.Property<long>("TenantId")
.HasColumnType("bigint")
.HasComment("所属租户 ID。");
b.Property<DateTime?>("UpdatedAt")
.HasColumnType("timestamp with time zone")
.HasComment("最近一次更新时间UTC从未更新时为 null。");
b.Property<long?>("UpdatedBy")
.HasColumnType("bigint")
.HasComment("最后更新人用户标识,匿名或系统操作时为 null。");
b.HasKey("Id");
b.HasIndex("MerchantId", "CreatedAt");
b.HasIndex("TenantId", "CreatedAt");
b.ToTable("merchant_change_logs", null, t =>
{
t.HasComment("商户变更日志。");
});
});
modelBuilder.Entity("TakeoutSaaS.Domain.Tenants.Entities.OperationLog", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint")
.HasComment("实体唯一标识。");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone")
.HasComment("创建时间UTC。");
b.Property<long?>("CreatedBy")
.HasColumnType("bigint")
.HasComment("创建人用户标识,匿名或系统操作时为 null。");
b.Property<DateTime?>("DeletedAt")
.HasColumnType("timestamp with time zone")
.HasComment("软删除时间UTC未删除时为 null。");
b.Property<long?>("DeletedBy")
.HasColumnType("bigint")
.HasComment("删除人用户标识(软删除),未删除时为 null。");
b.Property<string>("OperationType")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("character varying(64)")
.HasComment("操作类型BatchExtend, BatchRemind, StatusChange 等。");
b.Property<string>("OperatorId")
.HasMaxLength(64)
.HasColumnType("character varying(64)")
.HasComment("操作人ID。");
b.Property<string>("OperatorName")
.HasMaxLength(128)
.HasColumnType("character varying(128)")
.HasComment("操作人名称。");
b.Property<string>("Parameters")
.HasColumnType("text")
.HasComment("操作参数JSON。");
b.Property<string>("Result")
.HasColumnType("text")
.HasComment("操作结果JSON。");
b.Property<bool>("Success")
.HasColumnType("boolean")
.HasComment("是否成功。");
b.Property<string>("TargetIds")
.HasColumnType("text")
.HasComment("目标ID列表JSON。");
b.Property<string>("TargetType")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("character varying(64)")
.HasComment("目标类型Subscription, Bill 等。");
b.Property<DateTime?>("UpdatedAt")
.HasColumnType("timestamp with time zone")
.HasComment("最近一次更新时间UTC从未更新时为 null。");
b.Property<long?>("UpdatedBy")
.HasColumnType("bigint")
.HasComment("最后更新人用户标识,匿名或系统操作时为 null。");
b.HasKey("Id");
b.HasIndex("CreatedAt");
b.HasIndex("OperationType", "CreatedAt");
b.ToTable("operation_logs", null, t =>
{
t.HasComment("运营操作日志。");
});
});
modelBuilder.Entity("TakeoutSaaS.Domain.Tenants.Entities.TenantAuditLog", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint")
.HasComment("实体唯一标识。");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
b.Property<int>("Action")
.HasColumnType("integer")
.HasComment("操作类型。");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone")
.HasComment("创建时间UTC。");
b.Property<long?>("CreatedBy")
.HasColumnType("bigint")
.HasComment("创建人用户标识,匿名或系统操作时为 null。");
b.Property<int?>("CurrentStatus")
.HasColumnType("integer")
.HasComment("新状态。");
b.Property<DateTime?>("DeletedAt")
.HasColumnType("timestamp with time zone")
.HasComment("软删除时间UTC未删除时为 null。");
b.Property<long?>("DeletedBy")
.HasColumnType("bigint")
.HasComment("删除人用户标识(软删除),未删除时为 null。");
b.Property<string>("Description")
.HasMaxLength(1024)
.HasColumnType("character varying(1024)")
.HasComment("详细描述。");
b.Property<long?>("OperatorId")
.HasColumnType("bigint")
.HasComment("操作人 ID。");
b.Property<string>("OperatorName")
.HasMaxLength(64)
.HasColumnType("character varying(64)")
.HasComment("操作人名称。");
b.Property<int?>("PreviousStatus")
.HasColumnType("integer")
.HasComment("原状态。");
b.Property<long>("TenantId")
.HasColumnType("bigint")
.HasComment("关联的租户标识。");
b.Property<string>("Title")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("character varying(128)")
.HasComment("日志标题。");
b.Property<DateTime?>("UpdatedAt")
.HasColumnType("timestamp with time zone")
.HasComment("最近一次更新时间UTC从未更新时为 null。");
b.Property<long?>("UpdatedBy")
.HasColumnType("bigint")
.HasComment("最后更新人用户标识,匿名或系统操作时为 null。");
b.HasKey("Id");
b.HasIndex("TenantId");
b.ToTable("tenant_audit_logs", null, t =>
{
t.HasComment("租户运营审核日志。");
});
});
modelBuilder.Entity("TakeoutSaaS.Infrastructure.Logs.Persistence.OperationLogInboxMessage", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint")
.HasComment("实体唯一标识。");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
b.Property<DateTime>("ConsumedAt")
.HasColumnType("timestamp with time zone");
b.Property<Guid>("MessageId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("MessageId")
.IsUnique();
b.ToTable("operation_log_inbox_messages", (string)null);
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,141 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace TakeoutSaaS.Infrastructure.Migrations.LogsDb
{
/// <inheritdoc />
public partial class AddMerchantManagementLogs : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "Title",
table: "merchant_audit_logs",
type: "character varying(200)",
maxLength: 200,
nullable: false,
comment: "标题。",
oldClrType: typeof(string),
oldType: "character varying(128)",
oldMaxLength: 128,
oldComment: "标题。");
migrationBuilder.AlterColumn<string>(
name: "OperatorName",
table: "merchant_audit_logs",
type: "character varying(100)",
maxLength: 100,
nullable: true,
comment: "操作人名称。",
oldClrType: typeof(string),
oldType: "character varying(64)",
oldMaxLength: 64,
oldNullable: true,
oldComment: "操作人名称。");
migrationBuilder.AddColumn<string>(
name: "IpAddress",
table: "merchant_audit_logs",
type: "character varying(50)",
maxLength: 50,
nullable: true,
comment: "操作 IP。");
migrationBuilder.CreateTable(
name: "merchant_change_logs",
columns: table => new
{
Id = table.Column<long>(type: "bigint", nullable: false, comment: "实体唯一标识。")
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
MerchantId = table.Column<long>(type: "bigint", nullable: false, comment: "商户标识。"),
FieldName = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: false, comment: "变更字段名。"),
OldValue = table.Column<string>(type: "text", nullable: true, comment: "变更前值。"),
NewValue = table.Column<string>(type: "text", nullable: true, comment: "变更后值。"),
ChangeType = table.Column<string>(type: "character varying(20)", maxLength: 20, nullable: false, comment: "变更类型。"),
ChangedBy = table.Column<long>(type: "bigint", nullable: true, comment: "变更人 ID。"),
ChangedByName = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: true, comment: "变更人名称。"),
ChangeReason = table.Column<string>(type: "character varying(512)", maxLength: 512, nullable: true, comment: "变更原因。"),
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "创建时间UTC。"),
UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "最近一次更新时间UTC从未更新时为 null。"),
DeletedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true, comment: "软删除时间UTC未删除时为 null。"),
CreatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "创建人用户标识,匿名或系统操作时为 null。"),
UpdatedBy = table.Column<long>(type: "bigint", nullable: true, comment: "最后更新人用户标识,匿名或系统操作时为 null。"),
DeletedBy = table.Column<long>(type: "bigint", nullable: true, comment: "删除人用户标识(软删除),未删除时为 null。"),
TenantId = table.Column<long>(type: "bigint", nullable: false, comment: "所属租户 ID。")
},
constraints: table =>
{
table.PrimaryKey("PK_merchant_change_logs", x => x.Id);
},
comment: "商户变更日志。");
migrationBuilder.CreateIndex(
name: "IX_merchant_audit_logs_MerchantId_CreatedAt",
table: "merchant_audit_logs",
columns: new[] { "MerchantId", "CreatedAt" });
migrationBuilder.CreateIndex(
name: "IX_merchant_audit_logs_TenantId_CreatedAt",
table: "merchant_audit_logs",
columns: new[] { "TenantId", "CreatedAt" });
migrationBuilder.CreateIndex(
name: "IX_merchant_change_logs_MerchantId_CreatedAt",
table: "merchant_change_logs",
columns: new[] { "MerchantId", "CreatedAt" });
migrationBuilder.CreateIndex(
name: "IX_merchant_change_logs_TenantId_CreatedAt",
table: "merchant_change_logs",
columns: new[] { "TenantId", "CreatedAt" });
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "merchant_change_logs");
migrationBuilder.DropIndex(
name: "IX_merchant_audit_logs_MerchantId_CreatedAt",
table: "merchant_audit_logs");
migrationBuilder.DropIndex(
name: "IX_merchant_audit_logs_TenantId_CreatedAt",
table: "merchant_audit_logs");
migrationBuilder.DropColumn(
name: "IpAddress",
table: "merchant_audit_logs");
migrationBuilder.AlterColumn<string>(
name: "Title",
table: "merchant_audit_logs",
type: "character varying(128)",
maxLength: 128,
nullable: false,
comment: "标题。",
oldClrType: typeof(string),
oldType: "character varying(200)",
oldMaxLength: 200,
oldComment: "标题。");
migrationBuilder.AlterColumn<string>(
name: "OperatorName",
table: "merchant_audit_logs",
type: "character varying(64)",
maxLength: 64,
nullable: true,
comment: "操作人名称。",
oldClrType: typeof(string),
oldType: "character varying(100)",
oldMaxLength: 100,
oldNullable: true,
oldComment: "操作人名称。");
}
}
}

View File

@@ -17,7 +17,7 @@ namespace TakeoutSaaS.Infrastructure.Migrations.LogsDb
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "10.0.0")
.HasAnnotation("ProductVersion", "10.0.1")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
@@ -124,6 +124,11 @@ namespace TakeoutSaaS.Infrastructure.Migrations.LogsDb
.HasColumnType("character varying(1024)")
.HasComment("详情描述。");
b.Property<string>("IpAddress")
.HasMaxLength(50)
.HasColumnType("character varying(50)")
.HasComment("操作 IP。");
b.Property<long>("MerchantId")
.HasColumnType("bigint")
.HasComment("商户标识。");
@@ -133,8 +138,8 @@ namespace TakeoutSaaS.Infrastructure.Migrations.LogsDb
.HasComment("操作人 ID。");
b.Property<string>("OperatorName")
.HasMaxLength(64)
.HasColumnType("character varying(64)")
.HasMaxLength(100)
.HasColumnType("character varying(100)")
.HasComment("操作人名称。");
b.Property<long>("TenantId")
@@ -143,8 +148,8 @@ namespace TakeoutSaaS.Infrastructure.Migrations.LogsDb
b.Property<string>("Title")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("character varying(128)")
.HasMaxLength(200)
.HasColumnType("character varying(200)")
.HasComment("标题。");
b.Property<DateTime?>("UpdatedAt")
@@ -157,6 +162,10 @@ namespace TakeoutSaaS.Infrastructure.Migrations.LogsDb
b.HasKey("Id");
b.HasIndex("MerchantId", "CreatedAt");
b.HasIndex("TenantId", "CreatedAt");
b.HasIndex("TenantId", "MerchantId");
b.ToTable("merchant_audit_logs", null, t =>
@@ -165,6 +174,93 @@ namespace TakeoutSaaS.Infrastructure.Migrations.LogsDb
});
});
modelBuilder.Entity("TakeoutSaaS.Domain.Merchants.Entities.MerchantChangeLog", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint")
.HasComment("实体唯一标识。");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
b.Property<string>("ChangeReason")
.HasMaxLength(512)
.HasColumnType("character varying(512)")
.HasComment("变更原因。");
b.Property<string>("ChangeType")
.IsRequired()
.HasMaxLength(20)
.HasColumnType("character varying(20)")
.HasComment("变更类型。");
b.Property<long?>("ChangedBy")
.HasColumnType("bigint")
.HasComment("变更人 ID。");
b.Property<string>("ChangedByName")
.HasMaxLength(100)
.HasColumnType("character varying(100)")
.HasComment("变更人名称。");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone")
.HasComment("创建时间UTC。");
b.Property<long?>("CreatedBy")
.HasColumnType("bigint")
.HasComment("创建人用户标识,匿名或系统操作时为 null。");
b.Property<DateTime?>("DeletedAt")
.HasColumnType("timestamp with time zone")
.HasComment("软删除时间UTC未删除时为 null。");
b.Property<long?>("DeletedBy")
.HasColumnType("bigint")
.HasComment("删除人用户标识(软删除),未删除时为 null。");
b.Property<string>("FieldName")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)")
.HasComment("变更字段名。");
b.Property<long>("MerchantId")
.HasColumnType("bigint")
.HasComment("商户标识。");
b.Property<string>("NewValue")
.HasColumnType("text")
.HasComment("变更后值。");
b.Property<string>("OldValue")
.HasColumnType("text")
.HasComment("变更前值。");
b.Property<long>("TenantId")
.HasColumnType("bigint")
.HasComment("所属租户 ID。");
b.Property<DateTime?>("UpdatedAt")
.HasColumnType("timestamp with time zone")
.HasComment("最近一次更新时间UTC从未更新时为 null。");
b.Property<long?>("UpdatedBy")
.HasColumnType("bigint")
.HasComment("最后更新人用户标识,匿名或系统操作时为 null。");
b.HasKey("Id");
b.HasIndex("MerchantId", "CreatedAt");
b.HasIndex("TenantId", "CreatedAt");
b.ToTable("merchant_change_logs", null, t =>
{
t.HasComment("商户变更日志。");
});
});
modelBuilder.Entity("TakeoutSaaS.Domain.Tenants.Entities.OperationLog", b =>
{
b.Property<long>("Id")

View File

@@ -17,7 +17,7 @@ namespace TakeoutSaaS.Infrastructure.Migrations
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "10.0.0")
.HasAnnotation("ProductVersion", "10.0.1")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
@@ -2373,6 +2373,14 @@ namespace TakeoutSaaS.Infrastructure.Migrations
.HasColumnType("character varying(256)")
.HasComment("详细地址。");
b.Property<DateTime?>("ApprovedAt")
.HasColumnType("timestamp with time zone")
.HasComment("审核通过时间。");
b.Property<long?>("ApprovedBy")
.HasColumnType("bigint")
.HasComment("审核通过人。");
b.Property<string>("BrandAlias")
.HasMaxLength(64)
.HasColumnType("character varying(64)")
@@ -2402,6 +2410,23 @@ namespace TakeoutSaaS.Infrastructure.Migrations
.HasColumnType("character varying(64)")
.HasComment("所在城市。");
b.Property<DateTime?>("ClaimExpiresAt")
.HasColumnType("timestamp with time zone")
.HasComment("领取过期时间。");
b.Property<DateTime?>("ClaimedAt")
.HasColumnType("timestamp with time zone")
.HasComment("领取时间。");
b.Property<long?>("ClaimedBy")
.HasColumnType("bigint")
.HasComment("当前领取人。");
b.Property<string>("ClaimedByName")
.HasMaxLength(100)
.HasColumnType("character varying(100)")
.HasComment("当前领取人姓名。");
b.Property<string>("ContactEmail")
.HasMaxLength(128)
.HasColumnType("character varying(128)")
@@ -2434,6 +2459,21 @@ namespace TakeoutSaaS.Infrastructure.Migrations
.HasColumnType("character varying(64)")
.HasComment("所在区县。");
b.Property<DateTime?>("FrozenAt")
.HasColumnType("timestamp with time zone")
.HasComment("冻结时间。");
b.Property<string>("FrozenReason")
.HasMaxLength(500)
.HasColumnType("character varying(500)")
.HasComment("冻结原因。");
b.Property<bool>("IsFrozen")
.ValueGeneratedOnAdd()
.HasColumnType("boolean")
.HasDefaultValue(false)
.HasComment("是否冻结业务。");
b.Property<DateTime?>("JoinedAt")
.HasColumnType("timestamp with time zone")
.HasComment("入驻时间。");
@@ -2442,6 +2482,10 @@ namespace TakeoutSaaS.Infrastructure.Migrations
.HasColumnType("timestamp with time zone")
.HasComment("最近一次审核时间。");
b.Property<long?>("LastReviewedBy")
.HasColumnType("bigint")
.HasComment("最近一次审核人。");
b.Property<double?>("Latitude")
.HasColumnType("double precision")
.HasComment("纬度信息。");
@@ -2459,6 +2503,10 @@ namespace TakeoutSaaS.Infrastructure.Migrations
.HasColumnType("double precision")
.HasComment("经度信息。");
b.Property<int?>("OperatingMode")
.HasColumnType("integer")
.HasComment("经营模式(同一主体/不同主体)。");
b.Property<string>("Province")
.HasMaxLength(64)
.HasColumnType("character varying(64)")
@@ -2469,6 +2517,13 @@ namespace TakeoutSaaS.Infrastructure.Migrations
.HasColumnType("character varying(512)")
.HasComment("审核备注或驳回原因。");
b.Property<byte[]>("RowVersion")
.IsConcurrencyToken()
.IsRequired()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("bytea")
.HasComment("并发控制版本。");
b.Property<string>("ServicePhone")
.HasColumnType("text")
.HasComment("客服电话。");
@@ -2499,8 +2554,12 @@ namespace TakeoutSaaS.Infrastructure.Migrations
b.HasKey("Id");
b.HasIndex("ClaimedBy");
b.HasIndex("TenantId");
b.HasIndex("TenantId", "Status");
b.ToTable("merchants", null, t =>
{
t.HasComment("商户主体信息,承载入驻和资质审核结果。");
@@ -4784,6 +4843,16 @@ namespace TakeoutSaaS.Infrastructure.Migrations
.HasColumnType("character varying(256)")
.HasComment("门店营业时段描述(备用字符串)。");
b.Property<string>("BusinessLicenseImageUrl")
.HasMaxLength(500)
.HasColumnType("character varying(500)")
.HasComment("门店营业执照图片地址(主体不一致模式使用)。");
b.Property<string>("BusinessLicenseNumber")
.HasMaxLength(50)
.HasColumnType("character varying(50)")
.HasComment("门店营业执照号(主体不一致模式使用)。");
b.Property<string>("City")
.HasMaxLength(64)
.HasColumnType("character varying(64)")
@@ -4837,6 +4906,11 @@ namespace TakeoutSaaS.Infrastructure.Migrations
.HasColumnType("double precision")
.HasComment("纬度。");
b.Property<string>("LegalRepresentative")
.HasMaxLength(100)
.HasColumnType("character varying(100)")
.HasComment("门店法人(主体不一致模式使用)。");
b.Property<double?>("Longitude")
.HasColumnType("double precision")
.HasComment("高德/腾讯地图经度。");
@@ -4866,6 +4940,11 @@ namespace TakeoutSaaS.Infrastructure.Migrations
.HasColumnType("character varying(64)")
.HasComment("所在省份。");
b.Property<string>("RegisteredAddress")
.HasMaxLength(500)
.HasColumnType("character varying(500)")
.HasComment("门店注册地址(主体不一致模式使用)。");
b.Property<int>("Status")
.HasColumnType("integer")
.HasComment("门店当前运营状态。");
@@ -4908,6 +4987,10 @@ namespace TakeoutSaaS.Infrastructure.Migrations
b.HasKey("Id");
b.HasIndex("MerchantId", "BusinessLicenseNumber")
.IsUnique()
.HasFilter("\"BusinessLicenseNumber\" IS NOT NULL AND \"Status\" <> 3");
b.HasIndex("TenantId", "Code")
.IsUnique();
@@ -5704,6 +5787,10 @@ namespace TakeoutSaaS.Infrastructure.Migrations
.HasColumnType("character varying(128)")
.HasComment("租户全称或品牌名称。");
b.Property<int?>("OperatingMode")
.HasColumnType("integer")
.HasComment("经营模式(同一主体/不同主体)。");
b.Property<long?>("PrimaryOwnerUserId")
.HasColumnType("bigint")
.HasComment("系统内对应的租户所有者账号 ID。");
@@ -5806,6 +5893,18 @@ namespace TakeoutSaaS.Infrastructure.Migrations
.HasColumnType("timestamp with time zone")
.HasComment("失效时间UTC为空表示长期有效。");
b.Property<bool>("IsActive")
.HasColumnType("boolean")
.HasComment("是否启用(已弃用,迁移期保留)。");
b.Property<int>("Priority")
.HasColumnType("integer")
.HasComment("展示优先级,数值越大越靠前。");
b.Property<DateTime?>("PublishedAt")
.HasColumnType("timestamp with time zone")
.HasComment("实际发布时间UTC。");
b.Property<int>("PublisherScope")
.HasColumnType("integer")
.HasComment("发布者范围。");
@@ -5814,32 +5913,10 @@ namespace TakeoutSaaS.Infrastructure.Migrations
.HasColumnType("bigint")
.HasComment("发布者用户 ID平台或租户后台账号。");
b.Property<int>("Status")
.HasColumnType("integer")
.HasComment("公告状态。");
b.Property<DateTime?>("PublishedAt")
.HasColumnType("timestamp with time zone")
.HasComment("实际发布时间UTC。");
b.Property<DateTime?>("RevokedAt")
.HasColumnType("timestamp with time zone")
.HasComment("撤销时间UTC。");
b.Property<DateTime?>("ScheduledPublishAt")
.HasColumnType("timestamp with time zone")
.HasComment("预定发布时间UTC。");
b.Property<string>("TargetType")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("character varying(64)")
.HasComment("目标受众类型。");
b.Property<string>("TargetParameters")
.HasColumnType("text")
.HasComment("目标受众参数JSON。");
b.Property<byte[]>("RowVersion")
.IsConcurrencyToken()
.IsRequired()
@@ -5847,13 +5924,23 @@ namespace TakeoutSaaS.Infrastructure.Migrations
.HasColumnType("bytea")
.HasComment("并发控制字段。");
b.Property<bool>("IsActive")
.HasColumnType("boolean")
.HasComment("是否启用(已弃用,迁移期保留)。");
b.Property<DateTime?>("ScheduledPublishAt")
.HasColumnType("timestamp with time zone")
.HasComment("预定发布时间UTC)。");
b.Property<int>("Priority")
b.Property<int>("Status")
.HasColumnType("integer")
.HasComment("展示优先级,数值越大越靠前。");
.HasComment("公告状态。");
b.Property<string>("TargetParameters")
.HasColumnType("text")
.HasComment("目标受众参数JSON。");
b.Property<string>("TargetType")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("character varying(64)")
.HasComment("目标受众类型。");
b.Property<long>("TenantId")
.HasColumnType("bigint")
@@ -5875,15 +5962,15 @@ namespace TakeoutSaaS.Infrastructure.Migrations
b.HasKey("Id");
b.HasIndex("Status", "EffectiveFrom")
.HasFilter("\"TenantId\" = 0");
b.HasIndex("TenantId", "AnnouncementType", "IsActive");
b.HasIndex("TenantId", "EffectiveFrom", "EffectiveTo");
b.HasIndex("TenantId", "Status", "EffectiveFrom");
b.HasIndex("Status", "EffectiveFrom")
.HasFilter("\"TenantId\" = 0");
b.ToTable("tenant_announcements", null, t =>
{
t.HasComment("租户公告。");