a.`orderProductID` AS `orderProductID`, a.`orderNo` AS `orderNo`, a.`orderID` AS `orderID`, a.`shopOrderID` AS `shopOrderID`, a.`shopOrderNo` AS `shopOrderNo`, a.`shopID` AS `shopID`, a.`productID` AS `productID`, a.`num` AS `num`, a.`presentNum` AS `presentNum`, a.`outStoreType` AS `outStoreType`, a.`skuID` AS `skuID`, a.`props` AS `props`, a.`propName` AS `propName`, a.`productNo` AS `productNo`, a.`price` AS `price`, a.`normalPrice` AS `normalPrice`, a.`totalAmount` AS `totalAmount`, a.`totalFee` AS `totalFee`, a.`shouldPayFee` AS `shouldPayFee`, a.`discount` AS `discount`, a.`discountPrice` AS `discountPrice`, a.`ladderPriceFlag` AS `ladderPriceFlag`, a.`taxRate` AS `taxRate`, a.`addedValueTax` AS `addedValueTax`, a.`totalAddedValueTax` AS `totalAddedValueTax`, IFNULL(a.`includedTax`, 2) AS `includedTax`, IFNULL(a.`invoiceType`, 3) AS `invoiceType`, IFNULL(a.`supplierTaxRate`, 0) AS `supplierTaxRate`, IFNULL(a.`singleShouldPayTotalTax`, 0) AS `singleShouldPayTotalTax`, IFNULL(a.`shouldPayTotalTax` ,0) AS `shouldPayTotalTax`, a.`shopFee` AS `shopFee`, a.`otherFee` AS `otherFee`, a.`cmFee` AS `cmFee`, a.`singleShopFee` AS `singleShopFee`, a.`singleOtherFee` AS `singleOtherFee`, a.`singleCmFee` AS `singleCmFee`, a.`status` AS `status`, a.`totalBeans` AS `totalBeans`, a.`useBalanceAmount` AS `useBalanceAmount`, a.`useBeanAmount` AS `useBeanAmount`, a.`notOutStore` AS `notOutStore`, a.`cmbeanPrice` AS `cmbeanPrice`, a.`isActProduct` AS `isActProduct`, a.`isGiftProduct` AS `isGiftProduct`, a.`productActInfo` AS `productActInfo`, a.`buyAgainFlag` AS `buyAgainFlag`, a.`confirmProductFlag` AS `confirmProductFlag`, a.`payStatus` AS `payStatus`, a.`name` AS `name`, p.`unit` AS `unit`, a.`actType` AS `actType`, a.productType AS productType, a.orderPromotionsId AS orderPromotionsId, a.`actPreferential` AS `actPreferential`, a.`preferential` AS `preferential`, (select mainImage from product p where p.productID = a.productID) AS image, a.`discountFee` AS `discountFee`, a.`productUnit` AS `productUnit`, a.`productImage` AS `productImage`, a.`shopName` AS `shopName`, p.costProportional AS costProportional, p.stock AS stock, p.costCheckFlag AS costCheckFlag, p.costPrice AS costPrice, a.costPrice as newCostPrice, p.aliasName AS aliasName, a.singleShouldPayTotalTax AS singleShouldPayTotalTax, a.heUserId AS heUserId, p.productCategory as "productCategory", a.svipPriceFlag, a.svipPriceType, a.svipDiscount, a.svipReduction LEFT JOIN product p ON p.productID = a.productID INSERT INTO cm_order_product( productType, orderID, orderNo, shopOrderID, shopOrderNo, shopID, productID, num, presentNum, outStoreType, skuID, props, propName, productNo, price, totalAmount, discount, discountPrice, costPrice, includedTax, invoiceType, taxRate, supplierTaxRate, addedValueTax, totalAddedValueTax, shouldPayTotalTax, shopProductAmount, shopFee, otherFee, cmFee, singleShopFee, singleOtherFee, singleCmFee, shouldPayFee, normalPrice, totalFee, totalBeans, useBalanceAmount, useBeanAmount, notOutStore, cmbeanPrice, isGiftProduct, productActInfo, buyAgainFlag, confirmProductFlag, shopName, name, preferential, productUnit, productImage, discountFee, payStatus, status, singleShouldPayTotalTax, orderPromotionsId, ladderPriceFlag, svipPriceFlag, svipPriceType, svipDiscount, svipReduction ) VALUES ( #{productType}, #{orderID}, #{orderNo}, #{shopOrderID}, #{shopOrderNo}, #{shopID}, #{productID}, #{num}, #{presentNum}, #{outStoreType}, #{skuID}, #{props}, #{propName}, #{productNo}, #{price}, #{totalAmount}, #{discount}, #{discountPrice}, #{costPrice}, #{includedTax}, #{invoiceType}, #{taxRate}, #{supplierTaxRate}, #{addedValueTax}, #{totalAddedValueTax}, #{shouldPayTotalTax}, #{shopProductAmount}, #{shopFee}, #{otherFee}, #{cmFee}, #{singleShopFee}, #{singleOtherFee}, #{singleCmFee}, #{shouldPayFee}, #{normalPrice}, #{totalFee}, #{totalBeans}, #{useBalanceAmount}, #{useBeanAmount}, #{notOutStore}, #{cmbeanPrice}, #{isGiftProduct}, #{productActInfo}, #{buyAgainFlag}, #{confirmProductFlag}, #{shopName}, #{name}, #{preferential}, #{productUnit}, #{productImage}, #{discountFee}, #{payStatus}, #{status}, #{singleShouldPayTotalTax}, #{orderPromotionsId}, #{ladderPriceFlag}, #{svipPriceFlag}, #{svipPriceType}, #{svipDiscount}, #{svipReduction} ) insert into order_product_ladder_price ( orderProductId, ladderNum, buyNum, buyPrice, createDate ) values ( #{orderProductId},#{ladderNum},#{buyNum},#{buyPrice},#{createDate} ) update cm_order_product set payStatus = #{payStatus} where orderID = #{orderID} update cm_order_product set orderNo = #{orderNo,jdbcType=VARCHAR}, orderID = #{orderID,jdbcType=BIGINT}, shopOrderID = #{shopOrderID,jdbcType=INTEGER}, shopOrderNo = #{shopOrderNo,jdbcType=VARCHAR}, shopID = #{shopID,jdbcType=BIGINT}, productID = #{productID,jdbcType=INTEGER}, num = #{num,jdbcType=INTEGER}, presentNum = #{presentNum,jdbcType=INTEGER}, outStoreType = #{outStoreType,jdbcType=CHAR}, skuID = #{skuID,jdbcType=INTEGER}, props = #{props,jdbcType=VARCHAR}, propName = #{propName,jdbcType=VARCHAR}, productNo = #{productNo,jdbcType=VARCHAR}, price = #{price,jdbcType=REAL}, normalPrice = #{normalPrice,jdbcType=REAL}, totalAmount = #{totalAmount,jdbcType=REAL}, discount = #{discount,jdbcType=DECIMAL}, discountPrice = #{discountPrice,jdbcType=DECIMAL}, taxRate = #{taxRate,jdbcType=DECIMAL}, addedValueTax = #{addedValueTax,jdbcType=DECIMAL}, totalAddedValueTax = #{totalAddedValueTax,jdbcType=DECIMAL}, shouldPayTotalTax = #{shouldPayTotalTax,jdbcType=DECIMAL}, shopFee = #{shopFee}, otherFee = #{otherFee}, cmFee = #{cmFee}, singleShopFee = #{singleShopFee,jdbcType=DECIMAL}, singleOtherFee = #{singleOtherFee,jdbcType=DECIMAL}, singleCmFee = #{singleCmFee,jdbcType=DECIMAL}, shouldPayFee = #{shouldPayFee,jdbcType=DECIMAL}, totalFee = #{totalFee,jdbcType=REAL}, totalBeans = #{totalBeans,jdbcType=DECIMAL}, useBalanceAmount = #{useBalanceAmount,jdbcType=VARCHAR}, useBeanAmount = #{useBeanAmount,jdbcType=INTEGER}, notOutStore = #{notOutStore,jdbcType=INTEGER}, cmbeanPrice = #{cmbeanPrice,jdbcType=INTEGER}, isGiftProduct = #{isGiftProduct,jdbcType=VARCHAR}, productActInfo = #{productActInfo,jdbcType=VARCHAR}, buyAgainFlag = #{buyAgainFlag,jdbcType=CHAR}, confirmProductFlag = #{confirmProductFlag,jdbcType=CHAR}, payStatus = #{payStatus,jdbcType=CHAR}, status = #{status}, discountFee = #{discountFee}, shopName = #{shopName,jdbcType=VARCHAR}, name = #{name,jdbcType=VARCHAR}, preferential = #{preferential,jdbcType=INTEGER}, productUnit = #{productUnit,jdbcType=VARCHAR}, productImage = #{productImage,jdbcType=VARCHAR}, singleShouldPayTotalTax = #{singleShouldPayTotalTax,jdbcType=DECIMAL}, productType = #{productType}, orderPromotionsId = #{orderPromotionsId}, costPrice = #{costPrice}, includedTax = #{includedTax}, invoiceType = #{invoiceType}, supplierTaxRate = #{supplierTaxRate}, ladderPriceFlag = #{ladderPriceFlag}, isActProduct = #{isActProduct} where orderProductID = #{orderProductID,jdbcType=INTEGER} update cm_order_product notOutStore = #{notOutStore}, status = #{status}, where orderProductID = #{orderProductID,jdbcType=INTEGER} DELETE FROM cm_order_product WHERE orderProductID = #{orderProductID} DELETE FROM order_product_ladder_price WHERE orderProductId = #{orderProductID} DELETE FROM cm_order_product WHERE orderID=#{orderID} UPDATE cm_order_product SET payStatus = #{payStatus}, status = #{status} WHERE orderProductID = #{orderProductID} UPDATE cm_order_product SET confirmProductFlag = 0 WHERE orderID = #{orderID} UPDATE cm_order_product SET costPrice = #{costPrice}, supplierTaxRate = #{supplierTaxRate}, shouldPayTotalTax = #{shouldPayTotalTax}, singleShouldPayTotalTax = #{singleShouldPayTotalTax} WHERE orderProductID = #{orderProductID}