feat: migrate snowflake ids and refresh migrations
This commit is contained in:
@@ -11,12 +11,12 @@ public sealed class Product : MultiTenantEntityBase
|
||||
/// <summary>
|
||||
/// 所属门店。
|
||||
/// </summary>
|
||||
public Guid StoreId { get; set; }
|
||||
public long StoreId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 所属分类。
|
||||
/// </summary>
|
||||
public Guid CategoryId { get; set; }
|
||||
public long CategoryId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 商品编码。
|
||||
|
||||
@@ -11,7 +11,7 @@ public sealed class ProductAddonGroup : MultiTenantEntityBase
|
||||
/// <summary>
|
||||
/// 所属商品。
|
||||
/// </summary>
|
||||
public Guid ProductId { get; set; }
|
||||
public long ProductId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 分组名称。
|
||||
|
||||
@@ -10,7 +10,7 @@ public sealed class ProductAddonOption : MultiTenantEntityBase
|
||||
/// <summary>
|
||||
/// 所属加料分组。
|
||||
/// </summary>
|
||||
public Guid AddonGroupId { get; set; }
|
||||
public long AddonGroupId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 选项名称。
|
||||
|
||||
@@ -11,7 +11,12 @@ public sealed class ProductAttributeGroup : MultiTenantEntityBase
|
||||
/// <summary>
|
||||
/// 关联门店,可为空表示所有门店共享。
|
||||
/// </summary>
|
||||
public Guid? StoreId { get; set; }
|
||||
public long? StoreId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 所属商品标识。
|
||||
/// </summary>
|
||||
public long ProductId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 分组名称,例如“辣度”“份量”。
|
||||
|
||||
@@ -10,7 +10,7 @@ public sealed class ProductAttributeOption : MultiTenantEntityBase
|
||||
/// <summary>
|
||||
/// 所属规格组。
|
||||
/// </summary>
|
||||
public Guid AttributeGroupId { get; set; }
|
||||
public long AttributeGroupId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 选项名称。
|
||||
|
||||
@@ -10,7 +10,7 @@ public sealed class ProductCategory : MultiTenantEntityBase
|
||||
/// <summary>
|
||||
/// 所属门店。
|
||||
/// </summary>
|
||||
public Guid StoreId { get; set; }
|
||||
public long StoreId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 分类名称。
|
||||
|
||||
@@ -11,7 +11,7 @@ public sealed class ProductMediaAsset : MultiTenantEntityBase
|
||||
/// <summary>
|
||||
/// 商品标识。
|
||||
/// </summary>
|
||||
public Guid ProductId { get; set; }
|
||||
public long ProductId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 媒体类型。
|
||||
|
||||
@@ -11,7 +11,7 @@ public sealed class ProductPricingRule : MultiTenantEntityBase
|
||||
/// <summary>
|
||||
/// 所属商品。
|
||||
/// </summary>
|
||||
public Guid ProductId { get; set; }
|
||||
public long ProductId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 策略类型。
|
||||
@@ -42,4 +42,9 @@ public sealed class ProductPricingRule : MultiTenantEntityBase
|
||||
/// 生效星期(JSON 数组)。
|
||||
/// </summary>
|
||||
public string? WeekdaysJson { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 排序值。
|
||||
/// </summary>
|
||||
public int SortOrder { get; set; } = 100;
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ public sealed class ProductSku : MultiTenantEntityBase
|
||||
/// <summary>
|
||||
/// 所属商品标识。
|
||||
/// </summary>
|
||||
public Guid ProductId { get; set; }
|
||||
public long ProductId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// SKU 编码。
|
||||
@@ -46,4 +46,9 @@ public sealed class ProductSku : MultiTenantEntityBase
|
||||
/// 规格属性 JSON(记录选项 ID)。
|
||||
/// </summary>
|
||||
public string AttributesJson { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 排序值。
|
||||
/// </summary>
|
||||
public int SortOrder { get; set; } = 100;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,103 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using TakeoutSaaS.Domain.Products.Entities;
|
||||
using TakeoutSaaS.Domain.Products.Enums;
|
||||
|
||||
namespace TakeoutSaaS.Domain.Products.Repositories;
|
||||
|
||||
/// <summary>
|
||||
/// 商品聚合仓储契约。
|
||||
/// </summary>
|
||||
public interface IProductRepository
|
||||
{
|
||||
/// <summary>
|
||||
/// 依据标识获取商品。
|
||||
/// </summary>
|
||||
Task<Product?> FindByIdAsync(long productId, long tenantId, CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
/// 按分类与状态筛选商品列表。
|
||||
/// </summary>
|
||||
Task<IReadOnlyList<Product>> SearchAsync(long tenantId, long? categoryId, ProductStatus? status, CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
/// 获取租户下的商品分类。
|
||||
/// </summary>
|
||||
Task<IReadOnlyList<ProductCategory>> GetCategoriesAsync(long tenantId, CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
/// 获取商品 SKU。
|
||||
/// </summary>
|
||||
Task<IReadOnlyList<ProductSku>> GetSkusAsync(long productId, long tenantId, CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
/// 获取商品加料组与选项。
|
||||
/// </summary>
|
||||
Task<IReadOnlyList<ProductAddonGroup>> GetAddonGroupsAsync(long productId, long tenantId, CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
/// 获取商品加料选项。
|
||||
/// </summary>
|
||||
Task<IReadOnlyList<ProductAddonOption>> GetAddonOptionsAsync(long productId, long tenantId, CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
/// 获取商品规格组与选项。
|
||||
/// </summary>
|
||||
Task<IReadOnlyList<ProductAttributeGroup>> GetAttributeGroupsAsync(long productId, long tenantId, CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
/// 获取商品规格选项。
|
||||
/// </summary>
|
||||
Task<IReadOnlyList<ProductAttributeOption>> GetAttributeOptionsAsync(long productId, long tenantId, CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
/// 获取商品媒资。
|
||||
/// </summary>
|
||||
Task<IReadOnlyList<ProductMediaAsset>> GetMediaAssetsAsync(long productId, long tenantId, CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
/// 获取商品定价规则。
|
||||
/// </summary>
|
||||
Task<IReadOnlyList<ProductPricingRule>> GetPricingRulesAsync(long productId, long tenantId, CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
/// 新增分类。
|
||||
/// </summary>
|
||||
Task AddCategoryAsync(ProductCategory category, CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
/// 新增商品。
|
||||
/// </summary>
|
||||
Task AddProductAsync(Product product, CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
/// 新增 SKU。
|
||||
/// </summary>
|
||||
Task AddSkusAsync(IEnumerable<ProductSku> skus, CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
/// 新增加料组与选项。
|
||||
/// </summary>
|
||||
Task AddAddonGroupsAsync(IEnumerable<ProductAddonGroup> groups, IEnumerable<ProductAddonOption> options, CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
/// 新增规格组与选项。
|
||||
/// </summary>
|
||||
Task AddAttributeGroupsAsync(IEnumerable<ProductAttributeGroup> groups, IEnumerable<ProductAttributeOption> options, CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
/// 新增媒资。
|
||||
/// </summary>
|
||||
Task AddMediaAssetsAsync(IEnumerable<ProductMediaAsset> assets, CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
/// 新增定价规则。
|
||||
/// </summary>
|
||||
Task AddPricingRulesAsync(IEnumerable<ProductPricingRule> rules, CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
/// 持久化变更。
|
||||
/// </summary>
|
||||
Task SaveChangesAsync(CancellationToken cancellationToken = default);
|
||||
}
|
||||
Reference in New Issue
Block a user