- orderItem insert 改为批量插入

This commit is contained in:
sin 2019-04-19 20:26:43 +08:00
parent 7277ecb2d4
commit c6883c7531
3 changed files with 13 additions and 10 deletions

View File

@ -20,9 +20,9 @@ public interface OrderItemMapper {
/**
* 插入数据
*
* @param orderItemDO
* @param orderItemDOList
*/
void insert(OrderItemDO orderItemDO);
void insert(@Param("list") List<OrderItemDO> orderItemDOList);
/**
* 更新 - 根据Id

View File

@ -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();

View File

@ -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
<foreach collection="list" item="item" separator="," open="(" close=")">
#{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}
</foreach>
</insert>
<!--