feat(product): complete combo and detail editing data model
All checks were successful
Build and Deploy TenantApi / build-and-deploy (push) Successful in 47s
All checks were successful
Build and Deploy TenantApi / build-and-deploy (push) Successful in 47s
This commit is contained in:
@@ -112,6 +112,21 @@ public sealed class SaveProductRequest
|
||||
/// </summary>
|
||||
public int Stock { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 排序权重。
|
||||
/// </summary>
|
||||
public int? SortWeight { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 库存预警值。
|
||||
/// </summary>
|
||||
public int? WarningStock { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 打包费。
|
||||
/// </summary>
|
||||
public decimal? PackingFee { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 标签。
|
||||
/// </summary>
|
||||
@@ -141,6 +156,140 @@ public sealed class SaveProductRequest
|
||||
/// 商品图片地址列表。
|
||||
/// </summary>
|
||||
public List<string> ImageUrls { get; set; } = [];
|
||||
|
||||
/// <summary>
|
||||
/// 关联规格模板 ID。
|
||||
/// </summary>
|
||||
public List<string>? SpecTemplateIds { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 关联加料组模板 ID。
|
||||
/// </summary>
|
||||
public List<string>? AddonGroupIds { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 关联标签 ID。
|
||||
/// </summary>
|
||||
public List<string>? LabelIds { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// SKU 列表。
|
||||
/// </summary>
|
||||
public List<SaveProductSkuRequest>? Skus { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 套餐分组。
|
||||
/// </summary>
|
||||
public List<SaveProductComboGroupRequest> ComboGroups { get; set; } = [];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 保存商品套餐分组请求。
|
||||
/// </summary>
|
||||
public sealed class SaveProductComboGroupRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// 分组名称。
|
||||
/// </summary>
|
||||
public string Name { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 最小选择数。
|
||||
/// </summary>
|
||||
public int MinSelect { get; set; } = 1;
|
||||
|
||||
/// <summary>
|
||||
/// 最大选择数。
|
||||
/// </summary>
|
||||
public int MaxSelect { get; set; } = 1;
|
||||
|
||||
/// <summary>
|
||||
/// 分组排序。
|
||||
/// </summary>
|
||||
public int SortOrder { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 分组内商品。
|
||||
/// </summary>
|
||||
public List<SaveProductComboGroupItemRequest> Items { get; set; } = [];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 保存商品套餐分组商品请求。
|
||||
/// </summary>
|
||||
public sealed class SaveProductComboGroupItemRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// 商品 ID。
|
||||
/// </summary>
|
||||
public string ProductId { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 数量。
|
||||
/// </summary>
|
||||
public int Quantity { get; set; } = 1;
|
||||
|
||||
/// <summary>
|
||||
/// 排序。
|
||||
/// </summary>
|
||||
public int SortOrder { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 保存商品 SKU 请求。
|
||||
/// </summary>
|
||||
public sealed class SaveProductSkuRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// SKU 编码(可选)。
|
||||
/// </summary>
|
||||
public string? SkuCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 售价。
|
||||
/// </summary>
|
||||
public decimal Price { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 划线价。
|
||||
/// </summary>
|
||||
public decimal? OriginalPrice { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 库存。
|
||||
/// </summary>
|
||||
public int Stock { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否启用。
|
||||
/// </summary>
|
||||
public bool IsEnabled { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// 排序。
|
||||
/// </summary>
|
||||
public int SortOrder { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 规格属性组合。
|
||||
/// </summary>
|
||||
public List<SaveProductSkuAttributeRequest> Attributes { get; set; } = [];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// SKU 规格属性请求。
|
||||
/// </summary>
|
||||
public sealed class SaveProductSkuAttributeRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// 模板 ID。
|
||||
/// </summary>
|
||||
public string TemplateId { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 选项 ID。
|
||||
/// </summary>
|
||||
public string OptionId { get; set; } = string.Empty;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -384,6 +533,26 @@ public class ProductListItemResponse
|
||||
/// </summary>
|
||||
public sealed class ProductDetailResponse : ProductListItemResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// 排序权重。
|
||||
/// </summary>
|
||||
public int SortWeight { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 库存预警值。
|
||||
/// </summary>
|
||||
public int? WarningStock { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 打包费。
|
||||
/// </summary>
|
||||
public decimal? PackingFee { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 套餐分组。
|
||||
/// </summary>
|
||||
public List<ProductComboGroupResponse> ComboGroups { get; set; } = [];
|
||||
|
||||
/// <summary>
|
||||
/// 商品图片列表。
|
||||
/// </summary>
|
||||
@@ -394,6 +563,31 @@ public sealed class ProductDetailResponse : ProductListItemResponse
|
||||
/// </summary>
|
||||
public string Description { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 关联规格模板 ID。
|
||||
/// </summary>
|
||||
public List<string> SpecTemplateIds { get; set; } = [];
|
||||
|
||||
/// <summary>
|
||||
/// 关联加料组模板 ID。
|
||||
/// </summary>
|
||||
public List<string> AddonGroupIds { get; set; } = [];
|
||||
|
||||
/// <summary>
|
||||
/// 关联标签 ID。
|
||||
/// </summary>
|
||||
public List<string> LabelIds { get; set; } = [];
|
||||
|
||||
/// <summary>
|
||||
/// SKU 列表。
|
||||
/// </summary>
|
||||
public List<ProductSkuResponse> Skus { get; set; } = [];
|
||||
|
||||
/// <summary>
|
||||
/// 定时上架时间。
|
||||
/// </summary>
|
||||
public string? TimedOnShelfAt { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否通知店长。
|
||||
/// </summary>
|
||||
@@ -420,6 +614,130 @@ public sealed class ProductDetailResponse : ProductListItemResponse
|
||||
public bool SyncToPlatform { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 套餐分组响应。
|
||||
/// </summary>
|
||||
public sealed class ProductComboGroupResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// 分组 ID。
|
||||
/// </summary>
|
||||
public string Id { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 分组名称。
|
||||
/// </summary>
|
||||
public string Name { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 最小选择数。
|
||||
/// </summary>
|
||||
public int MinSelect { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 最大选择数。
|
||||
/// </summary>
|
||||
public int MaxSelect { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 排序。
|
||||
/// </summary>
|
||||
public int SortOrder { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 分组商品列表。
|
||||
/// </summary>
|
||||
public List<ProductComboGroupItemResponse> Items { get; set; } = [];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 套餐分组商品响应。
|
||||
/// </summary>
|
||||
public sealed class ProductComboGroupItemResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// 商品 ID。
|
||||
/// </summary>
|
||||
public string ProductId { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 商品名称。
|
||||
/// </summary>
|
||||
public string ProductName { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 数量。
|
||||
/// </summary>
|
||||
public int Quantity { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 排序。
|
||||
/// </summary>
|
||||
public int SortOrder { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 商品 SKU 响应。
|
||||
/// </summary>
|
||||
public sealed class ProductSkuResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// SKU ID。
|
||||
/// </summary>
|
||||
public string Id { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// SKU 编码。
|
||||
/// </summary>
|
||||
public string SkuCode { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 售价。
|
||||
/// </summary>
|
||||
public decimal Price { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 划线价。
|
||||
/// </summary>
|
||||
public decimal? OriginalPrice { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 库存。
|
||||
/// </summary>
|
||||
public int Stock { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否启用。
|
||||
/// </summary>
|
||||
public bool IsEnabled { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 排序。
|
||||
/// </summary>
|
||||
public int SortOrder { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 规格属性。
|
||||
/// </summary>
|
||||
public List<ProductSkuAttributeResponse> Attributes { get; set; } = [];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// SKU 规格属性响应。
|
||||
/// </summary>
|
||||
public sealed class ProductSkuAttributeResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// 模板 ID。
|
||||
/// </summary>
|
||||
public string TemplateId { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 选项 ID。
|
||||
/// </summary>
|
||||
public string OptionId { get; set; } = string.Empty;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 批量操作响应。
|
||||
/// </summary>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -129,6 +129,21 @@ public sealed class CreateProductCommand : IRequest<ProductDto>
|
||||
/// </summary>
|
||||
public string? Description { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 排序权重。
|
||||
/// </summary>
|
||||
public int SortWeight { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 库存预警值。
|
||||
/// </summary>
|
||||
public int? WarningStock { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 打包费。
|
||||
/// </summary>
|
||||
public decimal? PackingFee { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 支持堂食。
|
||||
/// </summary>
|
||||
|
||||
@@ -134,6 +134,21 @@ public sealed record UpdateProductCommand : IRequest<ProductDto?>
|
||||
/// </summary>
|
||||
public string? Description { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 排序权重。
|
||||
/// </summary>
|
||||
public int SortWeight { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 库存预警值。
|
||||
/// </summary>
|
||||
public int? WarningStock { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 打包费。
|
||||
/// </summary>
|
||||
public decimal? PackingFee { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 支持堂食。
|
||||
/// </summary>
|
||||
|
||||
@@ -143,6 +143,21 @@ public sealed class ProductDto
|
||||
/// </summary>
|
||||
public string? Description { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 排序权重。
|
||||
/// </summary>
|
||||
public int SortWeight { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 库存预警值。
|
||||
/// </summary>
|
||||
public int? WarningStock { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 打包费。
|
||||
/// </summary>
|
||||
public decimal? PackingFee { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 支持堂食。
|
||||
/// </summary>
|
||||
|
||||
@@ -59,4 +59,9 @@ public sealed record ProductSkuDto
|
||||
/// 排序。
|
||||
/// </summary>
|
||||
public int SortOrder { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否启用。
|
||||
/// </summary>
|
||||
public bool IsEnabled { get; init; }
|
||||
}
|
||||
|
||||
@@ -46,6 +46,9 @@ public sealed class CreateProductCommandHandler(IProductRepository productReposi
|
||||
CoverImage = request.CoverImage?.Trim(),
|
||||
GalleryImages = request.GalleryImages?.Trim(),
|
||||
Description = request.Description?.Trim(),
|
||||
SortWeight = request.SortWeight,
|
||||
WarningStock = request.WarningStock,
|
||||
PackingFee = request.PackingFee,
|
||||
EnableDineIn = request.EnableDineIn,
|
||||
EnablePickup = request.EnablePickup,
|
||||
EnableDelivery = request.EnableDelivery,
|
||||
@@ -89,6 +92,9 @@ public sealed class CreateProductCommandHandler(IProductRepository productReposi
|
||||
CoverImage = product.CoverImage,
|
||||
GalleryImages = product.GalleryImages,
|
||||
Description = product.Description,
|
||||
SortWeight = product.SortWeight,
|
||||
WarningStock = product.WarningStock,
|
||||
PackingFee = product.PackingFee,
|
||||
EnableDineIn = product.EnableDineIn,
|
||||
EnablePickup = product.EnablePickup,
|
||||
EnableDelivery = product.EnableDelivery,
|
||||
|
||||
@@ -109,6 +109,9 @@ public sealed class SearchProductsQueryHandler(
|
||||
CoverImage = product.CoverImage,
|
||||
GalleryImages = product.GalleryImages,
|
||||
Description = product.Description,
|
||||
SortWeight = product.SortWeight,
|
||||
WarningStock = product.WarningStock,
|
||||
PackingFee = product.PackingFee,
|
||||
EnableDineIn = product.EnableDineIn,
|
||||
EnablePickup = product.EnablePickup,
|
||||
EnableDelivery = product.EnableDelivery,
|
||||
|
||||
@@ -57,6 +57,9 @@ public sealed class UpdateProductCommandHandler(
|
||||
existing.CoverImage = request.CoverImage?.Trim();
|
||||
existing.GalleryImages = request.GalleryImages?.Trim();
|
||||
existing.Description = request.Description?.Trim();
|
||||
existing.SortWeight = request.SortWeight;
|
||||
existing.WarningStock = request.WarningStock;
|
||||
existing.PackingFee = request.PackingFee;
|
||||
existing.EnableDineIn = request.EnableDineIn;
|
||||
existing.EnablePickup = request.EnablePickup;
|
||||
existing.EnableDelivery = request.EnableDelivery;
|
||||
@@ -99,6 +102,9 @@ public sealed class UpdateProductCommandHandler(
|
||||
CoverImage = product.CoverImage,
|
||||
GalleryImages = product.GalleryImages,
|
||||
Description = product.Description,
|
||||
SortWeight = product.SortWeight,
|
||||
WarningStock = product.WarningStock,
|
||||
PackingFee = product.PackingFee,
|
||||
EnableDineIn = product.EnableDineIn,
|
||||
EnablePickup = product.EnablePickup,
|
||||
EnableDelivery = product.EnableDelivery,
|
||||
|
||||
@@ -41,6 +41,9 @@ public static class ProductMapping
|
||||
CoverImage = product.CoverImage,
|
||||
GalleryImages = product.GalleryImages,
|
||||
Description = product.Description,
|
||||
SortWeight = product.SortWeight,
|
||||
WarningStock = product.WarningStock,
|
||||
PackingFee = product.PackingFee,
|
||||
EnableDineIn = product.EnableDineIn,
|
||||
EnablePickup = product.EnablePickup,
|
||||
EnableDelivery = product.EnableDelivery,
|
||||
@@ -62,7 +65,8 @@ public static class ProductMapping
|
||||
StockQuantity = sku.StockQuantity,
|
||||
Weight = sku.Weight,
|
||||
AttributesJson = sku.AttributesJson,
|
||||
SortOrder = sku.SortOrder
|
||||
SortOrder = sku.SortOrder,
|
||||
IsEnabled = sku.IsEnabled
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -128,6 +128,21 @@ public sealed class Product : MultiTenantEntityBase
|
||||
/// </summary>
|
||||
public string? Description { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 排序权重,越大越靠前。
|
||||
/// </summary>
|
||||
public int SortWeight { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 库存预警值。
|
||||
/// </summary>
|
||||
public int? WarningStock { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 打包费(元/份)。
|
||||
/// </summary>
|
||||
public decimal? PackingFee { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 支持堂食。
|
||||
/// </summary>
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
using TakeoutSaaS.Shared.Abstractions.Entities;
|
||||
|
||||
namespace TakeoutSaaS.Domain.Products.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// 套餐分组。
|
||||
/// </summary>
|
||||
public sealed class ProductComboGroup : MultiTenantEntityBase
|
||||
{
|
||||
/// <summary>
|
||||
/// 套餐商品 ID。
|
||||
/// </summary>
|
||||
public long ProductId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 分组名称。
|
||||
/// </summary>
|
||||
public string Name { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 最小选择数。
|
||||
/// </summary>
|
||||
public int MinSelect { get; set; } = 1;
|
||||
|
||||
/// <summary>
|
||||
/// 最大选择数。
|
||||
/// </summary>
|
||||
public int MaxSelect { get; set; } = 1;
|
||||
|
||||
/// <summary>
|
||||
/// 排序值。
|
||||
/// </summary>
|
||||
public int SortOrder { get; set; } = 100;
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
using TakeoutSaaS.Shared.Abstractions.Entities;
|
||||
|
||||
namespace TakeoutSaaS.Domain.Products.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// 套餐分组内商品。
|
||||
/// </summary>
|
||||
public sealed class ProductComboGroupItem : MultiTenantEntityBase
|
||||
{
|
||||
/// <summary>
|
||||
/// 所属套餐分组 ID。
|
||||
/// </summary>
|
||||
public long ComboGroupId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 商品 ID。
|
||||
/// </summary>
|
||||
public long ProductId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 数量。
|
||||
/// </summary>
|
||||
public int Quantity { get; set; } = 1;
|
||||
|
||||
/// <summary>
|
||||
/// 排序值。
|
||||
/// </summary>
|
||||
public int SortOrder { get; set; } = 100;
|
||||
}
|
||||
@@ -51,4 +51,9 @@ public sealed class ProductSku : MultiTenantEntityBase
|
||||
/// 排序值。
|
||||
/// </summary>
|
||||
public int SortOrder { get; set; } = 100;
|
||||
|
||||
/// <summary>
|
||||
/// 是否启用。
|
||||
/// </summary>
|
||||
public bool IsEnabled { get; set; } = true;
|
||||
}
|
||||
|
||||
@@ -153,6 +153,26 @@ public interface IProductRepository
|
||||
/// </summary>
|
||||
Task<IReadOnlyList<ProductSku>> GetSkusByProductIdsAsync(IReadOnlyCollection<long> productIds, long tenantId, CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
/// 获取商品套餐分组。
|
||||
/// </summary>
|
||||
Task<IReadOnlyList<ProductComboGroup>> GetComboGroupsAsync(long productId, long tenantId, CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
/// 批量获取商品套餐分组。
|
||||
/// </summary>
|
||||
Task<IReadOnlyList<ProductComboGroup>> GetComboGroupsByProductIdsAsync(IReadOnlyCollection<long> productIds, long tenantId, CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
/// 获取套餐分组内商品。
|
||||
/// </summary>
|
||||
Task<IReadOnlyList<ProductComboGroupItem>> GetComboGroupItemsAsync(long productId, long tenantId, CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
/// 批量获取套餐分组内商品。
|
||||
/// </summary>
|
||||
Task<IReadOnlyList<ProductComboGroupItem>> GetComboGroupItemsByGroupIdsAsync(IReadOnlyCollection<long> comboGroupIds, long tenantId, CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
/// 获取商品加料组与选项。
|
||||
/// </summary>
|
||||
@@ -291,6 +311,15 @@ public interface IProductRepository
|
||||
/// <returns>异步任务。</returns>
|
||||
Task AddSkusAsync(IEnumerable<ProductSku> skus, CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
/// 新增套餐分组与分组商品。
|
||||
/// </summary>
|
||||
/// <param name="groups">套餐分组集合。</param>
|
||||
/// <param name="items">分组商品集合。</param>
|
||||
/// <param name="cancellationToken">取消标记。</param>
|
||||
/// <returns>异步任务。</returns>
|
||||
Task AddComboGroupsAsync(IEnumerable<ProductComboGroup> groups, IEnumerable<ProductComboGroupItem> items, CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
/// 新增加料组与选项。
|
||||
/// </summary>
|
||||
@@ -405,6 +434,15 @@ public interface IProductRepository
|
||||
/// <returns>异步任务。</returns>
|
||||
Task RemoveSkusAsync(long productId, long tenantId, CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
/// 删除商品下的套餐分组及分组商品。
|
||||
/// </summary>
|
||||
/// <param name="productId">商品 ID。</param>
|
||||
/// <param name="tenantId">租户 ID。</param>
|
||||
/// <param name="cancellationToken">取消标记。</param>
|
||||
/// <returns>异步任务。</returns>
|
||||
Task RemoveComboGroupsAsync(long productId, long tenantId, CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
/// 删除模板下的规格做法选项。
|
||||
/// </summary>
|
||||
|
||||
@@ -233,6 +233,14 @@ public sealed class TakeoutAppDbContext(
|
||||
/// </summary>
|
||||
public DbSet<ProductSku> ProductSkus => Set<ProductSku>();
|
||||
/// <summary>
|
||||
/// 套餐分组。
|
||||
/// </summary>
|
||||
public DbSet<ProductComboGroup> ProductComboGroups => Set<ProductComboGroup>();
|
||||
/// <summary>
|
||||
/// 套餐分组商品。
|
||||
/// </summary>
|
||||
public DbSet<ProductComboGroupItem> ProductComboGroupItems => Set<ProductComboGroupItem>();
|
||||
/// <summary>
|
||||
/// 加料分组。
|
||||
/// </summary>
|
||||
public DbSet<ProductAddonGroup> ProductAddonGroups => Set<ProductAddonGroup>();
|
||||
@@ -477,6 +485,8 @@ public sealed class TakeoutAppDbContext(
|
||||
ConfigureProductSchedule(modelBuilder.Entity<ProductSchedule>());
|
||||
ConfigureProductScheduleProduct(modelBuilder.Entity<ProductScheduleProduct>());
|
||||
ConfigureProductSku(modelBuilder.Entity<ProductSku>());
|
||||
ConfigureProductComboGroup(modelBuilder.Entity<ProductComboGroup>());
|
||||
ConfigureProductComboGroupItem(modelBuilder.Entity<ProductComboGroupItem>());
|
||||
ConfigureProductAddonGroup(modelBuilder.Entity<ProductAddonGroup>());
|
||||
ConfigureProductAddonOption(modelBuilder.Entity<ProductAddonOption>());
|
||||
ConfigureProductPricingRule(modelBuilder.Entity<ProductPricingRule>());
|
||||
@@ -747,6 +757,8 @@ public sealed class TakeoutAppDbContext(
|
||||
builder.Property(x => x.CoverImage).HasMaxLength(256);
|
||||
builder.Property(x => x.GalleryImages).HasMaxLength(1024);
|
||||
builder.Property(x => x.Description).HasColumnType("text");
|
||||
builder.Property(x => x.SortWeight).HasDefaultValue(0);
|
||||
builder.Property(x => x.PackingFee).HasPrecision(18, 2);
|
||||
builder.HasIndex(x => new { x.TenantId, x.StoreId });
|
||||
builder.HasIndex(x => new { x.TenantId, x.SpuCode }).IsUnique();
|
||||
}
|
||||
@@ -1308,9 +1320,35 @@ public sealed class TakeoutAppDbContext(
|
||||
builder.Property(x => x.OriginalPrice).HasPrecision(18, 2);
|
||||
builder.Property(x => x.Weight).HasPrecision(10, 3);
|
||||
builder.Property(x => x.AttributesJson).HasColumnType("text");
|
||||
builder.Property(x => x.IsEnabled).HasDefaultValue(true);
|
||||
builder.HasIndex(x => new { x.TenantId, x.SkuCode }).IsUnique();
|
||||
}
|
||||
|
||||
private static void ConfigureProductComboGroup(EntityTypeBuilder<ProductComboGroup> builder)
|
||||
{
|
||||
builder.ToTable("product_combo_groups");
|
||||
builder.HasKey(x => x.Id);
|
||||
builder.Property(x => x.ProductId).IsRequired();
|
||||
builder.Property(x => x.Name).HasMaxLength(64).IsRequired();
|
||||
builder.Property(x => x.MinSelect).IsRequired();
|
||||
builder.Property(x => x.MaxSelect).IsRequired();
|
||||
builder.Property(x => x.SortOrder).IsRequired();
|
||||
builder.HasIndex(x => new { x.TenantId, x.ProductId, x.SortOrder });
|
||||
builder.HasIndex(x => new { x.TenantId, x.ProductId, x.Name });
|
||||
}
|
||||
|
||||
private static void ConfigureProductComboGroupItem(EntityTypeBuilder<ProductComboGroupItem> builder)
|
||||
{
|
||||
builder.ToTable("product_combo_group_items");
|
||||
builder.HasKey(x => x.Id);
|
||||
builder.Property(x => x.ComboGroupId).IsRequired();
|
||||
builder.Property(x => x.ProductId).IsRequired();
|
||||
builder.Property(x => x.Quantity).IsRequired();
|
||||
builder.Property(x => x.SortOrder).IsRequired();
|
||||
builder.HasIndex(x => new { x.TenantId, x.ComboGroupId, x.SortOrder });
|
||||
builder.HasIndex(x => new { x.TenantId, x.ComboGroupId, x.ProductId }).IsUnique();
|
||||
}
|
||||
|
||||
private static void ConfigureProductAddonGroup(EntityTypeBuilder<ProductAddonGroup> builder)
|
||||
{
|
||||
builder.ToTable("product_addon_groups");
|
||||
|
||||
@@ -493,6 +493,77 @@ public sealed class EfProductRepository(TakeoutAppDbContext context) : IProductR
|
||||
return skus;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<IReadOnlyList<ProductComboGroup>> GetComboGroupsAsync(long productId, long tenantId, CancellationToken cancellationToken = default)
|
||||
{
|
||||
var groups = await context.ProductComboGroups
|
||||
.AsNoTracking()
|
||||
.Where(x => x.TenantId == tenantId && x.ProductId == productId)
|
||||
.OrderBy(x => x.SortOrder)
|
||||
.ThenBy(x => x.Id)
|
||||
.ToListAsync(cancellationToken);
|
||||
|
||||
return groups;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<IReadOnlyList<ProductComboGroup>> GetComboGroupsByProductIdsAsync(IReadOnlyCollection<long> productIds, long tenantId, CancellationToken cancellationToken = default)
|
||||
{
|
||||
if (productIds.Count == 0)
|
||||
{
|
||||
return Array.Empty<ProductComboGroup>();
|
||||
}
|
||||
|
||||
var groups = await context.ProductComboGroups
|
||||
.AsNoTracking()
|
||||
.Where(x => x.TenantId == tenantId && productIds.Contains(x.ProductId))
|
||||
.OrderBy(x => x.SortOrder)
|
||||
.ThenBy(x => x.Id)
|
||||
.ToListAsync(cancellationToken);
|
||||
return groups;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<IReadOnlyList<ProductComboGroupItem>> GetComboGroupItemsAsync(long productId, long tenantId, CancellationToken cancellationToken = default)
|
||||
{
|
||||
var groupIds = await context.ProductComboGroups
|
||||
.AsNoTracking()
|
||||
.Where(x => x.TenantId == tenantId && x.ProductId == productId)
|
||||
.Select(x => x.Id)
|
||||
.ToListAsync(cancellationToken);
|
||||
|
||||
if (groupIds.Count == 0)
|
||||
{
|
||||
return Array.Empty<ProductComboGroupItem>();
|
||||
}
|
||||
|
||||
var items = await context.ProductComboGroupItems
|
||||
.AsNoTracking()
|
||||
.Where(x => x.TenantId == tenantId && groupIds.Contains(x.ComboGroupId))
|
||||
.OrderBy(x => x.SortOrder)
|
||||
.ThenBy(x => x.Id)
|
||||
.ToListAsync(cancellationToken);
|
||||
|
||||
return items;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<IReadOnlyList<ProductComboGroupItem>> GetComboGroupItemsByGroupIdsAsync(IReadOnlyCollection<long> comboGroupIds, long tenantId, CancellationToken cancellationToken = default)
|
||||
{
|
||||
if (comboGroupIds.Count == 0)
|
||||
{
|
||||
return Array.Empty<ProductComboGroupItem>();
|
||||
}
|
||||
|
||||
var items = await context.ProductComboGroupItems
|
||||
.AsNoTracking()
|
||||
.Where(x => x.TenantId == tenantId && comboGroupIds.Contains(x.ComboGroupId))
|
||||
.OrderBy(x => x.SortOrder)
|
||||
.ThenBy(x => x.Id)
|
||||
.ToListAsync(cancellationToken);
|
||||
return items;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<IReadOnlyList<ProductAddonGroup>> GetAddonGroupsAsync(long productId, long tenantId, CancellationToken cancellationToken = default)
|
||||
{
|
||||
@@ -731,6 +802,14 @@ public sealed class EfProductRepository(TakeoutAppDbContext context) : IProductR
|
||||
return context.ProductSkus.AddRangeAsync(skus, cancellationToken);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public Task AddComboGroupsAsync(IEnumerable<ProductComboGroup> groups, IEnumerable<ProductComboGroupItem> items, CancellationToken cancellationToken = default)
|
||||
{
|
||||
var addGroupsTask = context.ProductComboGroups.AddRangeAsync(groups, cancellationToken);
|
||||
var addItemsTask = context.ProductComboGroupItems.AddRangeAsync(items, cancellationToken);
|
||||
return Task.WhenAll(addGroupsTask, addItemsTask);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public Task AddAddonGroupsAsync(IEnumerable<ProductAddonGroup> groups, IEnumerable<ProductAddonOption> options, CancellationToken cancellationToken = default)
|
||||
{
|
||||
@@ -779,6 +858,7 @@ public sealed class EfProductRepository(TakeoutAppDbContext context) : IProductR
|
||||
await RemoveMediaAssetsAsync(productId, tenantId, cancellationToken);
|
||||
await RemoveAttributeGroupsAsync(productId, tenantId, cancellationToken);
|
||||
await RemoveAddonGroupsAsync(productId, tenantId, cancellationToken);
|
||||
await RemoveComboGroupsAsync(productId, tenantId, cancellationToken);
|
||||
await RemoveSkusAsync(productId, tenantId, cancellationToken);
|
||||
|
||||
var existing = await context.Products
|
||||
@@ -902,6 +982,38 @@ public sealed class EfProductRepository(TakeoutAppDbContext context) : IProductR
|
||||
context.ProductSkus.RemoveRange(skus);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task RemoveComboGroupsAsync(long productId, long tenantId, CancellationToken cancellationToken = default)
|
||||
{
|
||||
var groupIds = await context.ProductComboGroups
|
||||
.Where(x => x.TenantId == tenantId && x.ProductId == productId)
|
||||
.Select(x => x.Id)
|
||||
.ToListAsync(cancellationToken);
|
||||
|
||||
if (groupIds.Count == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var items = await context.ProductComboGroupItems
|
||||
.Where(x => x.TenantId == tenantId && groupIds.Contains(x.ComboGroupId))
|
||||
.ToListAsync(cancellationToken);
|
||||
|
||||
if (items.Count > 0)
|
||||
{
|
||||
context.ProductComboGroupItems.RemoveRange(items);
|
||||
}
|
||||
|
||||
var groups = await context.ProductComboGroups
|
||||
.Where(x => groupIds.Contains(x.Id))
|
||||
.ToListAsync(cancellationToken);
|
||||
|
||||
if (groups.Count > 0)
|
||||
{
|
||||
context.ProductComboGroups.RemoveRange(groups);
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task RemoveSpecTemplateOptionsAsync(long templateId, long tenantId, CancellationToken cancellationToken = default)
|
||||
{
|
||||
|
||||
8559
src/Infrastructure/TakeoutSaaS.Infrastructure/Migrations/20260222000604_AddProductComboGroups.Designer.cs
generated
Normal file
8559
src/Infrastructure/TakeoutSaaS.Infrastructure/Migrations/20260222000604_AddProductComboGroups.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,96 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace TakeoutSaaS.Infrastructure.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddProductComboGroups : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "product_combo_group_items",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<long>(type: "bigint", nullable: false, comment: "实体唯一标识。")
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
ComboGroupId = table.Column<long>(type: "bigint", nullable: false, comment: "所属套餐分组 ID。"),
|
||||
ProductId = table.Column<long>(type: "bigint", nullable: false, comment: "商品 ID。"),
|
||||
Quantity = table.Column<int>(type: "integer", 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_combo_group_items", x => x.Id);
|
||||
},
|
||||
comment: "套餐分组内商品。");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "product_combo_groups",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<long>(type: "bigint", nullable: false, comment: "实体唯一标识。")
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
ProductId = table.Column<long>(type: "bigint", nullable: false, comment: "套餐商品 ID。"),
|
||||
Name = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: false, comment: "分组名称。"),
|
||||
MinSelect = table.Column<int>(type: "integer", nullable: false, comment: "最小选择数。"),
|
||||
MaxSelect = table.Column<int>(type: "integer", 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_combo_groups", x => x.Id);
|
||||
},
|
||||
comment: "套餐分组。");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_product_combo_group_items_TenantId_ComboGroupId_ProductId",
|
||||
table: "product_combo_group_items",
|
||||
columns: new[] { "TenantId", "ComboGroupId", "ProductId" },
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_product_combo_group_items_TenantId_ComboGroupId_SortOrder",
|
||||
table: "product_combo_group_items",
|
||||
columns: new[] { "TenantId", "ComboGroupId", "SortOrder" });
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_product_combo_groups_TenantId_ProductId_Name",
|
||||
table: "product_combo_groups",
|
||||
columns: new[] { "TenantId", "ProductId", "Name" });
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_product_combo_groups_TenantId_ProductId_SortOrder",
|
||||
table: "product_combo_groups",
|
||||
columns: new[] { "TenantId", "ProductId", "SortOrder" });
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "product_combo_group_items");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "product_combo_groups");
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,66 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace TakeoutSaaS.Infrastructure.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddProductDetailRichFields : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<decimal>(
|
||||
name: "PackingFee",
|
||||
table: "products",
|
||||
type: "numeric(18,2)",
|
||||
precision: 18,
|
||||
scale: 2,
|
||||
nullable: true,
|
||||
comment: "打包费(元/份)。");
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "SortWeight",
|
||||
table: "products",
|
||||
type: "integer",
|
||||
nullable: false,
|
||||
defaultValue: 0,
|
||||
comment: "排序权重,越大越靠前。");
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "WarningStock",
|
||||
table: "products",
|
||||
type: "integer",
|
||||
nullable: true,
|
||||
comment: "库存预警值。");
|
||||
|
||||
migrationBuilder.AddColumn<bool>(
|
||||
name: "IsEnabled",
|
||||
table: "product_skus",
|
||||
type: "boolean",
|
||||
nullable: false,
|
||||
defaultValue: true,
|
||||
comment: "是否启用。");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "PackingFee",
|
||||
table: "products");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "SortWeight",
|
||||
table: "products");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "WarningStock",
|
||||
table: "products");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "IsEnabled",
|
||||
table: "product_skus");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4007,6 +4007,11 @@ namespace TakeoutSaaS.Infrastructure.Migrations
|
||||
.HasColumnType("numeric(18,2)")
|
||||
.HasComment("原价。");
|
||||
|
||||
b.Property<decimal?>("PackingFee")
|
||||
.HasPrecision(18, 2)
|
||||
.HasColumnType("numeric(18,2)")
|
||||
.HasComment("打包费(元/份)。");
|
||||
|
||||
b.Property<decimal>("Price")
|
||||
.HasPrecision(18, 2)
|
||||
.HasColumnType("numeric(18,2)")
|
||||
@@ -4035,6 +4040,12 @@ namespace TakeoutSaaS.Infrastructure.Migrations
|
||||
.HasColumnType("character varying(256)")
|
||||
.HasComment("沽清原因。");
|
||||
|
||||
b.Property<int>("SortWeight")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasDefaultValue(0)
|
||||
.HasComment("排序权重,越大越靠前。");
|
||||
|
||||
b.Property<string>("SpuCode")
|
||||
.IsRequired()
|
||||
.HasMaxLength(32)
|
||||
@@ -4091,6 +4102,10 @@ namespace TakeoutSaaS.Infrastructure.Migrations
|
||||
.HasColumnType("bigint")
|
||||
.HasComment("最后更新人用户标识,匿名或系统操作时为 null。");
|
||||
|
||||
b.Property<int?>("WarningStock")
|
||||
.HasColumnType("integer")
|
||||
.HasComment("库存预警值。");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("TenantId", "SpuCode")
|
||||
@@ -4475,6 +4490,143 @@ namespace TakeoutSaaS.Infrastructure.Migrations
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TakeoutSaaS.Domain.Products.Entities.ProductComboGroup", 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>("MaxSelect")
|
||||
.HasColumnType("integer")
|
||||
.HasComment("最大选择数。");
|
||||
|
||||
b.Property<int>("MinSelect")
|
||||
.HasColumnType("integer")
|
||||
.HasComment("最小选择数。");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(64)
|
||||
.HasColumnType("character varying(64)")
|
||||
.HasComment("分组名称。");
|
||||
|
||||
b.Property<long>("ProductId")
|
||||
.HasColumnType("bigint")
|
||||
.HasComment("套餐商品 ID。");
|
||||
|
||||
b.Property<int>("SortOrder")
|
||||
.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", "ProductId", "Name");
|
||||
|
||||
b.HasIndex("TenantId", "ProductId", "SortOrder");
|
||||
|
||||
b.ToTable("product_combo_groups", null, t =>
|
||||
{
|
||||
t.HasComment("套餐分组。");
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TakeoutSaaS.Domain.Products.Entities.ProductComboGroupItem", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint")
|
||||
.HasComment("实体唯一标识。");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
||||
|
||||
b.Property<long>("ComboGroupId")
|
||||
.HasColumnType("bigint")
|
||||
.HasComment("所属套餐分组 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<int>("Quantity")
|
||||
.HasColumnType("integer")
|
||||
.HasComment("数量。");
|
||||
|
||||
b.Property<int>("SortOrder")
|
||||
.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", "ComboGroupId", "ProductId")
|
||||
.IsUnique();
|
||||
|
||||
b.HasIndex("TenantId", "ComboGroupId", "SortOrder");
|
||||
|
||||
b.ToTable("product_combo_group_items", null, t =>
|
||||
{
|
||||
t.HasComment("套餐分组内商品。");
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TakeoutSaaS.Domain.Products.Entities.ProductLabel", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
@@ -4933,6 +5085,12 @@ namespace TakeoutSaaS.Infrastructure.Migrations
|
||||
.HasColumnType("bigint")
|
||||
.HasComment("删除人用户标识(软删除),未删除时为 null。");
|
||||
|
||||
b.Property<bool>("IsEnabled")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("boolean")
|
||||
.HasDefaultValue(true)
|
||||
.HasComment("是否启用。");
|
||||
|
||||
b.Property<decimal?>("OriginalPrice")
|
||||
.HasPrecision(18, 2)
|
||||
.HasColumnType("numeric(18,2)")
|
||||
|
||||
Reference in New Issue
Block a user