mirror of https://github.com/EasyAbp/EShop.git
committed by
GitHub
83 changed files with 7321 additions and 332 deletions
@ -0,0 +1,16 @@ |
|||
using System; |
|||
|
|||
namespace EasyAbp.EShop.Orders.Orders.Dtos; |
|||
|
|||
public class OrderDiscountDto |
|||
{ |
|||
public Guid OrderLineId { get; set; } |
|||
|
|||
public string Name { get; set; } |
|||
|
|||
public string Key { get; set; } |
|||
|
|||
public string DisplayName { get; set; } |
|||
|
|||
public decimal DiscountedAmount { get; set; } |
|||
} |
|||
@ -1,15 +0,0 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Threading.Tasks; |
|||
using EasyAbp.EShop.Orders.Orders.Dtos; |
|||
using EasyAbp.EShop.Products.ProductDetails.Dtos; |
|||
using EasyAbp.EShop.Products.Products.Dtos; |
|||
|
|||
namespace EasyAbp.EShop.Orders.Orders |
|||
{ |
|||
public interface INewOrderGenerator |
|||
{ |
|||
Task<Order> GenerateAsync(Guid customerUserId, CreateOrderDto input, Dictionary<Guid, ProductDto> productDict, |
|||
Dictionary<Guid, ProductDetailDto> productDetailDict); |
|||
} |
|||
} |
|||
@ -1,12 +0,0 @@ |
|||
using System.Threading.Tasks; |
|||
using EasyAbp.EShop.Orders.Orders.Dtos; |
|||
using EasyAbp.EShop.Products.Products.Dtos; |
|||
using NodaMoney; |
|||
|
|||
namespace EasyAbp.EShop.Orders.Orders; |
|||
|
|||
public interface IOrderLinePriceOverrider |
|||
{ |
|||
Task<Money?> GetUnitPriceOrNullAsync(CreateOrderDto input, CreateOrderLineDto inputOrderLine, ProductDto product, |
|||
ProductSkuDto productSku, Currency effectiveCurrency); |
|||
} |
|||
@ -1,13 +1,12 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using EasyAbp.EShop.Orders.Orders.Dtos; |
|||
using EasyAbp.EShop.Products.Products.Dtos; |
|||
|
|||
namespace EasyAbp.EShop.Orders.Orders |
|||
{ |
|||
public class OrderCreationResource |
|||
{ |
|||
public CreateOrderDto Input { get; set; } |
|||
public ICreateOrderInfo Input { get; set; } |
|||
|
|||
public Dictionary<Guid, ProductDto> ProductDictionary { get; set; } |
|||
} |
|||
|
|||
@ -0,0 +1,27 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using Volo.Abp.ObjectExtending; |
|||
|
|||
namespace EasyAbp.EShop.Orders.Orders; |
|||
|
|||
[Serializable] |
|||
public class CreateOrderInfoModel : ExtensibleObject, ICreateOrderInfo |
|||
{ |
|||
public Guid StoreId { get; set; } |
|||
|
|||
public string CustomerRemark { get; set; } |
|||
|
|||
IEnumerable<ICreateOrderLineInfo> ICreateOrderInfo.OrderLines => OrderLines; |
|||
public List<CreateOrderLineInfoModel> OrderLines { get; set; } |
|||
|
|||
public CreateOrderInfoModel() |
|||
{ |
|||
} |
|||
|
|||
public CreateOrderInfoModel(Guid storeId, string customerRemark, List<CreateOrderLineInfoModel> orderLines) |
|||
{ |
|||
StoreId = storeId; |
|||
CustomerRemark = customerRemark; |
|||
OrderLines = orderLines; |
|||
} |
|||
} |
|||
@ -0,0 +1,25 @@ |
|||
using System; |
|||
using Volo.Abp.ObjectExtending; |
|||
|
|||
namespace EasyAbp.EShop.Orders.Orders; |
|||
|
|||
[Serializable] |
|||
public class CreateOrderLineInfoModel : ExtensibleObject, ICreateOrderLineInfo |
|||
{ |
|||
public Guid ProductId { get; set; } |
|||
|
|||
public Guid ProductSkuId { get; set; } |
|||
|
|||
public int Quantity { get; set; } |
|||
|
|||
public CreateOrderLineInfoModel() |
|||
{ |
|||
} |
|||
|
|||
public CreateOrderLineInfoModel(Guid productId, Guid productSkuId, int quantity) |
|||
{ |
|||
ProductId = productId; |
|||
ProductSkuId = productSkuId; |
|||
Quantity = quantity; |
|||
} |
|||
} |
|||
@ -0,0 +1,12 @@ |
|||
using System.Collections.Generic; |
|||
using EasyAbp.EShop.Stores.Stores; |
|||
using Volo.Abp.Data; |
|||
|
|||
namespace EasyAbp.EShop.Orders.Orders; |
|||
|
|||
public interface ICreateOrderInfo : IMultiStore, IHasExtraProperties |
|||
{ |
|||
string CustomerRemark { get; } |
|||
|
|||
IEnumerable<ICreateOrderLineInfo> OrderLines { get; } |
|||
} |
|||
@ -0,0 +1,13 @@ |
|||
using System; |
|||
using Volo.Abp.Data; |
|||
|
|||
namespace EasyAbp.EShop.Orders.Orders; |
|||
|
|||
public interface ICreateOrderLineInfo : IHasExtraProperties |
|||
{ |
|||
Guid ProductId { get; } |
|||
|
|||
Guid ProductSkuId { get; } |
|||
|
|||
int Quantity { get; } |
|||
} |
|||
@ -0,0 +1,16 @@ |
|||
using System; |
|||
using Volo.Abp; |
|||
|
|||
namespace EasyAbp.EShop.Orders.Orders |
|||
{ |
|||
public class DuplicateOrderDiscountException : BusinessException |
|||
{ |
|||
public DuplicateOrderDiscountException(Guid orderLineId, string discountName, string discountKey) : base( |
|||
OrdersErrorCodes.DuplicateOrderDiscount) |
|||
{ |
|||
WithData(nameof(orderLineId), orderLineId); |
|||
WithData(nameof(discountName), discountName); |
|||
WithData(nameof(discountKey), discountKey); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,13 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Threading.Tasks; |
|||
using EasyAbp.EShop.Products.Products; |
|||
|
|||
namespace EasyAbp.EShop.Orders.Orders |
|||
{ |
|||
public interface INewOrderGenerator |
|||
{ |
|||
Task<Order> GenerateAsync(Guid customerUserId, ICreateOrderInfo input, Dictionary<Guid, IProduct> productDict, |
|||
Dictionary<Guid, DateTime> productDetailModificationTimeDict); |
|||
} |
|||
} |
|||
@ -1,12 +1,12 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Threading.Tasks; |
|||
using EasyAbp.EShop.Products.Products.Dtos; |
|||
using EasyAbp.EShop.Products.Products; |
|||
|
|||
namespace EasyAbp.EShop.Orders.Orders |
|||
{ |
|||
public interface IOrderDiscountProvider |
|||
{ |
|||
Task<Order> DiscountAsync(Order order, Dictionary<Guid, ProductDto> productDict); |
|||
Task<List<OrderDiscountInfoModel>> GetAllAsync(Order order, Dictionary<Guid, IProduct> productDict); |
|||
} |
|||
} |
|||
@ -1,15 +1,14 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Threading.Tasks; |
|||
using EasyAbp.EShop.Orders.Orders.Dtos; |
|||
using EasyAbp.EShop.Products.Products.Dtos; |
|||
using EasyAbp.EShop.Products.Products; |
|||
using NodaMoney; |
|||
|
|||
namespace EasyAbp.EShop.Orders.Orders |
|||
{ |
|||
public interface IOrderExtraFeeProvider |
|||
{ |
|||
Task<List<OrderExtraFeeInfoModel>> GetListAsync(Guid customerUserId, CreateOrderDto input, |
|||
Dictionary<Guid, ProductDto> productDict, Currency effectiveCurrency); |
|||
Task<List<OrderExtraFeeInfoModel>> GetListAsync(Guid customerUserId, ICreateOrderInfo input, |
|||
Dictionary<Guid, IProduct> productDict, Currency effectiveCurrency); |
|||
} |
|||
} |
|||
@ -0,0 +1,11 @@ |
|||
using System.Threading.Tasks; |
|||
using EasyAbp.EShop.Products.Products; |
|||
using NodaMoney; |
|||
|
|||
namespace EasyAbp.EShop.Orders.Orders; |
|||
|
|||
public interface IOrderLinePriceOverrider |
|||
{ |
|||
Task<Money?> GetUnitPriceOrNullAsync(ICreateOrderInfo input, ICreateOrderLineInfo inputOrderLine, |
|||
IProduct product, IProductSku productSku, Currency effectiveCurrency); |
|||
} |
|||
@ -0,0 +1,48 @@ |
|||
using System; |
|||
using JetBrains.Annotations; |
|||
using Volo.Abp.Domain.Entities; |
|||
|
|||
namespace EasyAbp.EShop.Orders.Orders; |
|||
|
|||
public class OrderDiscount : Entity |
|||
{ |
|||
public virtual Guid OrderId { get; protected set; } |
|||
|
|||
public virtual Guid OrderLineId { get; protected set; } |
|||
|
|||
[NotNull] |
|||
public virtual string Name { get; protected set; } |
|||
|
|||
[CanBeNull] |
|||
public virtual string Key { get; protected set; } |
|||
|
|||
[CanBeNull] |
|||
public virtual string DisplayName { get; protected set; } |
|||
|
|||
public virtual decimal DiscountedAmount { get; protected set; } |
|||
|
|||
protected OrderDiscount() |
|||
{ |
|||
} |
|||
|
|||
public OrderDiscount( |
|||
Guid orderId, |
|||
Guid orderLineId, |
|||
[NotNull] string name, |
|||
[CanBeNull] string key, |
|||
[CanBeNull] string displayName, |
|||
decimal discountedAmount) |
|||
{ |
|||
OrderId = orderId; |
|||
OrderLineId = orderLineId; |
|||
Name = name; |
|||
Key = key; |
|||
DisplayName = displayName; |
|||
DiscountedAmount = discountedAmount; |
|||
} |
|||
|
|||
public override object[] GetKeys() |
|||
{ |
|||
return new object[] { OrderId, OrderLineId, Name, Key }; |
|||
} |
|||
} |
|||
@ -0,0 +1,34 @@ |
|||
using System; |
|||
using JetBrains.Annotations; |
|||
|
|||
namespace EasyAbp.EShop.Orders.Orders; |
|||
|
|||
public class OrderDiscountInfoModel |
|||
{ |
|||
public Guid OrderLineId { get; set; } |
|||
|
|||
[NotNull] |
|||
public string Name { get; set; } |
|||
|
|||
[CanBeNull] |
|||
public string Key { get; set; } |
|||
|
|||
[CanBeNull] |
|||
public string DisplayName { get; set; } |
|||
|
|||
public decimal DiscountedAmount { get; set; } |
|||
|
|||
public OrderDiscountInfoModel( |
|||
Guid orderLineId, |
|||
[NotNull] string name, |
|||
[CanBeNull] string key, |
|||
[CanBeNull] string displayName, |
|||
decimal discountedAmount) |
|||
{ |
|||
OrderLineId = orderLineId; |
|||
Name = name; |
|||
Key = key ?? string.Empty; |
|||
DisplayName = displayName; |
|||
DiscountedAmount = discountedAmount; |
|||
} |
|||
} |
|||
@ -0,0 +1,19 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Threading.Tasks; |
|||
using EasyAbp.EShop.Products.Products; |
|||
|
|||
namespace EasyAbp.EShop.Orders.Orders; |
|||
|
|||
public class DemoOrderDiscountProvider : IOrderDiscountProvider |
|||
{ |
|||
public Task<List<OrderDiscountInfoModel>> GetAllAsync(Order order, Dictionary<Guid, IProduct> productDict) |
|||
{ |
|||
return Task.FromResult(new List<OrderDiscountInfoModel> |
|||
{ |
|||
new(order.OrderLines.First().Id, "DemoDiscount1", "1", "Demo Discount 1", 0.01m), |
|||
new(order.OrderLines.First().Id, "DemoDiscount2", "2", "Demo Discount 2", 0.1m), |
|||
}); |
|||
} |
|||
} |
|||
@ -0,0 +1,65 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Threading.Tasks; |
|||
using EasyAbp.EShop.Products.Products; |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
using Shouldly; |
|||
using Xunit; |
|||
|
|||
namespace EasyAbp.EShop.Orders.Orders; |
|||
|
|||
public class OrderDiscountTests : OrdersDomainTestBase |
|||
{ |
|||
protected override void AfterAddApplication(IServiceCollection services) |
|||
{ |
|||
services.AddTransient<IOrderDiscountProvider, DemoOrderDiscountProvider>(); |
|||
base.AfterAddApplication(services); |
|||
} |
|||
|
|||
[Fact] |
|||
public async Task Should_Create_Order_With_Discount() |
|||
{ |
|||
var orderGenerator = GetRequiredService<INewOrderGenerator>(); |
|||
|
|||
var createOrderInfoModel = new CreateOrderInfoModel(OrderTestData.Store1Id, null, |
|||
new List<CreateOrderLineInfoModel> |
|||
{ |
|||
new(OrderTestData.Product1Id, OrderTestData.ProductSku1Id, 2) |
|||
} |
|||
); |
|||
|
|||
var order = await orderGenerator.GenerateAsync(Guid.NewGuid(), createOrderInfoModel, |
|||
new Dictionary<Guid, IProduct> |
|||
{ |
|||
{ |
|||
OrderTestData.Product1Id, new ProductEto |
|||
{ |
|||
Id = OrderTestData.Product1Id, |
|||
ProductSkus = new List<ProductSkuEto> |
|||
{ |
|||
new() |
|||
{ |
|||
Id = OrderTestData.ProductSku1Id, |
|||
AttributeOptionIds = new List<Guid>(), |
|||
Price = 1m, |
|||
Currency = "USD", |
|||
OrderMinQuantity = 1, |
|||
OrderMaxQuantity = 100, |
|||
} |
|||
} |
|||
} |
|||
} |
|||
}, new Dictionary<Guid, DateTime>()); |
|||
|
|||
order.ActualTotalPrice.ShouldBe(1.89m); |
|||
order.TotalDiscount.ShouldBe(0.11m); |
|||
order.OrderDiscounts.Count.ShouldBe(2); |
|||
order.OrderDiscounts.ShouldContain(x => |
|||
x.OrderId == order.Id && x.OrderLineId == order.OrderLines.First().Id && x.Name == "DemoDiscount1" && |
|||
x.Key == "1" && x.DisplayName == "Demo Discount 1" && x.DiscountedAmount == 0.01m); |
|||
order.OrderDiscounts.ShouldContain(x => |
|||
x.OrderId == order.Id && x.OrderLineId == order.OrderLines.First().Id && x.Name == "DemoDiscount2" && |
|||
x.Key == "2" && x.DisplayName == "Demo Discount 2" && x.DiscountedAmount == 0.1m); |
|||
} |
|||
} |
|||
@ -0,0 +1,9 @@ |
|||
using JetBrains.Annotations; |
|||
|
|||
namespace EasyAbp.EShop.Products.Products; |
|||
|
|||
public interface IHasProductGroupDisplayName |
|||
{ |
|||
[NotNull] |
|||
string ProductGroupDisplayName { get; } |
|||
} |
|||
@ -1,10 +1,9 @@ |
|||
using System.Threading.Tasks; |
|||
using EasyAbp.EShop.Products.Products.Dtos; |
|||
|
|||
namespace EasyAbp.EShop.Products.Products |
|||
{ |
|||
public interface IProductSkuDescriptionProvider |
|||
{ |
|||
Task<string> GenerateAsync(ProductDto productDto, ProductSkuDto productSkuDto); |
|||
Task<string> GenerateAsync(IProduct product, IProductSku productSku); |
|||
} |
|||
} |
|||
@ -0,0 +1,24 @@ |
|||
using System; |
|||
using System.Linq; |
|||
|
|||
namespace EasyAbp.EShop.Products.Products; |
|||
|
|||
public static class ProductExtensions |
|||
{ |
|||
public static IProductSku GetSkuById(this IProduct product, Guid skuId) |
|||
{ |
|||
return product.ProductSkus.Single(x => x.Id == skuId); |
|||
} |
|||
|
|||
public static IProductSku FindSkuById(this IProduct product, Guid skuId) |
|||
{ |
|||
return product.ProductSkus.FirstOrDefault(x => x.Id == skuId); |
|||
} |
|||
|
|||
public static TimeSpan? GetSkuPaymentExpireIn(this IProduct product, Guid skuId) |
|||
{ |
|||
var sku = product.GetSkuById(skuId); |
|||
|
|||
return sku.PaymentExpireIn ?? product.PaymentExpireIn; |
|||
} |
|||
} |
|||
@ -1,7 +0,0 @@ |
|||
namespace EasyAbp.EShop.Products.Options.ProductGroups |
|||
{ |
|||
public interface IProductGroup |
|||
{ |
|||
|
|||
} |
|||
} |
|||
@ -1,94 +1,95 @@ |
|||
using System; |
|||
using EasyAbp.EShop.Orders.Orders; |
|||
using EasyAbp.EShop.Orders.Orders.Dtos; |
|||
using Volo.Abp; |
|||
using Volo.Abp.Data; |
|||
|
|||
namespace EasyAbp.EShop.Orders; |
|||
|
|||
public static class CreateOrderLineDtoExtensions |
|||
public static class CreateOrderLineInfoExtensions |
|||
{ |
|||
public static Guid? FindBookingAssetId(this CreateOrderLineDto orderLine) |
|||
public static Guid? FindBookingAssetId(this ICreateOrderLineInfo orderLine) |
|||
{ |
|||
return orderLine.GetProperty<Guid?>(BookingOrderProperties.OrderLineBookingAssetId); |
|||
} |
|||
|
|||
public static Guid GetBookingAssetId(this CreateOrderLineDto orderLine) |
|||
public static Guid GetBookingAssetId(this ICreateOrderLineInfo orderLine) |
|||
{ |
|||
return Check.NotNull(FindBookingAssetId(orderLine), |
|||
BookingOrderProperties.OrderLineBookingAssetId)!.Value; |
|||
} |
|||
|
|||
public static Guid? FindBookingAssetCategoryId(this CreateOrderLineDto orderLine) |
|||
public static Guid? FindBookingAssetCategoryId(this ICreateOrderLineInfo orderLine) |
|||
{ |
|||
return orderLine.GetProperty<Guid?>(BookingOrderProperties.OrderLineBookingAssetCategoryId); |
|||
} |
|||
|
|||
public static Guid GetBookingAssetCategoryId(this CreateOrderLineDto orderLine) |
|||
public static Guid GetBookingAssetCategoryId(this ICreateOrderLineInfo orderLine) |
|||
{ |
|||
return Check.NotNull(FindBookingAssetCategoryId(orderLine), |
|||
BookingOrderProperties.OrderLineBookingAssetCategoryId)!.Value; |
|||
} |
|||
|
|||
public static Guid? FindBookingPeriodSchemeId(this CreateOrderLineDto orderLine) |
|||
public static Guid? FindBookingPeriodSchemeId(this ICreateOrderLineInfo orderLine) |
|||
{ |
|||
return orderLine.GetProperty<Guid?>(BookingOrderProperties.OrderLineBookingPeriodSchemeId); |
|||
} |
|||
|
|||
public static Guid GetBookingPeriodSchemeId(this CreateOrderLineDto orderLine) |
|||
public static Guid GetBookingPeriodSchemeId(this ICreateOrderLineInfo orderLine) |
|||
{ |
|||
return Check.NotNull(FindBookingPeriodSchemeId(orderLine), |
|||
BookingOrderProperties.OrderLineBookingPeriodSchemeId)!.Value; |
|||
} |
|||
|
|||
public static Guid? FindBookingPeriodId(this CreateOrderLineDto orderLine) |
|||
public static Guid? FindBookingPeriodId(this ICreateOrderLineInfo orderLine) |
|||
{ |
|||
return orderLine.GetProperty<Guid?>(BookingOrderProperties.OrderLineBookingPeriodId); |
|||
} |
|||
|
|||
public static Guid GetBookingPeriodId(this CreateOrderLineDto orderLine) |
|||
public static Guid GetBookingPeriodId(this ICreateOrderLineInfo orderLine) |
|||
{ |
|||
return Check.NotNull(FindBookingPeriodId(orderLine), |
|||
BookingOrderProperties.OrderLineBookingPeriodId)!.Value; |
|||
} |
|||
|
|||
public static int? FindBookingVolume(this CreateOrderLineDto orderLine) |
|||
public static int? FindBookingVolume(this ICreateOrderLineInfo orderLine) |
|||
{ |
|||
return orderLine.Quantity; |
|||
} |
|||
|
|||
public static int GetBookingVolume(this CreateOrderLineDto orderLine) |
|||
public static int GetBookingVolume(this ICreateOrderLineInfo orderLine) |
|||
{ |
|||
return FindBookingVolume(orderLine)!.Value; |
|||
} |
|||
|
|||
public static DateTime? FindBookingDate(this CreateOrderLineDto orderLine) |
|||
public static DateTime? FindBookingDate(this ICreateOrderLineInfo orderLine) |
|||
{ |
|||
return orderLine.FindDateTimeProperty(BookingOrderProperties.OrderLineBookingDate); |
|||
} |
|||
|
|||
public static DateTime GetBookingDate(this CreateOrderLineDto orderLine) |
|||
public static DateTime GetBookingDate(this ICreateOrderLineInfo orderLine) |
|||
{ |
|||
return Check.NotNull(FindBookingDate(orderLine), |
|||
BookingOrderProperties.OrderLineBookingDate)!.Value; |
|||
} |
|||
|
|||
public static TimeSpan? FindBookingStartingTime(this CreateOrderLineDto orderLine) |
|||
public static TimeSpan? FindBookingStartingTime(this ICreateOrderLineInfo orderLine) |
|||
{ |
|||
return orderLine.FindTimeSpanProperty(BookingOrderProperties.OrderLineBookingStartingTime); |
|||
} |
|||
|
|||
public static TimeSpan GetBookingStartingTime(this CreateOrderLineDto orderLine) |
|||
public static TimeSpan GetBookingStartingTime(this ICreateOrderLineInfo orderLine) |
|||
{ |
|||
return Check.NotNull(FindBookingStartingTime(orderLine), |
|||
BookingOrderProperties.OrderLineBookingStartingTime)!.Value; |
|||
} |
|||
|
|||
public static TimeSpan? FindBookingDuration(this CreateOrderLineDto orderLine) |
|||
public static TimeSpan? FindBookingDuration(this ICreateOrderLineInfo orderLine) |
|||
{ |
|||
return orderLine.FindTimeSpanProperty(BookingOrderProperties.OrderLineBookingDuration); |
|||
} |
|||
|
|||
public static TimeSpan GetBookingDuration(this CreateOrderLineDto orderLine) |
|||
public static TimeSpan GetBookingDuration(this ICreateOrderLineInfo orderLine) |
|||
{ |
|||
return Check.NotNull(FindBookingDuration(orderLine), |
|||
BookingOrderProperties.OrderLineBookingDuration)!.Value; |
|||
File diff suppressed because it is too large
@ -0,0 +1,74 @@ |
|||
using System; |
|||
using Microsoft.EntityFrameworkCore.Migrations; |
|||
|
|||
#nullable disable |
|||
|
|||
namespace EShopSample.Migrations |
|||
{ |
|||
/// <inheritdoc />
|
|||
public partial class RefactordOrderAndSomeOthers : Migration |
|||
{ |
|||
/// <inheritdoc />
|
|||
protected override void Up(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.AddColumn<TimeSpan>( |
|||
name: "PaymentExpireIn", |
|||
table: "EasyAbpEShopProductsProductViews", |
|||
type: "time", |
|||
nullable: true); |
|||
|
|||
migrationBuilder.AddColumn<string>( |
|||
name: "DisplayName", |
|||
table: "EasyAbpEShopPaymentsRefundItemOrderExtraFees", |
|||
type: "nvarchar(max)", |
|||
nullable: true); |
|||
|
|||
migrationBuilder.AddColumn<string>( |
|||
name: "DisplayName", |
|||
table: "EasyAbpEShopOrdersOrderExtraFees", |
|||
type: "nvarchar(max)", |
|||
nullable: true); |
|||
|
|||
migrationBuilder.CreateTable( |
|||
name: "EasyAbpEShopOrdersOrderDiscounts", |
|||
columns: table => new |
|||
{ |
|||
OrderId = table.Column<Guid>(type: "uniqueidentifier", nullable: false), |
|||
OrderLineId = table.Column<Guid>(type: "uniqueidentifier", nullable: false), |
|||
Name = table.Column<string>(type: "nvarchar(450)", nullable: false), |
|||
Key = table.Column<string>(type: "nvarchar(450)", nullable: false), |
|||
DisplayName = table.Column<string>(type: "nvarchar(max)", nullable: true), |
|||
DiscountedAmount = table.Column<decimal>(type: "decimal(20,8)", nullable: false) |
|||
}, |
|||
constraints: table => |
|||
{ |
|||
table.PrimaryKey("PK_EasyAbpEShopOrdersOrderDiscounts", x => new { x.OrderId, x.OrderLineId, x.Name, x.Key }); |
|||
table.ForeignKey( |
|||
name: "FK_EasyAbpEShopOrdersOrderDiscounts_EasyAbpEShopOrdersOrders_OrderId", |
|||
column: x => x.OrderId, |
|||
principalTable: "EasyAbpEShopOrdersOrders", |
|||
principalColumn: "Id", |
|||
onDelete: ReferentialAction.Cascade); |
|||
}); |
|||
} |
|||
|
|||
/// <inheritdoc />
|
|||
protected override void Down(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.DropTable( |
|||
name: "EasyAbpEShopOrdersOrderDiscounts"); |
|||
|
|||
migrationBuilder.DropColumn( |
|||
name: "PaymentExpireIn", |
|||
table: "EasyAbpEShopProductsProductViews"); |
|||
|
|||
migrationBuilder.DropColumn( |
|||
name: "DisplayName", |
|||
table: "EasyAbpEShopPaymentsRefundItemOrderExtraFees"); |
|||
|
|||
migrationBuilder.DropColumn( |
|||
name: "DisplayName", |
|||
table: "EasyAbpEShopOrdersOrderExtraFees"); |
|||
} |
|||
} |
|||
} |
|||
Loading…
Reference in new issue