mirror of https://github.com/EasyAbp/EShop.git
43 changed files with 2958 additions and 110 deletions
@ -0,0 +1,17 @@ |
|||
using System; |
|||
using System.ComponentModel; |
|||
|
|||
namespace EasyAbp.EShop.Products.ProductDetails.Dtos |
|||
{ |
|||
public class CreateUpdateProductDetailDto |
|||
{ |
|||
/// <summary>
|
|||
/// This property is for product management permission checking
|
|||
/// </summary>
|
|||
[DisplayName("ProductDetailStoreId")] |
|||
public Guid StoreId { get; set; } |
|||
|
|||
[DisplayName("ProductDetailDescription")] |
|||
public string Description { get; set; } |
|||
} |
|||
} |
|||
@ -0,0 +1,10 @@ |
|||
using System; |
|||
using Volo.Abp.Application.Dtos; |
|||
|
|||
namespace EasyAbp.EShop.Products.ProductDetails.Dtos |
|||
{ |
|||
public class ProductDetailDto : EntityDto<Guid> |
|||
{ |
|||
public string Description { get; set; } |
|||
} |
|||
} |
|||
@ -0,0 +1,19 @@ |
|||
using System; |
|||
using System.Threading.Tasks; |
|||
using EasyAbp.EShop.Products.ProductDetails.Dtos; |
|||
using Volo.Abp.Application.Dtos; |
|||
using Volo.Abp.Application.Services; |
|||
|
|||
namespace EasyAbp.EShop.Products.ProductDetails |
|||
{ |
|||
public interface IProductDetailAppService : |
|||
ICrudAppService< |
|||
ProductDetailDto, |
|||
Guid, |
|||
PagedAndSortedResultRequestDto, |
|||
CreateUpdateProductDetailDto, |
|||
CreateUpdateProductDetailDto> |
|||
{ |
|||
Task DeleteAsync(Guid id, Guid storeId); |
|||
} |
|||
} |
|||
@ -1,12 +0,0 @@ |
|||
using System; |
|||
using System.ComponentModel; |
|||
using System.ComponentModel.DataAnnotations; |
|||
|
|||
namespace EasyAbp.EShop.Products.Products.Dtos |
|||
{ |
|||
public class CreateUpdateProductDetailDto |
|||
{ |
|||
[DisplayName("ProductDetailDescription")] |
|||
public string Description { get; set; } |
|||
} |
|||
} |
|||
@ -1,9 +0,0 @@ |
|||
using Volo.Abp.Application.Dtos; |
|||
|
|||
namespace EasyAbp.EShop.Products.Products.Dtos |
|||
{ |
|||
public class ProductDetailDto : EntityDto |
|||
{ |
|||
public string Description { get; set; } |
|||
} |
|||
} |
|||
@ -0,0 +1,86 @@ |
|||
using System; |
|||
using System.Threading.Tasks; |
|||
using EasyAbp.EShop.Products.Authorization; |
|||
using EasyAbp.EShop.Products.ProductDetails.Dtos; |
|||
using EasyAbp.EShop.Products.Products; |
|||
using EasyAbp.EShop.Products.ProductStores; |
|||
using Volo.Abp; |
|||
using Volo.Abp.Application.Dtos; |
|||
using Volo.Abp.Application.Services; |
|||
|
|||
namespace EasyAbp.EShop.Products.ProductDetails |
|||
{ |
|||
public class ProductDetailAppService : CrudAppService<ProductDetail, ProductDetailDto, Guid, PagedAndSortedResultRequestDto, CreateUpdateProductDetailDto, CreateUpdateProductDetailDto>, |
|||
IProductDetailAppService |
|||
{ |
|||
protected override string CreatePolicyName { get; set; } = ProductsPermissions.Products.Create; |
|||
protected override string DeletePolicyName { get; set; } = ProductsPermissions.Products.Delete; |
|||
protected override string UpdatePolicyName { get; set; } = ProductsPermissions.Products.Update; |
|||
protected override string GetPolicyName { get; set; } = ProductsPermissions.Products.Default; |
|||
protected override string GetListPolicyName { get; set; } = ProductsPermissions.Products.Default; |
|||
|
|||
private readonly IProductRepository _productRepository; |
|||
private readonly IProductStoreRepository _productStoreRepository; |
|||
private readonly IProductDetailRepository _repository; |
|||
|
|||
public ProductDetailAppService( |
|||
IProductRepository productRepository, |
|||
IProductStoreRepository productStoreRepository, |
|||
IProductDetailRepository repository) : base(repository) |
|||
{ |
|||
_productRepository = productRepository; |
|||
_productStoreRepository = productStoreRepository; |
|||
_repository = repository; |
|||
} |
|||
|
|||
public override async Task<ProductDetailDto> UpdateAsync(Guid id, CreateUpdateProductDetailDto input) |
|||
{ |
|||
await CheckUpdatePolicyAsync(); |
|||
|
|||
var product = await _productRepository.GetAsync(x => x.ProductDetailId == id); |
|||
|
|||
await CheckStoreIsProductOwnerAsync(product.Id, input.StoreId); |
|||
|
|||
var detail = await GetEntityByIdAsync(id); |
|||
|
|||
MapToEntity(input, detail); |
|||
|
|||
await Repository.UpdateAsync(detail, autoSave: true); |
|||
|
|||
return MapToGetOutputDto(detail); |
|||
} |
|||
|
|||
public virtual async Task DeleteAsync(Guid id, Guid storeId) |
|||
{ |
|||
await CheckDeletePolicyAsync(); |
|||
|
|||
var product = await _productRepository.GetAsync(x => x.ProductDetailId == id); |
|||
|
|||
await CheckStoreIsProductOwnerAsync(product.Id, storeId); |
|||
|
|||
await Repository.DeleteAsync(id); |
|||
} |
|||
|
|||
[RemoteService(false)] |
|||
public override Task DeleteAsync(Guid id) |
|||
{ |
|||
throw new NotImplementedException(); |
|||
} |
|||
|
|||
[RemoteService(false)] |
|||
public override Task<PagedResultDto<ProductDetailDto>> GetListAsync(PagedAndSortedResultRequestDto input) |
|||
{ |
|||
throw new NotImplementedException(); |
|||
} |
|||
|
|||
protected virtual async Task CheckStoreIsProductOwnerAsync(Guid productId, Guid storeId) |
|||
{ |
|||
var productStore = await _productStoreRepository.GetAsync(productId, storeId); |
|||
|
|||
if (!productStore.IsOwner) |
|||
{ |
|||
throw new StoreIsNotProductOwnerException(productId, storeId); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,11 @@ |
|||
using System; |
|||
using System.Linq; |
|||
using EasyAbp.EShop.Products.Products; |
|||
using Volo.Abp.Domain.Repositories; |
|||
|
|||
namespace EasyAbp.EShop.Products.ProductDetails |
|||
{ |
|||
public interface IProductDetailRepository : IRepository<ProductDetail, Guid> |
|||
{ |
|||
} |
|||
} |
|||
@ -0,0 +1,26 @@ |
|||
using System; |
|||
using JetBrains.Annotations; |
|||
using Volo.Abp.Domain.Entities.Auditing; |
|||
|
|||
namespace EasyAbp.EShop.Products.ProductDetails |
|||
{ |
|||
public class ProductDetail : FullAuditedAggregateRoot<Guid> |
|||
{ |
|||
[CanBeNull] |
|||
public virtual string Description { get; protected set; } |
|||
|
|||
protected ProductDetail() {} |
|||
|
|||
public ProductDetail( |
|||
Guid id, |
|||
[CanBeNull] string description) : base(id) |
|||
{ |
|||
Description = description; |
|||
} |
|||
|
|||
public void SetDescription(string description) |
|||
{ |
|||
Description = description; |
|||
} |
|||
} |
|||
} |
|||
@ -1,29 +0,0 @@ |
|||
using System; |
|||
using JetBrains.Annotations; |
|||
using Volo.Abp.Domain.Entities; |
|||
|
|||
namespace EasyAbp.EShop.Products.Products |
|||
{ |
|||
public class ProductDetail : Entity |
|||
{ |
|||
public virtual Guid ProductId { get; protected set; } |
|||
|
|||
[CanBeNull] |
|||
public virtual string Description { get; protected set; } |
|||
|
|||
protected ProductDetail() {} |
|||
|
|||
public ProductDetail( |
|||
Guid productId, |
|||
[CanBeNull] string description) |
|||
{ |
|||
ProductId = productId; |
|||
Description = description; |
|||
} |
|||
|
|||
public override object[] GetKeys() |
|||
{ |
|||
return new object[] {ProductId}; |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,14 @@ |
|||
using System; |
|||
using EasyAbp.EShop.Products.EntityFrameworkCore; |
|||
using Volo.Abp.Domain.Repositories.EntityFrameworkCore; |
|||
using Volo.Abp.EntityFrameworkCore; |
|||
|
|||
namespace EasyAbp.EShop.Products.ProductDetails |
|||
{ |
|||
public class ProductDetailRepository : EfCoreRepository<ProductsDbContext, ProductDetail, Guid>, IProductDetailRepository |
|||
{ |
|||
public ProductDetailRepository(IDbContextProvider<ProductsDbContext> dbContextProvider) : base(dbContextProvider) |
|||
{ |
|||
} |
|||
} |
|||
} |
|||
2
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Web/Pages/EShop/Products/Products/Product/ViewModels/CreateUpdateProductAttributeOptionViewModel.cs → modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Web/Pages/EShop/Products/Products/Product/ViewModels/CreateEditProductAttributeOptionViewModel.cs
2
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Web/Pages/EShop/Products/Products/Product/ViewModels/CreateUpdateProductAttributeOptionViewModel.cs → modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Web/Pages/EShop/Products/Products/Product/ViewModels/CreateEditProductAttributeOptionViewModel.cs
4
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Web/Pages/EShop/Products/Products/Product/ViewModels/CreateUpdateProductAttributeViewModel.cs → modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Web/Pages/EShop/Products/Products/Product/ViewModels/CreateEditProductAttributeViewModel.cs
4
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Web/Pages/EShop/Products/Products/Product/ViewModels/CreateUpdateProductAttributeViewModel.cs → modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Web/Pages/EShop/Products/Products/Product/ViewModels/CreateEditProductAttributeViewModel.cs
File diff suppressed because it is too large
@ -0,0 +1,167 @@ |
|||
using System; |
|||
using Microsoft.EntityFrameworkCore.Migrations; |
|||
|
|||
namespace EasyMall.Migrations |
|||
{ |
|||
public partial class ProductEntitiesAdjustment : Migration |
|||
{ |
|||
protected override void Up(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.DropForeignKey( |
|||
name: "FK_ProductsProductDetails_ProductsProducts_ProductId", |
|||
table: "ProductsProductDetails"); |
|||
|
|||
migrationBuilder.DropPrimaryKey( |
|||
name: "PK_ProductsProductDetails", |
|||
table: "ProductsProductDetails"); |
|||
|
|||
migrationBuilder.DropColumn( |
|||
name: "ProductId", |
|||
table: "ProductsProductDetails"); |
|||
|
|||
migrationBuilder.AddColumn<Guid>( |
|||
name: "ProductDetailId", |
|||
table: "ProductsProductSkus", |
|||
nullable: true); |
|||
|
|||
migrationBuilder.AddColumn<Guid>( |
|||
name: "ProductDetailId", |
|||
table: "ProductsProducts", |
|||
nullable: false, |
|||
defaultValue: new Guid("00000000-0000-0000-0000-000000000000")); |
|||
|
|||
migrationBuilder.AddColumn<Guid>( |
|||
name: "Id", |
|||
table: "ProductsProductDetails", |
|||
nullable: false, |
|||
defaultValue: new Guid("00000000-0000-0000-0000-000000000000")); |
|||
|
|||
migrationBuilder.AddColumn<string>( |
|||
name: "ConcurrencyStamp", |
|||
table: "ProductsProductDetails", |
|||
nullable: true); |
|||
|
|||
migrationBuilder.AddColumn<DateTime>( |
|||
name: "CreationTime", |
|||
table: "ProductsProductDetails", |
|||
nullable: false, |
|||
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); |
|||
|
|||
migrationBuilder.AddColumn<Guid>( |
|||
name: "CreatorId", |
|||
table: "ProductsProductDetails", |
|||
nullable: true); |
|||
|
|||
migrationBuilder.AddColumn<Guid>( |
|||
name: "DeleterId", |
|||
table: "ProductsProductDetails", |
|||
nullable: true); |
|||
|
|||
migrationBuilder.AddColumn<DateTime>( |
|||
name: "DeletionTime", |
|||
table: "ProductsProductDetails", |
|||
nullable: true); |
|||
|
|||
migrationBuilder.AddColumn<string>( |
|||
name: "ExtraProperties", |
|||
table: "ProductsProductDetails", |
|||
nullable: true); |
|||
|
|||
migrationBuilder.AddColumn<bool>( |
|||
name: "IsDeleted", |
|||
table: "ProductsProductDetails", |
|||
nullable: false, |
|||
defaultValue: false); |
|||
|
|||
migrationBuilder.AddColumn<DateTime>( |
|||
name: "LastModificationTime", |
|||
table: "ProductsProductDetails", |
|||
nullable: true); |
|||
|
|||
migrationBuilder.AddColumn<Guid>( |
|||
name: "LastModifierId", |
|||
table: "ProductsProductDetails", |
|||
nullable: true); |
|||
|
|||
migrationBuilder.AddPrimaryKey( |
|||
name: "PK_ProductsProductDetails", |
|||
table: "ProductsProductDetails", |
|||
column: "Id"); |
|||
} |
|||
|
|||
protected override void Down(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.DropPrimaryKey( |
|||
name: "PK_ProductsProductDetails", |
|||
table: "ProductsProductDetails"); |
|||
|
|||
migrationBuilder.DropColumn( |
|||
name: "ProductDetailId", |
|||
table: "ProductsProductSkus"); |
|||
|
|||
migrationBuilder.DropColumn( |
|||
name: "ProductDetailId", |
|||
table: "ProductsProducts"); |
|||
|
|||
migrationBuilder.DropColumn( |
|||
name: "Id", |
|||
table: "ProductsProductDetails"); |
|||
|
|||
migrationBuilder.DropColumn( |
|||
name: "ConcurrencyStamp", |
|||
table: "ProductsProductDetails"); |
|||
|
|||
migrationBuilder.DropColumn( |
|||
name: "CreationTime", |
|||
table: "ProductsProductDetails"); |
|||
|
|||
migrationBuilder.DropColumn( |
|||
name: "CreatorId", |
|||
table: "ProductsProductDetails"); |
|||
|
|||
migrationBuilder.DropColumn( |
|||
name: "DeleterId", |
|||
table: "ProductsProductDetails"); |
|||
|
|||
migrationBuilder.DropColumn( |
|||
name: "DeletionTime", |
|||
table: "ProductsProductDetails"); |
|||
|
|||
migrationBuilder.DropColumn( |
|||
name: "ExtraProperties", |
|||
table: "ProductsProductDetails"); |
|||
|
|||
migrationBuilder.DropColumn( |
|||
name: "IsDeleted", |
|||
table: "ProductsProductDetails"); |
|||
|
|||
migrationBuilder.DropColumn( |
|||
name: "LastModificationTime", |
|||
table: "ProductsProductDetails"); |
|||
|
|||
migrationBuilder.DropColumn( |
|||
name: "LastModifierId", |
|||
table: "ProductsProductDetails"); |
|||
|
|||
migrationBuilder.AddColumn<Guid>( |
|||
name: "ProductId", |
|||
table: "ProductsProductDetails", |
|||
type: "uniqueidentifier", |
|||
nullable: false, |
|||
defaultValue: new Guid("00000000-0000-0000-0000-000000000000")); |
|||
|
|||
migrationBuilder.AddPrimaryKey( |
|||
name: "PK_ProductsProductDetails", |
|||
table: "ProductsProductDetails", |
|||
column: "ProductId"); |
|||
|
|||
migrationBuilder.AddForeignKey( |
|||
name: "FK_ProductsProductDetails_ProductsProducts_ProductId", |
|||
table: "ProductsProductDetails", |
|||
column: "ProductId", |
|||
principalTable: "ProductsProducts", |
|||
principalColumn: "Id", |
|||
onDelete: ReferentialAction.Cascade); |
|||
} |
|||
} |
|||
} |
|||
Loading…
Reference in new issue