From 57858277481e130871aaefc03736bcc52c6d899b Mon Sep 17 00:00:00 2001 From: YunaiV <> Date: Sat, 20 Apr 2019 19:59:08 +0800 Subject: [PATCH] =?UTF-8?q?=E5=89=8D=E7=AB=AF=20+=20=E5=90=8E=E7=AB=AF?= =?UTF-8?q?=EF=BC=9A=E5=88=9B=E5=BB=BA=E8=AE=A2=E5=8D=95=EF=BC=8C=E6=8E=A5?= =?UTF-8?q?=E5=85=A5=E4=BB=B7=E6=A0=BC=E8=AE=A1=E7=AE=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mobile-web/src/api/order.js | 3 +- mobile-web/src/page/shipping/order.vue | 4 +- .../users/UsersOrderController.java | 3 +- .../application/convert/OrderConvertAPP.java | 8 +- .../application/po/user/OrderCreatePO.java | 4 + .../mall/order/api/bo/CalcOrderPriceBO.java | 2 +- .../mall/order/api/dto/OrderCreateDTO.java | 5 ++ .../iocoder/mall/order/biz/OrderCommon.java | 39 --------- .../mall/order/biz/OrderCommonImpl.java | 54 ------------- .../mall/order/biz/dataobject/OrderDO.java | 18 ++++- .../order/biz/dataobject/OrderItemDO.java | 16 ---- .../order/biz/service/OrderServiceImpl.java | 81 ++++++++++++------- .../main/resources/mapper/OrderItemMapper.xml | 27 ++++--- .../src/main/resources/mapper/OrderMapper.xml | 30 +++---- 14 files changed, 119 insertions(+), 175 deletions(-) delete mode 100644 order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/OrderCommon.java delete mode 100644 order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/OrderCommonImpl.java diff --git a/mobile-web/src/api/order.js b/mobile-web/src/api/order.js index bcd52f71b..95bce2831 100644 --- a/mobile-web/src/api/order.js +++ b/mobile-web/src/api/order.js @@ -59,13 +59,14 @@ export function getOrderInfo(orderId) { // Cart -export function createOrderFromCart(userAddressId, remark) { +export function createOrderFromCart(userAddressId, couponCardId, remark) { return request({ url: '/order-api/users/order/create_order_from_cart', method: 'post', params: { userAddressId, remark, + couponCardId, } }); } diff --git a/mobile-web/src/page/shipping/order.vue b/mobile-web/src/page/shipping/order.vue index 7ac160792..641500065 100644 --- a/mobile-web/src/page/shipping/order.vue +++ b/mobile-web/src/page/shipping/order.vue @@ -161,12 +161,14 @@ } const remark = ''; + const couponCardId = this.chosenCoupon >= 0 ? this.coupons[this.chosenCoupon].id : undefined; if (this.from === 'direct_order') { const { skuId, quantity } = this.$route.query; const orderItems = [{ skuId, quantity, + couponCardId, }]; createOrder({ orderItems, @@ -184,7 +186,7 @@ } }); } else if (this.from === 'cart') { - createOrderFromCart(userAddressId, remark).then(result => { + createOrderFromCart(userAddressId, couponCardId, remark).then(result => { if (result) { // const { orderNo } = result; this.$router.push({ //核心语句 diff --git a/order/order-application/src/main/java/cn/iocoder/mall/order/application/controller/users/UsersOrderController.java b/order/order-application/src/main/java/cn/iocoder/mall/order/application/controller/users/UsersOrderController.java index c376725a8..911051198 100644 --- a/order/order-application/src/main/java/cn/iocoder/mall/order/application/controller/users/UsersOrderController.java +++ b/order/order-application/src/main/java/cn/iocoder/mall/order/application/controller/users/UsersOrderController.java @@ -67,6 +67,7 @@ public class UsersOrderController { @PostMapping("create_order_from_cart") @ApiOperation("创建订单购物车") public CommonResult createOrderFromCart(@RequestParam("userAddressId") Integer userAddressId, + @RequestParam(value = "couponCardId", required = false) Integer couponCardId, @RequestParam(value = "remark", required = false) String remark, HttpServletRequest request) { Integer userId = UserSecurityContextHolder.getContext().getUserId(); @@ -78,7 +79,7 @@ public class UsersOrderController { // 创建 OrderCreateDTO 对象 OrderCreateDTO orderCreateDTO = OrderConvertAPP.INSTANCE.createOrderCreateDTO(userId, userAddressId, remark, HttpUtil.getIp(request), - cartItems); + cartItems, couponCardId); // 创建订单 CommonResult createResult= orderService.createOrder(orderCreateDTO); if (createResult.isError()) { diff --git a/order/order-application/src/main/java/cn/iocoder/mall/order/application/convert/OrderConvertAPP.java b/order/order-application/src/main/java/cn/iocoder/mall/order/application/convert/OrderConvertAPP.java index 66c15b9b9..97a337e0c 100644 --- a/order/order-application/src/main/java/cn/iocoder/mall/order/application/convert/OrderConvertAPP.java +++ b/order/order-application/src/main/java/cn/iocoder/mall/order/application/convert/OrderConvertAPP.java @@ -40,15 +40,15 @@ public interface OrderConvertAPP { @Mappings({}) List convert(List cartItems); - default OrderCreateDTO createOrderCreateDTO(Integer userId, Integer userAddressId, - String remark, String ip, - List cartItems) { + default OrderCreateDTO createOrderCreateDTO(Integer userId, Integer userAddressId, String remark, String ip, + List cartItems, Integer couponCardId) { return new OrderCreateDTO() .setUserId(userId) .setUserAddressId(userAddressId) .setRemark(remark) .setIp(ip) - .setOrderItems(this.convert(cartItems)); + .setOrderItems(this.convert(cartItems)) + .setCouponCardId(couponCardId); } } diff --git a/order/order-application/src/main/java/cn/iocoder/mall/order/application/po/user/OrderCreatePO.java b/order/order-application/src/main/java/cn/iocoder/mall/order/application/po/user/OrderCreatePO.java index b7ada94b1..f88ddf24d 100644 --- a/order/order-application/src/main/java/cn/iocoder/mall/order/application/po/user/OrderCreatePO.java +++ b/order/order-application/src/main/java/cn/iocoder/mall/order/application/po/user/OrderCreatePO.java @@ -24,6 +24,10 @@ public class OrderCreatePO implements Serializable { */ @NotNull(message = "用户地址id不能为空!") private Integer userAddressId; + /** + * 优惠劵编号 + */ + private Integer couponCardId; /** * 备注 */ diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/CalcOrderPriceBO.java b/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/CalcOrderPriceBO.java index 98d8f68e1..2dd378cfd 100644 --- a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/CalcOrderPriceBO.java +++ b/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/CalcOrderPriceBO.java @@ -142,7 +142,7 @@ public class CalcOrderPriceBO { */ private Integer discountTotal; /** - * 邮费 + * 邮费 TODO 芋艿,将 postage 改成 logistics */ private Integer postageTotal; /** diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/dto/OrderCreateDTO.java b/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/dto/OrderCreateDTO.java index c8d51649b..77cf6d4f2 100644 --- a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/dto/OrderCreateDTO.java +++ b/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/dto/OrderCreateDTO.java @@ -24,6 +24,10 @@ public class OrderCreateDTO implements Serializable { * 用户地址 */ private Integer userAddressId; + /** + * 优惠劵编号 + */ + private Integer couponCardId; /** * 备注 */ @@ -37,4 +41,5 @@ public class OrderCreateDTO implements Serializable { /// order item private List orderItems; + } diff --git a/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/OrderCommon.java b/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/OrderCommon.java deleted file mode 100644 index 1099d0602..000000000 --- a/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/OrderCommon.java +++ /dev/null @@ -1,39 +0,0 @@ -package cn.iocoder.mall.order.biz; - -import cn.iocoder.mall.order.biz.dataobject.OrderItemDO; - -import java.util.List; - -/** - * 订单常用 - * - * @author Sin - * @time 2019-03-23 11:51 - */ -public interface OrderCommon { - - - /** - * 计算总价格 - * - * @param items - * @return - */ - Integer calculatedPrice(List items); - - /** - * 计算订单实付金额 - * - * @param items - * @return - */ - Integer calculatedAmount(List items); - - /** - * 计算物流金额 - * - * @param items - * @return - */ - Integer calculatedLogisticsPrice(List items); -} diff --git a/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/OrderCommonImpl.java b/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/OrderCommonImpl.java deleted file mode 100644 index fb5490618..000000000 --- a/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/OrderCommonImpl.java +++ /dev/null @@ -1,54 +0,0 @@ -package cn.iocoder.mall.order.biz; - -import cn.iocoder.mall.order.biz.dataobject.OrderItemDO; -import org.springframework.stereotype.Component; -import org.springframework.util.CollectionUtils; - -import java.util.List; -import java.util.concurrent.atomic.AtomicInteger; - -/** - * 订单常用 - * - * @author Sin - * @time 2019-03-23 11:53 - */ -@Component -public class OrderCommonImpl implements OrderCommon { - - @Override - public Integer calculatedPrice(List items) { - if (CollectionUtils.isEmpty(items)) { - return 0; - } - AtomicInteger totalPrice = new AtomicInteger(0); - items.forEach(orderItemDO -> { - totalPrice.addAndGet(orderItemDO.getPrice() * orderItemDO.getQuantity()); - }); - return totalPrice.get(); - } - - @Override - public Integer calculatedAmount(List items) { - if (CollectionUtils.isEmpty(items)) { - return 0; - } - AtomicInteger totalAmount = new AtomicInteger(0); - items.forEach(orderItemDO -> { - totalAmount.addAndGet(orderItemDO.getPayAmount() * orderItemDO.getQuantity()); - }); - return totalAmount.get(); - } - - @Override - public Integer calculatedLogisticsPrice(List items) { - if (CollectionUtils.isEmpty(items)) { - return 0; - } - AtomicInteger totalAmount = new AtomicInteger(0); - items.forEach(orderItemDO -> { - totalAmount.addAndGet(orderItemDO.getLogisticsPrice()); - }); - return totalAmount.get(); - } -} diff --git a/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/dataobject/OrderDO.java b/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/dataobject/OrderDO.java index 37dc7a3b4..f16e9b7a1 100644 --- a/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/dataobject/OrderDO.java +++ b/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/dataobject/OrderDO.java @@ -29,15 +29,27 @@ public class OrderDO extends DeletableDO { */ private String orderNo; /** - * 价格(分) + * 购买(商品)总金额,单位:分 */ - private Integer price; + private Integer buyPrice; + /** + * 优惠总金额,单位:分。 + */ + private Integer discountPrice; /** * 物流金额 (分) */ private Integer logisticsPrice; /** - * 交易金额 + * 最终金额,单位:分 + * + * buyPrice + logisticsPrice - discountPrice = presentPrice + */ + private Integer presentPrice; + /** + * 实际已支付金额,单位:分 + * + * 初始时,金额为 0 。等到支付成功后,会进行更新。 */ private Integer payAmount; diff --git a/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/dataobject/OrderItemDO.java b/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/dataobject/OrderItemDO.java index a096954a8..4bf5da309 100644 --- a/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/dataobject/OrderItemDO.java +++ b/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/dataobject/OrderItemDO.java @@ -48,22 +48,6 @@ public class OrderItemDO extends DeletableDO { * 数量 */ private Integer quantity; - /** - * 商品成交单价(分) - */ - @Deprecated - private Integer price; - /** - * 支付金额(实付金额) - */ - @Deprecated - private Integer payAmount; - /** - * 物流金额 (分) - */ - @Deprecated - private Integer logisticsPrice; - /** * 原始单价,单位:分。 */ diff --git a/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/service/OrderServiceImpl.java b/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/service/OrderServiceImpl.java index cee62374d..a8c9a3c3b 100644 --- a/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/service/OrderServiceImpl.java +++ b/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/service/OrderServiceImpl.java @@ -9,7 +9,6 @@ import cn.iocoder.mall.order.api.constant.OrderErrorCodeEnum; import cn.iocoder.mall.order.api.constant.OrderHasReturnExchangeEnum; import cn.iocoder.mall.order.api.constant.OrderStatusEnum; import cn.iocoder.mall.order.api.dto.*; -import cn.iocoder.mall.order.biz.OrderCommon; import cn.iocoder.mall.order.biz.constants.OrderDeliveryTypeEnum; import cn.iocoder.mall.order.biz.constants.OrderRecipientTypeEnum; import cn.iocoder.mall.order.biz.convert.*; @@ -25,6 +24,7 @@ import com.google.common.collect.Lists; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.Assert; import org.springframework.util.CollectionUtils; import java.util.*; @@ -57,11 +57,11 @@ public class OrderServiceImpl implements OrderService { private OrderRecipientMapper orderRecipientMapper; @Autowired private OrderCancelMapper orderCancelMapper; - @Autowired - private OrderCommon orderCommon; @Reference private ProductSpuService productSpuService; + @Autowired + private CartServiceImpl cartService; @Reference private UserAddressService userAddressService; @Reference @@ -196,61 +196,70 @@ public class OrderServiceImpl implements OrderService { // 获取商品信息 Set skuIds = orderItemDOList.stream() .map(orderItemDO -> orderItemDO.getSkuId()).collect(Collectors.toSet()); - CommonResult> productResult = productSpuService.getProductSkuDetailList(skuIds); // 校验商品信息 if (productResult.isError()) { return ServiceExceptionUtil.error(OrderErrorCodeEnum.ORDER_GET_SKU_FAIL.getCode()); } - if (productResult.getData() == null) { return ServiceExceptionUtil.error(OrderErrorCodeEnum.ORDER_GET_SKU_NOT_EXISTENT.getCode()); } - if (orderItemDTOList.size() != productResult.getData().size()) { return ServiceExceptionUtil.error(OrderErrorCodeEnum.ORDER_GET_GOODS_INFO_INCORRECT.getCode()); } - // + // 价格计算 + CommonResult calcOrderPriceResult = calcOrderPrice(productResult.getData(), orderCreateDTO); + if (calcOrderPriceResult.isError()) { + return CommonResult.error(calcOrderPriceResult); + } + CalcOrderPriceBO calcOrderPrice = calcOrderPriceResult.getData(); // 设置 orderItem - Map productSpuBOMap = productResult.getData() - .stream().collect(Collectors.toMap(o -> o.getId(), o -> o)); + .stream().collect(Collectors.toMap(ProductSkuDetailBO::getId, o -> o)); // 商品 SKU 信息的集合 + Map priceItemMap = new HashMap<>(); + calcOrderPrice.getItemGroups().forEach(itemGroup -> + itemGroup.getItems().forEach(item -> priceItemMap.put(item.getId(), item))); for (OrderItemDO orderItemDO : orderItemDOList) { ProductSkuDetailBO productSkuDetailBO = productSpuBOMap.get(orderItemDO.getSkuId()); if (productSkuDetailBO.getQuantity() <= 0) { return ServiceExceptionUtil.error(OrderErrorCodeEnum.ORDER_INSUFFICIENT_INVENTORY.getCode()); } - if (productSkuDetailBO.getPrice() <= 0) { return ServiceExceptionUtil.error(OrderErrorCodeEnum.ORDER_GOODS_AMOUNT_INCORRECT.getCode()); } - + // 设置 SKU 信息 orderItemDO.setSkuImage(Optional.ofNullable(productSkuDetailBO.getSpu().getPicUrls().get(0)).get()); orderItemDO.setSkuName(productSkuDetailBO.getSpu().getName()); - orderItemDO.setPrice(productSkuDetailBO.getPrice()); - orderItemDO.setLogisticsPrice(0); - - int payAmount = orderItemDO.getQuantity() * orderItemDO.getPrice(); - orderItemDO.setPayAmount(payAmount); + // 设置价格信息 + CalcOrderPriceBO.Item priceItem = priceItemMap.get(orderItemDO.getSkuId()); + Assert.notNull(priceItem, "商品计算价格为空"); + orderItemDO.setOriginPrice(priceItem.getOriginPrice()) + .setBuyPrice(priceItem.getBuyPrice()) + .setPresentPrice(priceItem.getPresentPrice()) + .setBuyTotal(priceItem.getBuyTotal()) + .setDiscountTotal(priceItem.getDiscountTotal()) + .setPresentTotal(priceItem.getPresentTotal()); } // order // TODO: 2019-04-11 Sin 订单号需要生成规则 String orderNo = UUID.randomUUID().toString().replace("-", "").substring(0, 16); - Integer totalAmount = orderCommon.calculatedAmount(orderItemDOList); - Integer totalPrice = orderCommon.calculatedPrice(orderItemDOList); - Integer totalLogisticsPrice = orderCommon.calculatedLogisticsPrice(orderItemDOList); +// Integer totalAmount = orderCommon.calculatedAmount(orderItemDOList); +// Integer totalPrice = orderCommon.calculatedPrice(orderItemDOList); +// Integer totalLogisticsPrice = orderCommon.calculatedLogisticsPrice(orderItemDOList); OrderDO orderDO = new OrderDO() .setUserId(userId) .setOrderNo(orderNo) - .setPrice(totalPrice) - .setPayAmount(totalAmount) - .setLogisticsPrice(totalLogisticsPrice) + .setBuyPrice(calcOrderPrice.getFee().getBuyTotal()) + .setDiscountPrice(calcOrderPrice.getFee().getDiscountTotal()) + .setLogisticsPrice(calcOrderPrice.getFee().getPostageTotal()) + .setPresentPrice(calcOrderPrice.getFee().getPresentTotal()) + .setPayAmount(0) .setClosingTime(null) .setDeliveryTime(null) .setPaymentTime(null) @@ -330,6 +339,19 @@ public class OrderServiceImpl implements OrderService { ); } + private CommonResult calcOrderPrice(List skus, OrderCreateDTO orderCreateDTO) { + // 创建计算的 DTO + CalcOrderPriceDTO calcOrderPriceDTO = new CalcOrderPriceDTO() + .setUserId(orderCreateDTO.getUserId()) + .setItems(new ArrayList<>(skus.size())) + .setCouponCardId(orderCreateDTO.getCouponCardId()); + for (ProductSkuDetailBO item : skus) { + calcOrderPriceDTO.getItems().add(new CalcOrderPriceDTO.Item(item.getId(), item.getQuantity(), true)); + } + // 执行计算 + return cartService.calcOrderPrice(calcOrderPriceDTO); + } + @Override public CommonResult updateOrderItem(OrderItemUpdateDTO orderUpdateDTO) { OrderItemDO orderItemDO = OrderItemConvert.INSTANCE.convert(orderUpdateDTO); @@ -352,17 +374,21 @@ public class OrderServiceImpl implements OrderService { } // 先更新金额 - orderItemMapper.updateById(new OrderItemDO().setId(orderItemId).setPayAmount(payAmount)); + orderItemMapper.updateById(new OrderItemDO().setId(orderItemId) +// .setPayAmount(payAmount) TODO 芋艿,这里要修改 + ); // 再重新计算订单金额 List orderItemDOList = orderItemMapper .selectByDeletedAndOrderId(orderId, DeletedStatusEnum.DELETED_NO.getValue()); - Integer price = orderCommon.calculatedPrice(orderItemDOList); - Integer amount = orderCommon.calculatedAmount(orderItemDOList); +// Integer price = orderCommon.calculatedPrice(orderItemDOList); +// Integer amount = orderCommon.calculatedAmount(orderItemDOList); + Integer price = -1; // TODO 芋艿,这里要修改,价格 + Integer amount = -1; orderMapper.updateById( new OrderDO() .setId(orderId) - .setPrice(price) +// .setPrice(price) TODO 芋艿,这里要修改 .setPayAmount(amount) ); return CommonResult.success(null); @@ -495,7 +521,8 @@ public class OrderServiceImpl implements OrderService { ); // 更新订单 amount - Integer totalAmount = orderCommon.calculatedAmount(effectiveOrderItems); +// Integer totalAmount = orderCommon.calculatedAmount(effectiveOrderItems); + Integer totalAmount = -1; // TODO 芋艿,需要修改下,价格相关 orderMapper.updateById( new OrderDO() .setId(orderId) diff --git a/order/order-service-impl/src/main/resources/mapper/OrderItemMapper.xml b/order/order-service-impl/src/main/resources/mapper/OrderItemMapper.xml index 6554ec224..d6aaa4b2f 100644 --- a/order/order-service-impl/src/main/resources/mapper/OrderItemMapper.xml +++ b/order/order-service-impl/src/main/resources/mapper/OrderItemMapper.xml @@ -4,7 +4,7 @@ id, order_id, order_no, sku_id, sku_name, sku_image, order_logistics_id, - quantity, price, pay_amount, + quantity, origin_price, buy_price, present_price, buy_total, discount_total, present_total, payment_time, delivery_time, receiver_time, closing_time, has_return_exchange, delivery_type, status, create_time, update_time, deleted @@ -13,20 +13,20 @@ - + INSERT INTO `order_item` ( order_id, order_no, sku_id, sku_name, sku_image, order_logistics_id, - quantity, price, pay_amount, + quantity, origin_price, buy_price, present_price, buy_total, discount_total, present_total, payment_time, delivery_time, receiver_time, closing_time, has_return_exchange, delivery_type, status, create_time, update_time, deleted ) VALUES - - #{item.orderId}, #{item.orderNo}, #{item.skuId}, #{item.skuName}, #{item.skuImage}, #{item.orderLogisticsId}, - #{item.quantity}, #{item.price}, #{item.payAmount}, + + (#{item.orderId}, #{item.orderNo}, #{item.skuId}, #{item.skuName}, #{item.skuImage}, #{item.orderLogisticsId}, + #{item.quantity}, #{item.originPrice}, #{item.buyPrice}, #{item.presentPrice}, #{item.buyTotal}, #{item.discountTotal}, #{item.presentTotal}, #{item.paymentTime}, #{item.deliveryTime}, #{item.receiverTime}, #{item.closingTime}, #{item.hasReturnExchange}, #{item.deliveryType}, #{item.status}, - #{item.createTime}, #{item.updateTime}, #{item.deleted} + #{item.createTime}, #{item.updateTime}, #{item.deleted}) @@ -56,12 +56,13 @@ , quantity = #{orderItemDO.quantity} - - , price = #{orderItemDO.price} - - - , pay_amount = #{orderItemDO.payAmount} - + + + + + + + , payment_time = #{orderItemDO.paymentTime} diff --git a/order/order-service-impl/src/main/resources/mapper/OrderMapper.xml b/order/order-service-impl/src/main/resources/mapper/OrderMapper.xml index 1a66e6c44..5901f507a 100644 --- a/order/order-service-impl/src/main/resources/mapper/OrderMapper.xml +++ b/order/order-service-impl/src/main/resources/mapper/OrderMapper.xml @@ -3,7 +3,7 @@ - id, user_id, order_no, price, pay_amount, logistics_price, + id, user_id, order_no, buy_price, discount_price, logistics_price, present_price, pay_amount, payment_time, delivery_time, receiver_time, closing_time, has_return_exchange, status, remark, create_time, update_time, `deleted` @@ -14,12 +14,12 @@ --> INSERT INTO `order` ( - user_id, order_no, price, pay_amount, logistics_price, + user_id, order_no, buy_price, discount_price, logistics_price, present_price, pay_amount, payment_time, delivery_time, receiver_time, closing_time, has_return_exchange, status, remark, create_time, update_time, `deleted` ) VALUES ( - #{userId}, #{orderNo}, #{price}, #{payAmount}, #{logisticsPrice}, + #{userId}, #{orderNo}, #{buyPrice}, #{discountPrice}, #{logisticsPrice}, #{presentPrice}, #{payAmount}, #{paymentTime}, #{deliveryTime}, #{receiverTime}, #{closingTime}, #{hasReturnExchange}, #{status}, #{remark}, #{createTime}, #{updateTime}, #{deleted} @@ -34,15 +34,15 @@ , order_no = #{orderNo} - - , price = #{price} - - - , pay_amount = #{payAmount} - - - , logistics_price = #{logisticsPrice} - + + + + + + + + + , payment_time = #{paymentTime} @@ -129,7 +129,7 @@ SELECT COUNT(*) FROM `order` - WHERE 1 = 1 + WHERE 1 = 1 @@ -140,10 +140,10 @@ SELECT FROM `order` - WHERE 1 = 1 + WHERE 1 = 1 LIMIT ${pageNo * pageSize}, ${pageSize} - \ No newline at end of file +