Commit f1a00bac authored by gdlcf88's avatar gdlcf88

Make storeId required. close #7

parent 89055787
...@@ -10,7 +10,7 @@ namespace EasyAbp.EShop.Orders.Orders ...@@ -10,7 +10,7 @@ namespace EasyAbp.EShop.Orders.Orders
{ {
public virtual Guid? TenantId { get; protected set; } public virtual Guid? TenantId { get; protected set; }
public virtual Guid? StoreId { get; protected set; } public virtual Guid StoreId { get; protected set; }
public virtual Guid CustomerUserId { get; protected set; } public virtual Guid CustomerUserId { get; protected set; }
......
...@@ -10,7 +10,7 @@ namespace EasyAbp.EShop.Payment.PaymentRecordOrders ...@@ -10,7 +10,7 @@ namespace EasyAbp.EShop.Payment.PaymentRecordOrders
{ {
public virtual Guid? TenantId { get; protected set; } public virtual Guid? TenantId { get; protected set; }
public virtual Guid? StoreId { get; protected set; } public virtual Guid StoreId { get; protected set; }
public virtual Guid OrderId { get; protected set; } public virtual Guid OrderId { get; protected set; }
......
...@@ -10,7 +10,7 @@ namespace EasyAbp.EShop.Payment.RefundRecords ...@@ -10,7 +10,7 @@ namespace EasyAbp.EShop.Payment.RefundRecords
{ {
public virtual Guid? TenantId { get; protected set; } public virtual Guid? TenantId { get; protected set; }
public virtual Guid? StoreId { get; protected set; } public virtual Guid StoreId { get; protected set; }
public virtual Guid OrderId { get; protected set; } public virtual Guid OrderId { get; protected set; }
......
...@@ -7,7 +7,7 @@ namespace EasyAbp.EShop.Products.ProductCategories.Dtos ...@@ -7,7 +7,7 @@ namespace EasyAbp.EShop.Products.ProductCategories.Dtos
public class CreateUpdateProductCategoryDto public class CreateUpdateProductCategoryDto
{ {
[DisplayName("ProductCategoryStoreId")] [DisplayName("ProductCategoryStoreId")]
public Guid? StoreId { get; set; } public Guid StoreId { get; set; }
[Required] [Required]
[DisplayName("ProductCategoryCategoryId")] [DisplayName("ProductCategoryCategoryId")]
......
...@@ -5,7 +5,7 @@ namespace EasyAbp.EShop.Products.ProductCategories.Dtos ...@@ -5,7 +5,7 @@ namespace EasyAbp.EShop.Products.ProductCategories.Dtos
{ {
public class ProductCategoryDto : AuditedEntityDto<Guid> public class ProductCategoryDto : AuditedEntityDto<Guid>
{ {
public Guid? StoreId { get; set; } public Guid StoreId { get; set; }
public Guid CategoryId { get; set; } public Guid CategoryId { get; set; }
......
...@@ -9,7 +9,7 @@ namespace EasyAbp.EShop.Products.Products.Dtos ...@@ -9,7 +9,7 @@ namespace EasyAbp.EShop.Products.Products.Dtos
public class CreateUpdateProductDto : IValidatableObject public class CreateUpdateProductDto : IValidatableObject
{ {
[DisplayName("ProductStoreId")] [DisplayName("ProductStoreId")]
public Guid? StoreId { get; set; } public Guid StoreId { get; set; }
[Required] [Required]
[DisplayName("ProductProductTypeId")] [DisplayName("ProductProductTypeId")]
......
...@@ -5,7 +5,7 @@ namespace EasyAbp.EShop.Products.Products.Dtos ...@@ -5,7 +5,7 @@ namespace EasyAbp.EShop.Products.Products.Dtos
{ {
public class GetProductListDto : PagedAndSortedResultRequestDto public class GetProductListDto : PagedAndSortedResultRequestDto
{ {
public Guid? StoreId { get; set; } public Guid StoreId { get; set; }
public Guid? CategoryId { get; set; } public Guid? CategoryId { get; set; }
} }
......
...@@ -6,7 +6,7 @@ namespace EasyAbp.EShop.Products.Products.Dtos ...@@ -6,7 +6,7 @@ namespace EasyAbp.EShop.Products.Products.Dtos
{ {
public class ProductDto : FullAuditedEntityDto<Guid> public class ProductDto : FullAuditedEntityDto<Guid>
{ {
public Guid? StoreId { get; set; } public Guid StoreId { get; set; }
public Guid ProductTypeId { get; set; } public Guid ProductTypeId { get; set; }
......
...@@ -43,10 +43,8 @@ namespace EasyAbp.EShop.Products.Products ...@@ -43,10 +43,8 @@ namespace EasyAbp.EShop.Products.Products
query = query.Where(p => productIds.Contains(p.Id)); query = query.Where(p => productIds.Contains(p.Id));
} }
else if (input.StoreId.HasValue)
{
query = query.Where(p => p.StoreId == input.StoreId); query = query.Where(p => p.StoreId == input.StoreId);
}
return query; return query;
} }
...@@ -141,7 +139,7 @@ namespace EasyAbp.EShop.Products.Products ...@@ -141,7 +139,7 @@ namespace EasyAbp.EShop.Products.Products
return dto; return dto;
} }
protected virtual async Task UpdateProductCategoriesAsync(Guid productId, Guid? storeId, IEnumerable<Guid> categoryIds) protected virtual async Task UpdateProductCategoriesAsync(Guid productId, Guid storeId, IEnumerable<Guid> categoryIds)
{ {
await _productCategoryRepository.DeleteAsync(x => x.ProductId.Equals(productId)); await _productCategoryRepository.DeleteAsync(x => x.ProductId.Equals(productId));
......
...@@ -8,8 +8,8 @@ namespace EasyAbp.EShop.Products.ProductCategories ...@@ -8,8 +8,8 @@ namespace EasyAbp.EShop.Products.ProductCategories
{ {
public interface IProductCategoryRepository : IRepository<ProductCategory, Guid> public interface IProductCategoryRepository : IRepository<ProductCategory, Guid>
{ {
Task<List<ProductCategory>> GetListByCategoryId(Guid categoryId, Guid? storeId, CancellationToken cancellationToken = default); Task<List<ProductCategory>> GetListByCategoryId(Guid categoryId, Guid storeId, CancellationToken cancellationToken = default);
Task<List<ProductCategory>> GetListByProductId(Guid productId, Guid? storeId, CancellationToken cancellationToken = default); Task<List<ProductCategory>> GetListByProductId(Guid productId, Guid storeId, CancellationToken cancellationToken = default);
} }
} }
\ No newline at end of file
...@@ -9,7 +9,7 @@ namespace EasyAbp.EShop.Products.ProductCategories ...@@ -9,7 +9,7 @@ namespace EasyAbp.EShop.Products.ProductCategories
{ {
public virtual Guid? TenantId { get; protected set; } public virtual Guid? TenantId { get; protected set; }
public virtual Guid? StoreId { get; protected set; } public virtual Guid StoreId { get; protected set; }
public virtual Guid CategoryId { get; protected set; } public virtual Guid CategoryId { get; protected set; }
...@@ -24,7 +24,7 @@ namespace EasyAbp.EShop.Products.ProductCategories ...@@ -24,7 +24,7 @@ namespace EasyAbp.EShop.Products.ProductCategories
public ProductCategory( public ProductCategory(
Guid id, Guid id,
Guid? tenantId, Guid? tenantId,
Guid? storeId, Guid storeId,
Guid categoryId, Guid categoryId,
Guid productId, Guid productId,
int displayOrder = 0 int displayOrder = 0
......
...@@ -11,7 +11,7 @@ namespace EasyAbp.EShop.Products.Products ...@@ -11,7 +11,7 @@ namespace EasyAbp.EShop.Products.Products
{ {
public virtual Guid? TenantId { get; protected set; } public virtual Guid? TenantId { get; protected set; }
public virtual Guid? StoreId { get; protected set; } public virtual Guid StoreId { get; protected set; }
public virtual Guid ProductTypeId { get; protected set; } public virtual Guid ProductTypeId { get; protected set; }
...@@ -42,7 +42,7 @@ namespace EasyAbp.EShop.Products.Products ...@@ -42,7 +42,7 @@ namespace EasyAbp.EShop.Products.Products
public Product( public Product(
Guid id, Guid id,
Guid? tenantId, Guid? tenantId,
Guid? storeId, Guid storeId,
Guid productTypeId, Guid productTypeId,
string displayName, string displayName,
InventoryStrategy inventoryStrategy, InventoryStrategy inventoryStrategy,
......
...@@ -16,14 +16,14 @@ namespace EasyAbp.EShop.Products.ProductCategories ...@@ -16,14 +16,14 @@ namespace EasyAbp.EShop.Products.ProductCategories
{ {
} }
public virtual async Task<List<ProductCategory>> GetListByCategoryId(Guid categoryId, Guid? storeId, public virtual async Task<List<ProductCategory>> GetListByCategoryId(Guid categoryId, Guid storeId,
CancellationToken cancellationToken = default) CancellationToken cancellationToken = default)
{ {
return await GetQueryable().Where(pc => pc.CategoryId == categoryId && pc.StoreId == storeId) return await GetQueryable().Where(pc => pc.CategoryId == categoryId && pc.StoreId == storeId)
.ToListAsync(cancellationToken); .ToListAsync(cancellationToken);
} }
public virtual async Task<List<ProductCategory>> GetListByProductId(Guid productId, Guid? storeId, public virtual async Task<List<ProductCategory>> GetListByProductId(Guid productId, Guid storeId,
CancellationToken cancellationToken = default) CancellationToken cancellationToken = default)
{ {
return await GetQueryable().Where(pc => pc.ProductId == productId && pc.StoreId == storeId) return await GetQueryable().Where(pc => pc.ProductId == productId && pc.StoreId == storeId)
......
...@@ -37,7 +37,7 @@ namespace EasyAbp.EShop.Products.Web.Pages.EShop.Products.Products.Product ...@@ -37,7 +37,7 @@ namespace EasyAbp.EShop.Products.Web.Pages.EShop.Products.Products.Product
_service = service; _service = service;
} }
public async Task OnGetAsync(Guid? storeId) public async Task OnGetAsync(Guid storeId)
{ {
ProductTypes = ProductTypes =
(await _productTypeAppService.GetListAsync(new PagedAndSortedResultRequestDto (await _productTypeAppService.GetListAsync(new PagedAndSortedResultRequestDto
......
...@@ -13,7 +13,7 @@ namespace EasyAbp.EShop.Products.Web.Pages.EShop.Products.Products.Product.ViewM ...@@ -13,7 +13,7 @@ namespace EasyAbp.EShop.Products.Web.Pages.EShop.Products.Products.Product.ViewM
{ {
[HiddenInput] [HiddenInput]
[Display(Name = "ProductStore")] [Display(Name = "ProductStore")]
public Guid? StoreId { get; set; } public Guid StoreId { get; set; }
[Required] [Required]
[SelectItems("ProductTypes")] [SelectItems("ProductTypes")]
......
...@@ -4,6 +4,6 @@ namespace EasyAbp.EShop.Stores.Stores ...@@ -4,6 +4,6 @@ namespace EasyAbp.EShop.Stores.Stores
{ {
public interface IMultiStore public interface IMultiStore
{ {
Guid? StoreId { get; } Guid StoreId { get; }
} }
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment