feat: 新增规格做法模板管理接口与数据模型
All checks were successful
Build and Deploy TenantApi / build-and-deploy (push) Successful in 45s
All checks were successful
Build and Deploy TenantApi / build-and-deploy (push) Successful in 45s
This commit is contained in:
@@ -201,6 +201,18 @@ public sealed class TakeoutAppDbContext(
|
||||
/// </summary>
|
||||
public DbSet<ProductAttributeOption> ProductAttributeOptions => Set<ProductAttributeOption>();
|
||||
/// <summary>
|
||||
/// 门店规格做法模板。
|
||||
/// </summary>
|
||||
public DbSet<ProductSpecTemplate> ProductSpecTemplates => Set<ProductSpecTemplate>();
|
||||
/// <summary>
|
||||
/// 门店规格做法模板选项。
|
||||
/// </summary>
|
||||
public DbSet<ProductSpecTemplateOption> ProductSpecTemplateOptions => Set<ProductSpecTemplateOption>();
|
||||
/// <summary>
|
||||
/// 门店规格做法模板关联商品。
|
||||
/// </summary>
|
||||
public DbSet<ProductSpecTemplateProduct> ProductSpecTemplateProducts => Set<ProductSpecTemplateProduct>();
|
||||
/// <summary>
|
||||
/// SKU 实体。
|
||||
/// </summary>
|
||||
public DbSet<ProductSku> ProductSkus => Set<ProductSku>();
|
||||
@@ -441,6 +453,9 @@ public sealed class TakeoutAppDbContext(
|
||||
ConfigureProduct(modelBuilder.Entity<Product>());
|
||||
ConfigureProductAttributeGroup(modelBuilder.Entity<ProductAttributeGroup>());
|
||||
ConfigureProductAttributeOption(modelBuilder.Entity<ProductAttributeOption>());
|
||||
ConfigureProductSpecTemplate(modelBuilder.Entity<ProductSpecTemplate>());
|
||||
ConfigureProductSpecTemplateOption(modelBuilder.Entity<ProductSpecTemplateOption>());
|
||||
ConfigureProductSpecTemplateProduct(modelBuilder.Entity<ProductSpecTemplateProduct>());
|
||||
ConfigureProductSku(modelBuilder.Entity<ProductSku>());
|
||||
ConfigureProductAddonGroup(modelBuilder.Entity<ProductAddonGroup>());
|
||||
ConfigureProductAddonOption(modelBuilder.Entity<ProductAddonOption>());
|
||||
@@ -1164,6 +1179,43 @@ public sealed class TakeoutAppDbContext(
|
||||
builder.HasIndex(x => new { x.TenantId, x.AttributeGroupId, x.Name }).IsUnique();
|
||||
}
|
||||
|
||||
private static void ConfigureProductSpecTemplate(EntityTypeBuilder<ProductSpecTemplate> builder)
|
||||
{
|
||||
builder.ToTable("product_spec_templates");
|
||||
builder.HasKey(x => x.Id);
|
||||
builder.Property(x => x.StoreId).IsRequired();
|
||||
builder.Property(x => x.Name).HasMaxLength(64).IsRequired();
|
||||
builder.Property(x => x.TemplateType).HasConversion<int>();
|
||||
builder.Property(x => x.SelectionType).HasConversion<int>();
|
||||
builder.Property(x => x.SortOrder).IsRequired();
|
||||
builder.Property(x => x.IsEnabled).IsRequired();
|
||||
builder.Property(x => x.IsRequired).IsRequired();
|
||||
builder.HasIndex(x => new { x.TenantId, x.StoreId, x.Name }).IsUnique();
|
||||
builder.HasIndex(x => new { x.TenantId, x.StoreId, x.TemplateType, x.IsEnabled });
|
||||
}
|
||||
|
||||
private static void ConfigureProductSpecTemplateOption(EntityTypeBuilder<ProductSpecTemplateOption> builder)
|
||||
{
|
||||
builder.ToTable("product_spec_template_options");
|
||||
builder.HasKey(x => x.Id);
|
||||
builder.Property(x => x.TemplateId).IsRequired();
|
||||
builder.Property(x => x.Name).HasMaxLength(64).IsRequired();
|
||||
builder.Property(x => x.ExtraPrice).HasPrecision(18, 2);
|
||||
builder.Property(x => x.SortOrder).IsRequired();
|
||||
builder.HasIndex(x => new { x.TenantId, x.TemplateId, x.Name }).IsUnique();
|
||||
}
|
||||
|
||||
private static void ConfigureProductSpecTemplateProduct(EntityTypeBuilder<ProductSpecTemplateProduct> builder)
|
||||
{
|
||||
builder.ToTable("product_spec_template_products");
|
||||
builder.HasKey(x => x.Id);
|
||||
builder.Property(x => x.StoreId).IsRequired();
|
||||
builder.Property(x => x.TemplateId).IsRequired();
|
||||
builder.Property(x => x.ProductId).IsRequired();
|
||||
builder.HasIndex(x => new { x.TenantId, x.StoreId, x.TemplateId, x.ProductId }).IsUnique();
|
||||
builder.HasIndex(x => new { x.TenantId, x.StoreId, x.ProductId });
|
||||
}
|
||||
|
||||
private static void ConfigureProductSku(EntityTypeBuilder<ProductSku> builder)
|
||||
{
|
||||
builder.ToTable("product_skus");
|
||||
|
||||
@@ -133,6 +133,98 @@ public sealed class EfProductRepository(TakeoutAppDbContext context) : IProductR
|
||||
.ToDictionaryAsync(item => item.CategoryId, item => item.Count, cancellationToken);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<IReadOnlyList<ProductSpecTemplate>> GetSpecTemplatesByStoreAsync(long tenantId, long storeId, CancellationToken cancellationToken = default)
|
||||
{
|
||||
return await context.ProductSpecTemplates
|
||||
.AsNoTracking()
|
||||
.Where(x => x.TenantId == tenantId && x.StoreId == storeId)
|
||||
.OrderBy(x => x.SortOrder)
|
||||
.ThenBy(x => x.Id)
|
||||
.ToListAsync(cancellationToken);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public Task<ProductSpecTemplate?> FindSpecTemplateByIdAsync(long templateId, long tenantId, CancellationToken cancellationToken = default)
|
||||
{
|
||||
return context.ProductSpecTemplates
|
||||
.Where(x => x.TenantId == tenantId && x.Id == templateId)
|
||||
.FirstOrDefaultAsync(cancellationToken);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public Task<bool> ExistsSpecTemplateNameAsync(long tenantId, long storeId, string name, long? excludeTemplateId = null, CancellationToken cancellationToken = default)
|
||||
{
|
||||
var normalizedName = (name ?? string.Empty).Trim();
|
||||
var normalizedLower = normalizedName.ToLowerInvariant();
|
||||
var query = context.ProductSpecTemplates
|
||||
.AsNoTracking()
|
||||
.Where(x =>
|
||||
x.TenantId == tenantId &&
|
||||
x.StoreId == storeId &&
|
||||
x.Name.ToLower() == normalizedLower);
|
||||
|
||||
if (excludeTemplateId.HasValue)
|
||||
{
|
||||
query = query.Where(x => x.Id != excludeTemplateId.Value);
|
||||
}
|
||||
|
||||
return query.AnyAsync(cancellationToken);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<IReadOnlyList<ProductSpecTemplateOption>> GetSpecTemplateOptionsByTemplateIdsAsync(IReadOnlyCollection<long> templateIds, long tenantId, CancellationToken cancellationToken = default)
|
||||
{
|
||||
if (templateIds.Count == 0)
|
||||
{
|
||||
return Array.Empty<ProductSpecTemplateOption>();
|
||||
}
|
||||
|
||||
return await context.ProductSpecTemplateOptions
|
||||
.AsNoTracking()
|
||||
.Where(x => x.TenantId == tenantId && templateIds.Contains(x.TemplateId))
|
||||
.OrderBy(x => x.SortOrder)
|
||||
.ThenBy(x => x.Id)
|
||||
.ToListAsync(cancellationToken);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<IReadOnlyList<ProductSpecTemplateProduct>> GetSpecTemplateProductsByTemplateIdsAsync(IReadOnlyCollection<long> templateIds, long tenantId, long storeId, CancellationToken cancellationToken = default)
|
||||
{
|
||||
if (templateIds.Count == 0)
|
||||
{
|
||||
return Array.Empty<ProductSpecTemplateProduct>();
|
||||
}
|
||||
|
||||
return await context.ProductSpecTemplateProducts
|
||||
.AsNoTracking()
|
||||
.Where(x =>
|
||||
x.TenantId == tenantId &&
|
||||
x.StoreId == storeId &&
|
||||
templateIds.Contains(x.TemplateId))
|
||||
.OrderBy(x => x.TemplateId)
|
||||
.ThenBy(x => x.ProductId)
|
||||
.ToListAsync(cancellationToken);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<IReadOnlyList<long>> FilterExistingProductIdsAsync(long tenantId, long storeId, IReadOnlyCollection<long> productIds, CancellationToken cancellationToken = default)
|
||||
{
|
||||
if (productIds.Count == 0)
|
||||
{
|
||||
return Array.Empty<long>();
|
||||
}
|
||||
|
||||
return await context.Products
|
||||
.AsNoTracking()
|
||||
.Where(x =>
|
||||
x.TenantId == tenantId &&
|
||||
x.StoreId == storeId &&
|
||||
productIds.Contains(x.Id))
|
||||
.Select(x => x.Id)
|
||||
.ToListAsync(cancellationToken);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<IReadOnlyList<Product>> SearchPickerAsync(long tenantId, long storeId, long? categoryId, string? keyword, int limit, CancellationToken cancellationToken = default)
|
||||
{
|
||||
@@ -422,6 +514,24 @@ public sealed class EfProductRepository(TakeoutAppDbContext context) : IProductR
|
||||
return context.ProductCategories.AddAsync(category, cancellationToken).AsTask();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public Task AddSpecTemplateAsync(ProductSpecTemplate template, CancellationToken cancellationToken = default)
|
||||
{
|
||||
return context.ProductSpecTemplates.AddAsync(template, cancellationToken).AsTask();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public Task AddSpecTemplateOptionsAsync(IEnumerable<ProductSpecTemplateOption> options, CancellationToken cancellationToken = default)
|
||||
{
|
||||
return context.ProductSpecTemplateOptions.AddRangeAsync(options, cancellationToken);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public Task AddSpecTemplateProductsAsync(IEnumerable<ProductSpecTemplateProduct> relations, CancellationToken cancellationToken = default)
|
||||
{
|
||||
return context.ProductSpecTemplateProducts.AddRangeAsync(relations, cancellationToken);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public Task AddProductAsync(Product product, CancellationToken cancellationToken = default)
|
||||
{
|
||||
@@ -503,6 +613,13 @@ public sealed class EfProductRepository(TakeoutAppDbContext context) : IProductR
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public Task UpdateSpecTemplateAsync(ProductSpecTemplate template, CancellationToken cancellationToken = default)
|
||||
{
|
||||
context.ProductSpecTemplates.Update(template);
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task DeleteCategoryAsync(long categoryId, long tenantId, CancellationToken cancellationToken = default)
|
||||
{
|
||||
@@ -518,6 +635,23 @@ public sealed class EfProductRepository(TakeoutAppDbContext context) : IProductR
|
||||
context.ProductCategories.Remove(existing);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task DeleteSpecTemplateAsync(long templateId, long tenantId, CancellationToken cancellationToken = default)
|
||||
{
|
||||
var existing = await context.ProductSpecTemplates
|
||||
.Where(x => x.TenantId == tenantId && x.Id == templateId)
|
||||
.FirstOrDefaultAsync(cancellationToken);
|
||||
|
||||
if (existing is null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
await context.ProductSpecTemplates
|
||||
.Where(x => x.TenantId == tenantId && x.Id == templateId)
|
||||
.ExecuteDeleteAsync(cancellationToken);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task RemoveSkusAsync(long productId, long tenantId, CancellationToken cancellationToken = default)
|
||||
{
|
||||
@@ -533,6 +667,25 @@ public sealed class EfProductRepository(TakeoutAppDbContext context) : IProductR
|
||||
context.ProductSkus.RemoveRange(skus);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task RemoveSpecTemplateOptionsAsync(long templateId, long tenantId, CancellationToken cancellationToken = default)
|
||||
{
|
||||
await context.ProductSpecTemplateOptions
|
||||
.Where(x => x.TenantId == tenantId && x.TemplateId == templateId)
|
||||
.ExecuteDeleteAsync(cancellationToken);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task RemoveSpecTemplateProductsAsync(long templateId, long tenantId, long storeId, CancellationToken cancellationToken = default)
|
||||
{
|
||||
await context.ProductSpecTemplateProducts
|
||||
.Where(x =>
|
||||
x.TenantId == tenantId &&
|
||||
x.StoreId == storeId &&
|
||||
x.TemplateId == templateId)
|
||||
.ExecuteDeleteAsync(cancellationToken);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task RemoveAddonGroupsAsync(long productId, long tenantId, CancellationToken cancellationToken = default)
|
||||
{
|
||||
|
||||
8075
src/Infrastructure/TakeoutSaaS.Infrastructure/Migrations/20260220112948_AddProductSpecTemplates.Designer.cs
generated
Normal file
8075
src/Infrastructure/TakeoutSaaS.Infrastructure/Migrations/20260220112948_AddProductSpecTemplates.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,131 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace TakeoutSaaS.Infrastructure.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddProductSpecTemplates : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "product_spec_template_options",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<long>(type: "bigint", nullable: false, comment: "实体唯一标识。")
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
TemplateId = table.Column<long>(type: "bigint", nullable: false, comment: "模板 ID。"),
|
||||
Name = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: false, comment: "选项名称。"),
|
||||
ExtraPrice = table.Column<decimal>(type: "numeric(18,2)", precision: 18, scale: 2, nullable: false, comment: "附加价格。"),
|
||||
SortOrder = table.Column<int>(type: "integer", 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_product_spec_template_options", x => x.Id);
|
||||
},
|
||||
comment: "规格做法模板选项。");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "product_spec_template_products",
|
||||
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: "所属门店。"),
|
||||
TemplateId = table.Column<long>(type: "bigint", nullable: false, comment: "模板 ID。"),
|
||||
ProductId = table.Column<long>(type: "bigint", nullable: false, comment: "商品 ID。"),
|
||||
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_product_spec_template_products", x => x.Id);
|
||||
},
|
||||
comment: "规格做法模板与商品关联。");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "product_spec_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: "所属门店。"),
|
||||
Name = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: false, comment: "模板名称。"),
|
||||
TemplateType = table.Column<int>(type: "integer", nullable: false, comment: "模板类型。"),
|
||||
SelectionType = table.Column<int>(type: "integer", nullable: false, comment: "选择方式。"),
|
||||
IsRequired = table.Column<bool>(type: "boolean", nullable: false, comment: "是否必选。"),
|
||||
SortOrder = table.Column<int>(type: "integer", nullable: false, comment: "排序值。"),
|
||||
IsEnabled = table.Column<bool>(type: "boolean", 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_product_spec_templates", x => x.Id);
|
||||
},
|
||||
comment: "门店规格做法模板。");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_product_spec_template_options_TenantId_TemplateId_Name",
|
||||
table: "product_spec_template_options",
|
||||
columns: new[] { "TenantId", "TemplateId", "Name" },
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_product_spec_template_products_TenantId_StoreId_ProductId",
|
||||
table: "product_spec_template_products",
|
||||
columns: new[] { "TenantId", "StoreId", "ProductId" });
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_product_spec_template_products_TenantId_StoreId_TemplateId_~",
|
||||
table: "product_spec_template_products",
|
||||
columns: new[] { "TenantId", "StoreId", "TemplateId", "ProductId" },
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_product_spec_templates_TenantId_StoreId_Name",
|
||||
table: "product_spec_templates",
|
||||
columns: new[] { "TenantId", "StoreId", "Name" },
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_product_spec_templates_TenantId_StoreId_TemplateType_IsEnab~",
|
||||
table: "product_spec_templates",
|
||||
columns: new[] { "TenantId", "StoreId", "TemplateType", "IsEnabled" });
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "product_spec_template_options");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "product_spec_template_products");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "product_spec_templates");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4664,6 +4664,215 @@ namespace TakeoutSaaS.Infrastructure.Migrations
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TakeoutSaaS.Domain.Products.Entities.ProductSpecTemplate", 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<bool>("IsEnabled")
|
||||
.HasColumnType("boolean")
|
||||
.HasComment("是否启用。");
|
||||
|
||||
b.Property<bool>("IsRequired")
|
||||
.HasColumnType("boolean")
|
||||
.HasComment("是否必选。");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(64)
|
||||
.HasColumnType("character varying(64)")
|
||||
.HasComment("模板名称。");
|
||||
|
||||
b.Property<int>("SelectionType")
|
||||
.HasColumnType("integer")
|
||||
.HasComment("选择方式。");
|
||||
|
||||
b.Property<int>("SortOrder")
|
||||
.HasColumnType("integer")
|
||||
.HasComment("排序值。");
|
||||
|
||||
b.Property<long>("StoreId")
|
||||
.HasColumnType("bigint")
|
||||
.HasComment("所属门店。");
|
||||
|
||||
b.Property<int>("TemplateType")
|
||||
.HasColumnType("integer")
|
||||
.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", "StoreId", "Name")
|
||||
.IsUnique();
|
||||
|
||||
b.HasIndex("TenantId", "StoreId", "TemplateType", "IsEnabled");
|
||||
|
||||
b.ToTable("product_spec_templates", null, t =>
|
||||
{
|
||||
t.HasComment("门店规格做法模板。");
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TakeoutSaaS.Domain.Products.Entities.ProductSpecTemplateOption", 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<decimal>("ExtraPrice")
|
||||
.HasPrecision(18, 2)
|
||||
.HasColumnType("numeric(18,2)")
|
||||
.HasComment("附加价格。");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(64)
|
||||
.HasColumnType("character varying(64)")
|
||||
.HasComment("选项名称。");
|
||||
|
||||
b.Property<int>("SortOrder")
|
||||
.HasColumnType("integer")
|
||||
.HasComment("排序值。");
|
||||
|
||||
b.Property<long>("TemplateId")
|
||||
.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", "TemplateId", "Name")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("product_spec_template_options", null, t =>
|
||||
{
|
||||
t.HasComment("规格做法模板选项。");
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TakeoutSaaS.Domain.Products.Entities.ProductSpecTemplateProduct", 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<long>("ProductId")
|
||||
.HasColumnType("bigint")
|
||||
.HasComment("商品 ID。");
|
||||
|
||||
b.Property<long>("StoreId")
|
||||
.HasColumnType("bigint")
|
||||
.HasComment("所属门店。");
|
||||
|
||||
b.Property<long>("TemplateId")
|
||||
.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", "ProductId");
|
||||
|
||||
b.HasIndex("TenantId", "StoreId", "TemplateId", "ProductId")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("product_spec_template_products", null, t =>
|
||||
{
|
||||
t.HasComment("规格做法模板与商品关联。");
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TakeoutSaaS.Domain.Queues.Entities.QueueTicket", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
|
||||
Reference in New Issue
Block a user