mirror of https://github.com/EasyAbp/EShop.git
17 changed files with 2776 additions and 0 deletions
@ -0,0 +1,10 @@ |
|||
using System; |
|||
using Volo.Abp.Application.Dtos; |
|||
|
|||
namespace EasyAbp.EShop.Products.ProductDetailHistories.Dtos |
|||
{ |
|||
public class GetProductDetailHistoryListDto : PagedAndSortedResultRequestDto |
|||
{ |
|||
public Guid ProductDetailId { get; set; } |
|||
} |
|||
} |
|||
@ -0,0 +1,14 @@ |
|||
using System; |
|||
using Volo.Abp.Application.Dtos; |
|||
|
|||
namespace EasyAbp.EShop.Products.ProductDetailHistories.Dtos |
|||
{ |
|||
public class ProductDetailHistoryDto : EntityDto<Guid> |
|||
{ |
|||
public Guid ProductDetailId { get; set; } |
|||
|
|||
public DateTime ModificationTime { get; set; } |
|||
|
|||
public string SerializedDto { get; set; } |
|||
} |
|||
} |
|||
@ -0,0 +1,19 @@ |
|||
using System; |
|||
using System.Threading.Tasks; |
|||
using EasyAbp.EShop.Products.ProductDetailHistories.Dtos; |
|||
using Volo.Abp.Application.Dtos; |
|||
using Volo.Abp.Application.Services; |
|||
|
|||
namespace EasyAbp.EShop.Products.ProductDetailHistories |
|||
{ |
|||
public interface IProductDetailHistoryAppService : |
|||
ICrudAppService< |
|||
ProductDetailHistoryDto, |
|||
Guid, |
|||
GetProductDetailHistoryListDto, |
|||
object, |
|||
object> |
|||
{ |
|||
Task<ProductDetailHistoryDto> GetByTimeAsync(Guid productId, DateTime modificationTime); |
|||
} |
|||
} |
|||
@ -0,0 +1,10 @@ |
|||
using System; |
|||
using Volo.Abp.Application.Dtos; |
|||
|
|||
namespace EasyAbp.EShop.Products.ProductHistories.Dtos |
|||
{ |
|||
public class GetProductHistoryListDto : PagedAndSortedResultRequestDto |
|||
{ |
|||
public Guid ProductId { get; set; } |
|||
} |
|||
} |
|||
@ -0,0 +1,14 @@ |
|||
using System; |
|||
using Volo.Abp.Application.Dtos; |
|||
|
|||
namespace EasyAbp.EShop.Products.ProductHistories.Dtos |
|||
{ |
|||
public class ProductHistoryDto : EntityDto<Guid> |
|||
{ |
|||
public Guid ProductId { get; set; } |
|||
|
|||
public DateTime ModificationTime { get; set; } |
|||
|
|||
public string SerializedDto { get; set; } |
|||
} |
|||
} |
|||
@ -0,0 +1,18 @@ |
|||
using System; |
|||
using System.Threading.Tasks; |
|||
using EasyAbp.EShop.Products.ProductHistories.Dtos; |
|||
using Volo.Abp.Application.Services; |
|||
|
|||
namespace EasyAbp.EShop.Products.ProductHistories |
|||
{ |
|||
public interface IProductHistoryAppService : |
|||
ICrudAppService< |
|||
ProductHistoryDto, |
|||
Guid, |
|||
GetProductHistoryListDto, |
|||
object, |
|||
object> |
|||
{ |
|||
Task<ProductHistoryDto> GetByTimeAsync(Guid productId, DateTime modificationTime); |
|||
} |
|||
} |
|||
@ -0,0 +1,53 @@ |
|||
using System; |
|||
using System.Linq; |
|||
using System.Threading.Tasks; |
|||
using EasyAbp.EShop.Products.Authorization; |
|||
using EasyAbp.EShop.Products.ProductDetailHistories.Dtos; |
|||
using Volo.Abp; |
|||
using Volo.Abp.Application.Services; |
|||
|
|||
namespace EasyAbp.EShop.Products.ProductDetailHistories |
|||
{ |
|||
public class ProductDetailHistoryAppService : CrudAppService<ProductDetailHistory, ProductDetailHistoryDto, Guid, GetProductDetailHistoryListDto, object, object>, |
|||
IProductDetailHistoryAppService |
|||
{ |
|||
protected override string GetListPolicyName { get; set; } = ProductsPermissions.Products.Default; |
|||
|
|||
private readonly IProductDetailHistoryRepository _repository; |
|||
|
|||
public ProductDetailHistoryAppService(IProductDetailHistoryRepository repository) : base(repository) |
|||
{ |
|||
_repository = repository; |
|||
} |
|||
|
|||
protected override IQueryable<ProductDetailHistory> CreateFilteredQuery(GetProductDetailHistoryListDto input) |
|||
{ |
|||
return base.CreateFilteredQuery(input).Where(x => x.ProductDetailId == input.ProductDetailId); |
|||
} |
|||
|
|||
public async Task<ProductDetailHistoryDto> GetByTimeAsync(Guid productId, DateTime modificationTime) |
|||
{ |
|||
await CheckGetPolicyAsync(); |
|||
|
|||
return MapToGetOutputDto(await _repository.GetAsync(productId, modificationTime)); |
|||
} |
|||
|
|||
[RemoteService(false)] |
|||
public override Task<ProductDetailHistoryDto> CreateAsync(object input) |
|||
{ |
|||
throw new NotImplementedException(); |
|||
} |
|||
|
|||
[RemoteService(false)] |
|||
public override Task<ProductDetailHistoryDto> UpdateAsync(Guid id, object input) |
|||
{ |
|||
throw new NotImplementedException(); |
|||
} |
|||
|
|||
[RemoteService(false)] |
|||
public override Task DeleteAsync(Guid id) |
|||
{ |
|||
throw new NotImplementedException(); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,53 @@ |
|||
using System; |
|||
using System.Linq; |
|||
using System.Threading.Tasks; |
|||
using EasyAbp.EShop.Products.Authorization; |
|||
using EasyAbp.EShop.Products.ProductHistories.Dtos; |
|||
using Volo.Abp; |
|||
using Volo.Abp.Application.Services; |
|||
|
|||
namespace EasyAbp.EShop.Products.ProductHistories |
|||
{ |
|||
public class ProductHistoryAppService : CrudAppService<ProductHistory, ProductHistoryDto, Guid, GetProductHistoryListDto, object, object>, |
|||
IProductHistoryAppService |
|||
{ |
|||
protected override string GetListPolicyName { get; set; } = ProductsPermissions.Products.Default; |
|||
|
|||
private readonly IProductHistoryRepository _repository; |
|||
|
|||
public ProductHistoryAppService(IProductHistoryRepository repository) : base(repository) |
|||
{ |
|||
_repository = repository; |
|||
} |
|||
|
|||
protected override IQueryable<ProductHistory> CreateFilteredQuery(GetProductHistoryListDto input) |
|||
{ |
|||
return base.CreateFilteredQuery(input).Where(x => x.ProductId == input.ProductId); |
|||
} |
|||
|
|||
public async Task<ProductHistoryDto> GetByTimeAsync(Guid productId, DateTime modificationTime) |
|||
{ |
|||
await CheckGetPolicyAsync(); |
|||
|
|||
return MapToGetOutputDto(await _repository.GetAsync(productId, modificationTime)); |
|||
} |
|||
|
|||
[RemoteService(false)] |
|||
public override Task<ProductHistoryDto> CreateAsync(object input) |
|||
{ |
|||
throw new NotImplementedException(); |
|||
} |
|||
|
|||
[RemoteService(false)] |
|||
public override Task<ProductHistoryDto> UpdateAsync(Guid id, object input) |
|||
{ |
|||
throw new NotImplementedException(); |
|||
} |
|||
|
|||
[RemoteService(false)] |
|||
public override Task DeleteAsync(Guid id) |
|||
{ |
|||
throw new NotImplementedException(); |
|||
} |
|||
} |
|||
} |
|||
@ -1,9 +1,13 @@ |
|||
using System; |
|||
using System.Threading; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.Domain.Repositories; |
|||
|
|||
namespace EasyAbp.EShop.Products.ProductDetailHistories |
|||
{ |
|||
public interface IProductDetailHistoryRepository : IRepository<ProductDetailHistory, Guid> |
|||
{ |
|||
Task<ProductDetailHistory> GetAsync(Guid productDetailId, DateTime modificationTime, |
|||
CancellationToken cancellationToken = default); |
|||
} |
|||
} |
|||
@ -1,9 +1,13 @@ |
|||
using System; |
|||
using System.Threading; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.Domain.Repositories; |
|||
|
|||
namespace EasyAbp.EShop.Products.ProductHistories |
|||
{ |
|||
public interface IProductHistoryRepository : IRepository<ProductHistory, Guid> |
|||
{ |
|||
Task<ProductHistory> GetAsync(Guid productId, DateTime modificationTime, |
|||
CancellationToken cancellationToken = default); |
|||
} |
|||
} |
|||
File diff suppressed because it is too large
@ -0,0 +1,49 @@ |
|||
using Microsoft.EntityFrameworkCore.Migrations; |
|||
|
|||
namespace EasyMall.Migrations |
|||
{ |
|||
public partial class AddedHistoryEntityIndexes : Migration |
|||
{ |
|||
protected override void Up(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.CreateIndex( |
|||
name: "IX_ProductsProductHistories_ModificationTime", |
|||
table: "ProductsProductHistories", |
|||
column: "ModificationTime"); |
|||
|
|||
migrationBuilder.CreateIndex( |
|||
name: "IX_ProductsProductHistories_ProductId", |
|||
table: "ProductsProductHistories", |
|||
column: "ProductId"); |
|||
|
|||
migrationBuilder.CreateIndex( |
|||
name: "IX_ProductsProductDetailHistories_ModificationTime", |
|||
table: "ProductsProductDetailHistories", |
|||
column: "ModificationTime"); |
|||
|
|||
migrationBuilder.CreateIndex( |
|||
name: "IX_ProductsProductDetailHistories_ProductDetailId", |
|||
table: "ProductsProductDetailHistories", |
|||
column: "ProductDetailId"); |
|||
} |
|||
|
|||
protected override void Down(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.DropIndex( |
|||
name: "IX_ProductsProductHistories_ModificationTime", |
|||
table: "ProductsProductHistories"); |
|||
|
|||
migrationBuilder.DropIndex( |
|||
name: "IX_ProductsProductHistories_ProductId", |
|||
table: "ProductsProductHistories"); |
|||
|
|||
migrationBuilder.DropIndex( |
|||
name: "IX_ProductsProductDetailHistories_ModificationTime", |
|||
table: "ProductsProductDetailHistories"); |
|||
|
|||
migrationBuilder.DropIndex( |
|||
name: "IX_ProductsProductDetailHistories_ProductDetailId", |
|||
table: "ProductsProductDetailHistories"); |
|||
} |
|||
} |
|||
} |
|||
Loading…
Reference in new issue