diff --git a/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/dao/OrderItemMapper.java b/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/dao/OrderItemMapper.java index c954673cf..d6ad2f35a 100644 --- a/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/dao/OrderItemMapper.java +++ b/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/dao/OrderItemMapper.java @@ -20,9 +20,9 @@ public interface OrderItemMapper { /** * 插入数据 * - * @param orderItemDO + * @param orderItemDOList */ - void insert(OrderItemDO orderItemDO); + void insert(@Param("list") List orderItemDOList); /** * 更新 - 根据Id 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 6867b13a4..cee62374d 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 @@ -295,9 +295,11 @@ public class OrderServiceImpl implements OrderService { .setDeleted(DeletedStatusEnum.DELETED_NO.getValue()) .setCreateTime(new Date()) .setUpdateTime(null); - orderItemMapper.insert(orderItemDO); // TODO 芋艿,需要改成一次性插入 }); + // 一次性插入 + orderItemMapper.insert(orderItemDOList); + // 创建预订单 // TODO sin 支付订单 orderSubject 暂时取第一个子订单商品信息 // String orderSubject = orderItemDOList.get(0).getSkuName(); 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 8d6fe7a1d..6554ec224 100644 --- a/order/order-service-impl/src/main/resources/mapper/OrderItemMapper.xml +++ b/order/order-service-impl/src/main/resources/mapper/OrderItemMapper.xml @@ -20,13 +20,14 @@ payment_time, delivery_time, receiver_time, closing_time, has_return_exchange, delivery_type, status, create_time, update_time, deleted - ) VALUES ( - #{orderId}, #{orderNo}, #{skuId}, #{skuName}, #{skuImage}, #{orderLogisticsId}, - #{quantity}, #{price}, #{payAmount}, - #{paymentTime}, #{deliveryTime}, #{receiverTime}, #{closingTime}, - #{hasReturnExchange}, #{deliveryType}, #{status}, - #{createTime}, #{updateTime}, #{deleted} - ) + ) VALUES + + #{item.orderId}, #{item.orderNo}, #{item.skuId}, #{item.skuName}, #{item.skuImage}, #{item.orderLogisticsId}, + #{item.quantity}, #{item.price}, #{item.payAmount}, + #{item.paymentTime}, #{item.deliveryTime}, #{item.receiverTime}, #{item.closingTime}, + #{item.hasReturnExchange}, #{item.deliveryType}, #{item.status}, + #{item.createTime}, #{item.updateTime}, #{item.deleted} +