feat: 完成门店管理剩余接口并补齐文档注释
All checks were successful
Build and Deploy TenantApi / build-and-deploy (push) Successful in 46s

This commit is contained in:
2026-02-17 14:54:35 +08:00
parent 3a94348cca
commit 1b185af718
45 changed files with 13333 additions and 91 deletions

View File

@@ -148,6 +148,14 @@ public sealed class TakeoutAppDbContext(
/// </summary>
public DbSet<StoreDeliveryZone> StoreDeliveryZones => Set<StoreDeliveryZone>();
/// <summary>
/// 门店配送设置。
/// </summary>
public DbSet<StoreDeliverySetting> StoreDeliverySettings => Set<StoreDeliverySetting>();
/// <summary>
/// 门店堂食设置。
/// </summary>
public DbSet<StoreDineInSetting> StoreDineInSettings => Set<StoreDineInSetting>();
/// <summary>
/// 门店桌台区域。
/// </summary>
public DbSet<StoreTableArea> StoreTableAreas => Set<StoreTableArea>();
@@ -168,6 +176,14 @@ public sealed class TakeoutAppDbContext(
/// </summary>
public DbSet<StorePickupSlot> StorePickupSlots => Set<StorePickupSlot>();
/// <summary>
/// 门店班次模板。
/// </summary>
public DbSet<StoreStaffTemplate> StoreStaffTemplates => Set<StoreStaffTemplate>();
/// <summary>
/// 门店每周排班。
/// </summary>
public DbSet<StoreStaffWeeklySchedule> StoreStaffWeeklySchedules => Set<StoreStaffWeeklySchedule>();
/// <summary>
/// 商品分类。
/// </summary>
public DbSet<ProductCategory> ProductCategories => Set<ProductCategory>();
@@ -411,11 +427,15 @@ public sealed class TakeoutAppDbContext(
ConfigureStoreBusinessHour(modelBuilder.Entity<StoreBusinessHour>());
ConfigureStoreHoliday(modelBuilder.Entity<StoreHoliday>());
ConfigureStoreDeliveryZone(modelBuilder.Entity<StoreDeliveryZone>());
ConfigureStoreDeliverySetting(modelBuilder.Entity<StoreDeliverySetting>());
ConfigureStoreDineInSetting(modelBuilder.Entity<StoreDineInSetting>());
ConfigureStoreTableArea(modelBuilder.Entity<StoreTableArea>());
ConfigureStoreTable(modelBuilder.Entity<StoreTable>());
ConfigureStoreEmployeeShift(modelBuilder.Entity<StoreEmployeeShift>());
ConfigureStorePickupSetting(modelBuilder.Entity<StorePickupSetting>());
ConfigureStorePickupSlot(modelBuilder.Entity<StorePickupSlot>());
ConfigureStoreStaffTemplate(modelBuilder.Entity<StoreStaffTemplate>());
ConfigureStoreStaffWeeklySchedule(modelBuilder.Entity<StoreStaffWeeklySchedule>());
ConfigureProductCategory(modelBuilder.Entity<ProductCategory>());
ConfigureProduct(modelBuilder.Entity<Product>());
ConfigureProductAttributeGroup(modelBuilder.Entity<ProductAttributeGroup>());
@@ -603,6 +623,10 @@ public sealed class TakeoutAppDbContext(
builder.Property(x => x.FixedPackagingFee).HasPrecision(10, 2);
builder.Property(x => x.PackagingFeeTiersJson).HasColumnType("text");
builder.Property(x => x.FreeDeliveryThreshold).HasPrecision(10, 2);
builder.Property(x => x.CutleryFeeEnabled).HasDefaultValue(false);
builder.Property(x => x.CutleryFeeAmount).HasPrecision(10, 2);
builder.Property(x => x.RushFeeEnabled).HasDefaultValue(false);
builder.Property(x => x.RushFeeAmount).HasPrecision(10, 2);
builder.HasIndex(x => new { x.TenantId, x.StoreId }).IsUnique();
builder.HasIndex(x => x.TenantId);
}
@@ -981,9 +1005,34 @@ public sealed class TakeoutAppDbContext(
builder.Property(x => x.PolygonGeoJson).HasColumnType("text").IsRequired();
builder.Property(x => x.MinimumOrderAmount).HasPrecision(18, 2);
builder.Property(x => x.DeliveryFee).HasPrecision(18, 2);
builder.Property(x => x.Color).HasMaxLength(32);
builder.Property(x => x.Priority).HasDefaultValue(100);
builder.HasIndex(x => new { x.TenantId, x.StoreId, x.ZoneName });
}
private static void ConfigureStoreDeliverySetting(EntityTypeBuilder<StoreDeliverySetting> builder)
{
builder.ToTable("store_delivery_settings");
builder.HasKey(x => x.Id);
builder.Property(x => x.StoreId).IsRequired();
builder.Property(x => x.Mode).HasConversion<int>();
builder.Property(x => x.FreeDeliveryThreshold).HasPrecision(10, 2);
builder.Property(x => x.MaxDeliveryDistance).HasPrecision(10, 2);
builder.Property(x => x.RadiusTiersJson).HasColumnType("text");
builder.HasIndex(x => new { x.TenantId, x.StoreId }).IsUnique();
}
private static void ConfigureStoreDineInSetting(EntityTypeBuilder<StoreDineInSetting> builder)
{
builder.ToTable("store_dinein_settings");
builder.HasKey(x => x.Id);
builder.Property(x => x.StoreId).IsRequired();
builder.Property(x => x.Enabled).HasDefaultValue(true);
builder.Property(x => x.DefaultDiningMinutes).HasDefaultValue(90);
builder.Property(x => x.OvertimeReminderMinutes).HasDefaultValue(10);
builder.HasIndex(x => new { x.TenantId, x.StoreId }).IsUnique();
}
private static void ConfigureStoreTableArea(EntityTypeBuilder<StoreTableArea> builder)
{
builder.ToTable("store_table_areas");
@@ -1022,6 +1071,8 @@ public sealed class TakeoutAppDbContext(
builder.HasKey(x => x.Id);
builder.Property(x => x.StoreId).IsRequired();
builder.Property(x => x.DefaultCutoffMinutes).HasDefaultValue(30);
builder.Property(x => x.Mode).HasConversion<int>();
builder.Property(x => x.FineRuleJson).HasColumnType("text");
builder.Property(x => x.RowVersion)
.IsConcurrencyToken();
builder.HasIndex(x => new { x.TenantId, x.StoreId }).IsUnique();
@@ -1040,6 +1091,34 @@ public sealed class TakeoutAppDbContext(
builder.HasIndex(x => new { x.TenantId, x.StoreId, x.Name });
}
private static void ConfigureStoreStaffTemplate(EntityTypeBuilder<StoreStaffTemplate> builder)
{
builder.ToTable("store_staff_templates");
builder.HasKey(x => x.Id);
builder.Property(x => x.StoreId).IsRequired();
builder.Property(x => x.MorningStartTime).IsRequired();
builder.Property(x => x.MorningEndTime).IsRequired();
builder.Property(x => x.EveningStartTime).IsRequired();
builder.Property(x => x.EveningEndTime).IsRequired();
builder.Property(x => x.FullStartTime).IsRequired();
builder.Property(x => x.FullEndTime).IsRequired();
builder.HasIndex(x => new { x.TenantId, x.StoreId }).IsUnique();
}
private static void ConfigureStoreStaffWeeklySchedule(EntityTypeBuilder<StoreStaffWeeklySchedule> builder)
{
builder.ToTable("store_staff_weekly_schedules");
builder.HasKey(x => x.Id);
builder.Property(x => x.StoreId).IsRequired();
builder.Property(x => x.StaffId).IsRequired();
builder.Property(x => x.DayOfWeek).IsRequired();
builder.Property(x => x.ShiftType).HasConversion<int>();
builder.Property(x => x.StartTime);
builder.Property(x => x.EndTime);
builder.HasIndex(x => new { x.TenantId, x.StoreId, x.StaffId, x.DayOfWeek }).IsUnique();
builder.HasIndex(x => new { x.TenantId, x.StoreId, x.DayOfWeek });
}
private static void ConfigureProductAttributeGroup(EntityTypeBuilder<ProductAttributeGroup> builder)
{
builder.ToTable("product_attribute_groups");

View File

@@ -0,0 +1,295 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace TakeoutSaaS.Infrastructure.Migrations
{
/// <inheritdoc />
public partial class AddStoreExtendedSettings : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "FineRuleJson",
table: "store_pickup_settings",
type: "text",
nullable: true,
comment: "精细规则 JSON。");
migrationBuilder.AddColumn<int>(
name: "Mode",
table: "store_pickup_settings",
type: "integer",
nullable: false,
defaultValue: 0,
comment: "自提配置模式。");
migrationBuilder.AddColumn<decimal>(
name: "CutleryFeeAmount",
table: "store_fees",
type: "numeric(10,2)",
precision: 10,
scale: 2,
nullable: false,
defaultValue: 0m,
comment: "餐具费金额。");
migrationBuilder.AddColumn<bool>(
name: "CutleryFeeEnabled",
table: "store_fees",
type: "boolean",
nullable: false,
defaultValue: false,
comment: "是否启用餐具费。");
migrationBuilder.AddColumn<decimal>(
name: "RushFeeAmount",
table: "store_fees",
type: "numeric(10,2)",
precision: 10,
scale: 2,
nullable: false,
defaultValue: 0m,
comment: "加急费金额。");
migrationBuilder.AddColumn<bool>(
name: "RushFeeEnabled",
table: "store_fees",
type: "boolean",
nullable: false,
defaultValue: false,
comment: "是否启用加急费。");
migrationBuilder.AddColumn<string>(
name: "Color",
table: "store_delivery_zones",
type: "character varying(32)",
maxLength: 32,
nullable: true,
comment: "区域颜色。");
migrationBuilder.AddColumn<int>(
name: "Priority",
table: "store_delivery_zones",
type: "integer",
nullable: false,
defaultValue: 100,
comment: "优先级(数值越小越优先)。");
migrationBuilder.CreateTable(
name: "store_delivery_settings",
columns: table => new
{
Id = table.Column<long>(type: "bigint", nullable: false, comment: "实体唯一标识。")
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
StoreId = table.Column<long>(type: "bigint", nullable: false, comment: "门店 ID。"),
Mode = table.Column<int>(type: "integer", nullable: false, comment: "配送模式。"),
EtaAdjustmentMinutes = table.Column<int>(type: "integer", nullable: false, comment: "配送时效加成(分钟)。"),
FreeDeliveryThreshold = table.Column<decimal>(type: "numeric(10,2)", precision: 10, scale: 2, nullable: true, comment: "免配送费门槛。"),
HourlyCapacityLimit = table.Column<int>(type: "integer", nullable: false, comment: "每小时配送上限。"),
MaxDeliveryDistance = table.Column<decimal>(type: "numeric(10,2)", precision: 10, scale: 2, nullable: false, comment: "最大配送距离(公里)。"),
RadiusTiersJson = table.Column<string>(type: "text", nullable: true, comment: "半径梯度配置 JSON。"),
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_store_delivery_settings", x => x.Id);
},
comment: "门店配送设置聚合。");
migrationBuilder.CreateTable(
name: "store_dinein_settings",
columns: table => new
{
Id = table.Column<long>(type: "bigint", nullable: false, comment: "实体唯一标识。")
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
StoreId = table.Column<long>(type: "bigint", nullable: false, comment: "门店 ID。"),
Enabled = table.Column<bool>(type: "boolean", nullable: false, defaultValue: true, comment: "是否启用堂食。"),
DefaultDiningMinutes = table.Column<int>(type: "integer", nullable: false, defaultValue: 90, comment: "默认用餐时长(分钟)。"),
OvertimeReminderMinutes = table.Column<int>(type: "integer", nullable: false, defaultValue: 10, 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_store_dinein_settings", x => x.Id);
},
comment: "门店堂食基础设置。");
migrationBuilder.CreateTable(
name: "store_staff_templates",
columns: table => new
{
Id = table.Column<long>(type: "bigint", nullable: false, comment: "实体唯一标识。")
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
StoreId = table.Column<long>(type: "bigint", nullable: false, comment: "门店 ID。"),
MorningStartTime = table.Column<TimeSpan>(type: "interval", nullable: false, comment: "早班开始时间。"),
MorningEndTime = table.Column<TimeSpan>(type: "interval", nullable: false, comment: "早班结束时间。"),
EveningStartTime = table.Column<TimeSpan>(type: "interval", nullable: false, comment: "晚班开始时间。"),
EveningEndTime = table.Column<TimeSpan>(type: "interval", nullable: false, comment: "晚班结束时间。"),
FullStartTime = table.Column<TimeSpan>(type: "interval", nullable: false, comment: "全天班开始时间。"),
FullEndTime = table.Column<TimeSpan>(type: "interval", nullable: false, 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_store_staff_templates", x => x.Id);
},
comment: "门店员工班次模板。");
migrationBuilder.CreateTable(
name: "store_staff_weekly_schedules",
columns: table => new
{
Id = table.Column<long>(type: "bigint", nullable: false, comment: "实体唯一标识。")
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
StoreId = table.Column<long>(type: "bigint", nullable: false, comment: "门店 ID。"),
StaffId = table.Column<long>(type: "bigint", nullable: false, comment: "员工 ID。"),
DayOfWeek = table.Column<int>(type: "integer", nullable: false, comment: "星期0=周一6=周日)。"),
ShiftType = table.Column<int>(type: "integer", nullable: false, comment: "班次类型。"),
StartTime = table.Column<TimeSpan>(type: "interval", nullable: true, comment: "开始时间(休息时为空)。"),
EndTime = table.Column<TimeSpan>(type: "interval", 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_store_staff_weekly_schedules", x => x.Id);
},
comment: "门店员工每周排班。");
migrationBuilder.CreateTable(
name: "tenant_visibility_role_rules",
columns: table => new
{
Id = table.Column<long>(type: "bigint", nullable: false, comment: "实体唯一标识。")
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
QuotaVisibleRoleCodes = table.Column<string[]>(type: "text[]", nullable: false, comment: "配额可见角色编码集合。"),
BillingVisibleRoleCodes = table.Column<string[]>(type: "text[]", nullable: false, comment: "账单可见角色编码集合。"),
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "创建时间UTC。"),
UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, 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: false, 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_tenant_visibility_role_rules", x => x.Id);
},
comment: "租户账单/配额可见角色规则。");
migrationBuilder.CreateIndex(
name: "IX_store_delivery_settings_TenantId_StoreId",
table: "store_delivery_settings",
columns: new[] { "TenantId", "StoreId" },
unique: true);
migrationBuilder.CreateIndex(
name: "IX_store_dinein_settings_TenantId_StoreId",
table: "store_dinein_settings",
columns: new[] { "TenantId", "StoreId" },
unique: true);
migrationBuilder.CreateIndex(
name: "IX_store_staff_templates_TenantId_StoreId",
table: "store_staff_templates",
columns: new[] { "TenantId", "StoreId" },
unique: true);
migrationBuilder.CreateIndex(
name: "IX_store_staff_weekly_schedules_TenantId_StoreId_DayOfWeek",
table: "store_staff_weekly_schedules",
columns: new[] { "TenantId", "StoreId", "DayOfWeek" });
migrationBuilder.CreateIndex(
name: "IX_store_staff_weekly_schedules_TenantId_StoreId_StaffId_DayOf~",
table: "store_staff_weekly_schedules",
columns: new[] { "TenantId", "StoreId", "StaffId", "DayOfWeek" },
unique: true);
migrationBuilder.CreateIndex(
name: "IX_tenant_visibility_role_rules_TenantId",
table: "tenant_visibility_role_rules",
column: "TenantId",
unique: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "store_delivery_settings");
migrationBuilder.DropTable(
name: "store_dinein_settings");
migrationBuilder.DropTable(
name: "store_staff_templates");
migrationBuilder.DropTable(
name: "store_staff_weekly_schedules");
migrationBuilder.DropTable(
name: "tenant_visibility_role_rules");
migrationBuilder.DropColumn(
name: "FineRuleJson",
table: "store_pickup_settings");
migrationBuilder.DropColumn(
name: "Mode",
table: "store_pickup_settings");
migrationBuilder.DropColumn(
name: "CutleryFeeAmount",
table: "store_fees");
migrationBuilder.DropColumn(
name: "CutleryFeeEnabled",
table: "store_fees");
migrationBuilder.DropColumn(
name: "RushFeeAmount",
table: "store_fees");
migrationBuilder.DropColumn(
name: "RushFeeEnabled",
table: "store_fees");
migrationBuilder.DropColumn(
name: "Color",
table: "store_delivery_zones");
migrationBuilder.DropColumn(
name: "Priority",
table: "store_delivery_zones");
}
}
}

View File

@@ -654,7 +654,7 @@ namespace TakeoutSaaS.Infrastructure.Migrations
b.Property<long?>("StoreId")
.HasColumnType("bigint")
.HasComment("所属门店(可空为平台)。");
.HasComment("所属门店(可空为系统会话)。");
b.Property<long>("TenantId")
.HasColumnType("bigint")
@@ -1148,7 +1148,7 @@ namespace TakeoutSaaS.Infrastructure.Migrations
b.Property<long?>("UserId")
.HasColumnType("bigint")
.HasComment("用户 ID如绑定平台账号)。");
.HasComment("用户 ID如绑定登录账号)。");
b.HasKey("Id");
@@ -2517,13 +2517,6 @@ 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("客服电话。");
@@ -2552,6 +2545,12 @@ namespace TakeoutSaaS.Infrastructure.Migrations
.HasColumnType("bigint")
.HasComment("最后更新人用户标识,匿名或系统操作时为 null。");
b.Property<uint>("xmin")
.IsConcurrencyToken()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("xid")
.HasColumnName("xmin");
b.HasKey("Id");
b.HasIndex("ClaimedBy");
@@ -3791,7 +3790,7 @@ namespace TakeoutSaaS.Infrastructure.Migrations
b.Property<string>("TradeNo")
.HasMaxLength(64)
.HasColumnType("character varying(64)")
.HasComment("平台交易号。");
.HasComment("系统交易号。");
b.Property<DateTime?>("UpdatedAt")
.HasColumnType("timestamp with time zone")
@@ -5228,6 +5227,84 @@ namespace TakeoutSaaS.Infrastructure.Migrations
});
});
modelBuilder.Entity("TakeoutSaaS.Domain.Stores.Entities.StoreDeliverySetting", 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<int>("EtaAdjustmentMinutes")
.HasColumnType("integer")
.HasComment("配送时效加成(分钟)。");
b.Property<decimal?>("FreeDeliveryThreshold")
.HasPrecision(10, 2)
.HasColumnType("numeric(10,2)")
.HasComment("免配送费门槛。");
b.Property<int>("HourlyCapacityLimit")
.HasColumnType("integer")
.HasComment("每小时配送上限。");
b.Property<decimal>("MaxDeliveryDistance")
.HasPrecision(10, 2)
.HasColumnType("numeric(10,2)")
.HasComment("最大配送距离(公里)。");
b.Property<int>("Mode")
.HasColumnType("integer")
.HasComment("配送模式。");
b.Property<string>("RadiusTiersJson")
.HasColumnType("text")
.HasComment("半径梯度配置 JSON。");
b.Property<long>("StoreId")
.HasColumnType("bigint")
.HasComment("门店 ID。");
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", "StoreId")
.IsUnique();
b.ToTable("store_delivery_settings", null, t =>
{
t.HasComment("门店配送设置聚合。");
});
});
modelBuilder.Entity("TakeoutSaaS.Domain.Stores.Entities.StoreDeliveryZone", b =>
{
b.Property<long>("Id")
@@ -5237,6 +5314,11 @@ namespace TakeoutSaaS.Infrastructure.Migrations
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
b.Property<string>("Color")
.HasMaxLength(32)
.HasColumnType("character varying(32)")
.HasComment("区域颜色。");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone")
.HasComment("创建时间UTC。");
@@ -5272,6 +5354,12 @@ namespace TakeoutSaaS.Infrastructure.Migrations
.HasColumnType("text")
.HasComment("GeoJSON 表示的多边形范围。");
b.Property<int>("Priority")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasDefaultValue(100)
.HasComment("优先级(数值越小越优先)。");
b.Property<int>("SortOrder")
.HasColumnType("integer")
.HasComment("排序值。");
@@ -5308,6 +5396,76 @@ namespace TakeoutSaaS.Infrastructure.Migrations
});
});
modelBuilder.Entity("TakeoutSaaS.Domain.Stores.Entities.StoreDineInSetting", 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<int>("DefaultDiningMinutes")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasDefaultValue(90)
.HasComment("默认用餐时长(分钟)。");
b.Property<DateTime?>("DeletedAt")
.HasColumnType("timestamp with time zone")
.HasComment("软删除时间UTC未删除时为 null。");
b.Property<long?>("DeletedBy")
.HasColumnType("bigint")
.HasComment("删除人用户标识(软删除),未删除时为 null。");
b.Property<bool>("Enabled")
.ValueGeneratedOnAdd()
.HasColumnType("boolean")
.HasDefaultValue(true)
.HasComment("是否启用堂食。");
b.Property<int>("OvertimeReminderMinutes")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasDefaultValue(10)
.HasComment("超时提醒阈值(分钟)。");
b.Property<long>("StoreId")
.HasColumnType("bigint")
.HasComment("门店 ID。");
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", "StoreId")
.IsUnique();
b.ToTable("store_dinein_settings", null, t =>
{
t.HasComment("门店堂食基础设置。");
});
});
modelBuilder.Entity("TakeoutSaaS.Domain.Stores.Entities.StoreEmployeeShift", b =>
{
b.Property<long>("Id")
@@ -5407,6 +5565,17 @@ namespace TakeoutSaaS.Infrastructure.Migrations
.HasColumnType("bigint")
.HasComment("创建人用户标识,匿名或系统操作时为 null。");
b.Property<decimal>("CutleryFeeAmount")
.HasPrecision(10, 2)
.HasColumnType("numeric(10,2)")
.HasComment("餐具费金额。");
b.Property<bool>("CutleryFeeEnabled")
.ValueGeneratedOnAdd()
.HasColumnType("boolean")
.HasDefaultValue(false)
.HasComment("是否启用餐具费。");
b.Property<DateTime?>("DeletedAt")
.HasColumnType("timestamp with time zone")
.HasComment("软删除时间UTC未删除时为 null。");
@@ -5430,18 +5599,29 @@ namespace TakeoutSaaS.Infrastructure.Migrations
.HasColumnType("numeric(10,2)")
.HasComment("起送费(元)。");
b.Property<int>("PackagingFeeMode")
.HasColumnType("integer")
.HasComment("打包费模式。");
b.Property<int>("OrderPackagingFeeMode")
.HasColumnType("integer")
.HasComment("订单打包费规则(按订单收费时生效)。");
b.Property<int>("PackagingFeeMode")
.HasColumnType("integer")
.HasComment("打包费模式。");
b.Property<string>("PackagingFeeTiersJson")
.HasColumnType("text")
.HasComment("阶梯打包费配置JSON。");
b.Property<decimal>("RushFeeAmount")
.HasPrecision(10, 2)
.HasColumnType("numeric(10,2)")
.HasComment("加急费金额。");
b.Property<bool>("RushFeeEnabled")
.ValueGeneratedOnAdd()
.HasColumnType("boolean")
.HasDefaultValue(false)
.HasComment("是否启用加急费。");
b.Property<long>("StoreId")
.HasColumnType("bigint")
.HasComment("门店标识。");
@@ -5600,10 +5780,18 @@ namespace TakeoutSaaS.Infrastructure.Migrations
.HasColumnType("bigint")
.HasComment("删除人用户标识(软删除),未删除时为 null。");
b.Property<string>("FineRuleJson")
.HasColumnType("text")
.HasComment("精细规则 JSON。");
b.Property<int?>("MaxQuantityPerOrder")
.HasColumnType("integer")
.HasComment("单笔自提最大份数。");
b.Property<int>("Mode")
.HasColumnType("integer")
.HasComment("自提配置模式。");
b.Property<byte[]>("RowVersion")
.IsConcurrencyToken()
.IsRequired()
@@ -5817,6 +6005,156 @@ namespace TakeoutSaaS.Infrastructure.Migrations
});
});
modelBuilder.Entity("TakeoutSaaS.Domain.Stores.Entities.StoreStaffTemplate", 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<TimeSpan>("EveningEndTime")
.HasColumnType("interval")
.HasComment("晚班结束时间。");
b.Property<TimeSpan>("EveningStartTime")
.HasColumnType("interval")
.HasComment("晚班开始时间。");
b.Property<TimeSpan>("FullEndTime")
.HasColumnType("interval")
.HasComment("全天班结束时间。");
b.Property<TimeSpan>("FullStartTime")
.HasColumnType("interval")
.HasComment("全天班开始时间。");
b.Property<TimeSpan>("MorningEndTime")
.HasColumnType("interval")
.HasComment("早班结束时间。");
b.Property<TimeSpan>("MorningStartTime")
.HasColumnType("interval")
.HasComment("早班开始时间。");
b.Property<long>("StoreId")
.HasColumnType("bigint")
.HasComment("门店 ID。");
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", "StoreId")
.IsUnique();
b.ToTable("store_staff_templates", null, t =>
{
t.HasComment("门店员工班次模板。");
});
});
modelBuilder.Entity("TakeoutSaaS.Domain.Stores.Entities.StoreStaffWeeklySchedule", 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<int>("DayOfWeek")
.HasColumnType("integer")
.HasComment("星期0=周一6=周日)。");
b.Property<DateTime?>("DeletedAt")
.HasColumnType("timestamp with time zone")
.HasComment("软删除时间UTC未删除时为 null。");
b.Property<long?>("DeletedBy")
.HasColumnType("bigint")
.HasComment("删除人用户标识(软删除),未删除时为 null。");
b.Property<TimeSpan?>("EndTime")
.HasColumnType("interval")
.HasComment("结束时间(休息时为空)。");
b.Property<int>("ShiftType")
.HasColumnType("integer")
.HasComment("班次类型。");
b.Property<long>("StaffId")
.HasColumnType("bigint")
.HasComment("员工 ID。");
b.Property<TimeSpan?>("StartTime")
.HasColumnType("interval")
.HasComment("开始时间(休息时为空)。");
b.Property<long>("StoreId")
.HasColumnType("bigint")
.HasComment("门店 ID。");
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", "StoreId", "DayOfWeek");
b.HasIndex("TenantId", "StoreId", "StaffId", "DayOfWeek")
.IsUnique();
b.ToTable("store_staff_weekly_schedules", null, t =>
{
t.HasComment("门店员工每周排班。");
});
});
modelBuilder.Entity("TakeoutSaaS.Domain.Stores.Entities.StoreTable", b =>
{
b.Property<long>("Id")
@@ -6038,7 +6376,7 @@ namespace TakeoutSaaS.Infrastructure.Migrations
b.ToTable("quota_packages", null, t =>
{
t.HasComment("配额包定义(平台提供的可购买配额包)。");
t.HasComment("配额包定义(系统提供的可购买配额包)。");
});
});
@@ -6191,7 +6529,7 @@ namespace TakeoutSaaS.Infrastructure.Migrations
b.ToTable("tenants", null, t =>
{
t.HasComment("平台租户信息,描述租户的生命周期与基础资料。");
t.HasComment("租户信息,描述租户的生命周期与基础资料。");
});
});
@@ -6255,7 +6593,7 @@ namespace TakeoutSaaS.Infrastructure.Migrations
b.Property<long?>("PublisherUserId")
.HasColumnType("bigint")
.HasComment("发布者用户 ID平台或租户后台账号)。");
.HasComment("发布者用户 ID系统或租户后台账号)。");
b.Property<DateTime?>("RevokedAt")
.HasColumnType("timestamp with time zone")
@@ -6629,7 +6967,7 @@ namespace TakeoutSaaS.Infrastructure.Migrations
b.Property<bool>("IsActive")
.HasColumnType("boolean")
.HasComment("是否仍启用(平台控制)。");
.HasComment("是否仍启用(系统控制)。");
b.Property<bool>("IsAllowNewTenantPurchase")
.ValueGeneratedOnAdd()
@@ -6720,7 +7058,7 @@ namespace TakeoutSaaS.Infrastructure.Migrations
b.ToTable("tenant_packages", null, t =>
{
t.HasComment("平台提供的租户套餐定义。");
t.HasComment("系统提供的租户套餐定义。");
});
});
@@ -7051,75 +7389,6 @@ namespace TakeoutSaaS.Infrastructure.Migrations
});
});
modelBuilder.Entity("TakeoutSaaS.Domain.Tenants.Entities.TenantReviewClaim", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint")
.HasComment("实体唯一标识。");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
b.Property<DateTime>("ClaimedAt")
.HasColumnType("timestamp with time zone")
.HasComment("领取时间UTC。");
b.Property<long>("ClaimedBy")
.HasColumnType("bigint")
.HasComment("领取人用户 ID。");
b.Property<string>("ClaimedByName")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("character varying(64)")
.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<DateTime?>("ReleasedAt")
.HasColumnType("timestamp with time zone")
.HasComment("释放时间UTC未释放时为 null。");
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("ClaimedBy");
b.HasIndex("TenantId")
.IsUnique()
.HasFilter("\"ReleasedAt\" IS NULL AND \"DeletedAt\" IS NULL");
b.ToTable("tenant_review_claims", null, t =>
{
t.HasComment("租户入驻审核领取记录(防止多管理员并发审核)。");
});
});
modelBuilder.Entity("TakeoutSaaS.Domain.Tenants.Entities.TenantSubscription", b =>
{
b.Property<long>("Id")
@@ -7407,6 +7676,64 @@ namespace TakeoutSaaS.Infrastructure.Migrations
});
});
modelBuilder.Entity("TakeoutSaaS.Domain.Tenants.Entities.TenantVisibilityRoleRule", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint")
.HasComment("实体唯一标识。");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
b.PrimitiveCollection<string[]>("BillingVisibleRoleCodes")
.IsRequired()
.HasColumnType("text[]")
.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.PrimitiveCollection<string[]>("QuotaVisibleRoleCodes")
.IsRequired()
.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("TenantId")
.IsUnique();
b.ToTable("tenant_visibility_role_rules", null, t =>
{
t.HasComment("租户账单/配额可见角色规则。");
});
});
modelBuilder.Entity("TakeoutSaaS.Domain.Orders.Entities.OrderItem", b =>
{
b.HasOne("TakeoutSaaS.Domain.Orders.Entities.Order", null)