SubmitMapper.xml 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.caimei365.order.mapper.SubmitMapper">
  4. <insert id="insertMainOrder" keyColumn="orderID" keyProperty="orderId"
  5. parameterType="com.caimei365.order.model.po.OrderPo" useGeneratedKeys="true">
  6. INSERT INTO cm_order (orderSeen, orderSource, orderNo, userID, clubID, organizeID, buyUserID, spID, orderTime,
  7. updateDate,
  8. delFlag,
  9. userBeans, orderType, orderSubmitType, confirmFlag, onlinePayFlag, splitFlag, payFlag,
  10. receiptStatus, payStatus, zeroCostFlag, sendOutStatus, refundType, affirmPaymentFlag,
  11. productCount, presentCount, promotionalGiftsCount, hasActProduct, promotionFullReduction,
  12. svipFullReduction, secondHandOrderFlag, invoiceFlag, freePostFlag, freight,
  13. productTotalFee,
  14. orderTotalFee, payTotalFee, payableAmount, balancePayFee, couponAmount, status,
  15. confirmTime,
  16. payTime, rebateFlag, rebateFee, clauseID, clauseName)
  17. VALUES (#{orderSeen}, #{orderSource}, #{orderNo}, #{userId}, #{clubId}, #{organizeId}, #{buyUserId}, #{spId},
  18. #{orderTime},
  19. #{updateDate},
  20. #{delFlag},
  21. #{userBeans}, #{orderType}, #{orderSubmitType}, #{confirmFlag}, #{onlinePayFlag}, #{splitFlag},
  22. #{payFlag},
  23. #{receiptStatus}, #{payStatus}, #{zeroCostFlag}, #{sendOutStatus}, #{refundType}, #{affirmPaymentFlag},
  24. #{productCount}, #{presentCount}, #{promotionalGiftsCount}, #{hasActProduct}, #{promotionFullReduction},
  25. #{svipFullReduction},
  26. #{secondHandOrderFlag}, #{invoiceFlag}, #{postageFlag}, #{postage}, #{productTotalFee},
  27. #{orderTotalFee},
  28. #{payTotalFee}, #{payableAmount}, #{balancePayFee}, #{couponAmount}, #{status}, #{confirmTime},
  29. #{payTime}, #{rebateFlag}, #{rebateFee},
  30. #{clauseId}, #{clauseName})
  31. </insert>
  32. <insert id="insertShopOrder" keyColumn="shopOrderID" keyProperty="shopOrderId"
  33. parameterType="com.caimei365.order.model.po.OrderShopPo" useGeneratedKeys="true">
  34. INSERT INTO cm_shop_order (onlinePayWays, shopOrderNo, orderID, orderNo, organizeID, isColdChina, shopID, note,
  35. userID, clubID, orderType,
  36. spID, orderPromotionsId, promotionFullReduction, svipShopReduction, brokerage,
  37. canRefundAmount, itemCount, shopStatus, accountAmount, useBalanceFlag,
  38. totalAmount, productAmount, needPayAmount, shopProductAmount, shopPostFee,
  39. shopPostFlag,
  40. shopTaxFee, confirmTime,
  41. shouldPayShopAmount, orderTime, orderSubmitType, splitFlag, payStatus,
  42. payedShopAmount, splitCode, realPay, eachDiscount, receiptStatus)
  43. VALUES (#{onlinePayWays}, #{shopOrderNo}, #{orderId}, #{orderNo}, #{organizeId}, #{isColdChina}, #{shopId},
  44. #{note}, #{userId}, #{clubId}, #{orderType},
  45. #{spId}, #{orderPromotionsId}, #{promotionFullReduction}, #{svipShopReduction}, #{brokerage},
  46. #{canRefundAmount}, #{itemCount}, #{shopStatus}, #{accountAmount}, #{useBalanceFlag},
  47. #{totalAmount}, #{productAmount}, #{needPayAmount}, #{shopProductAmount}, #{shopPostFee},
  48. #{shopPostFlag}, #{shopTaxFee}, #{confirmTime},
  49. #{shouldPayShopAmount}, #{orderTime}, #{orderSubmitType}, #{splitFlag}, #{payStatus},
  50. #{payedShopAmount}, #{splitCode}, #{realPay}, #{eachDiscount}, 1)
  51. </insert>
  52. <update id="updateOrder">
  53. update cm_order
  54. set freight = #{freight}
  55. where orderId = #{orderId}
  56. </update>
  57. <insert id="insertOrderProduct" keyColumn="orderProductID" keyProperty="orderProductId"
  58. parameterType="com.caimei365.order.model.po.OrderProductPo" useGeneratedKeys="true">
  59. INSERT INTO cm_order_product (orderID, orderNo, shopOrderID, shopOrderNo, organizeID, orderPromotionsId,
  60. productId, shopId,
  61. name, organizeCostPrice, cmCostPrice,
  62. productImage, price, shopName, costPrice, normalPrice, ladderPriceFlag,
  63. discountPrice, discount,
  64. totalAmount, totalFee, shouldPayFee, productUnit, num, presentNum, discountFee,
  65. includedTax,
  66. invoiceType, taxRate, addedValueTax, totalAddedValueTax, supplierTaxRate,
  67. singleShouldPayTotalTax, shouldPayTotalTax,
  68. shopProductAmount, singleShopFee, shopFee, singleOtherFee, otherFee, singleCmFee,
  69. cmFee,
  70. payStatus, buyAgainFlag, notOutStore, isActProduct, productType, svipPriceFlag,
  71. svipPriceType,
  72. svipDiscount, svipReduction, skuID, cmPercent, organizePercent, shopPercent)
  73. VALUES (#{orderId}, #{orderNo}, #{shopOrderId}, #{shopOrderNo}, #{organizeId}, #{orderPromotionsId},
  74. #{productId}, #{shopId},
  75. #{name}, #{organizeCostPrice}, #{cmCostPrice},
  76. #{image}, #{price}, #{shopName}, #{costPrice}, #{normalPrice}, #{ladderPriceFlag},
  77. #{discountPrice}, #{discount},
  78. #{totalAmount}, #{totalFee}, #{shouldPayFee}, #{productUnit}, #{num}, #{presentNum}, #{discountFee},
  79. #{includedTax},
  80. #{invoiceType}, #{taxRate}, #{addedValueTax}, #{totalAddedValueTax}, #{shopTaxRate},
  81. #{singleShouldPayTotalTax}, #{shouldPayTotalTax},
  82. #{shopProductAmount}, #{singleShopFee}, #{shopFee}, #{singleOtherFee}, #{otherFee}, #{singleCmFee},
  83. #{cmFee},
  84. #{payStatus}, #{buyAgainFlag}, #{notOutStore}, #{actProduct}, #{productType}, #{svipPriceFlag},
  85. #{svipPriceType}, #{svipDiscount}, #{svipReduction}, #{skuId}, #{cmPercent}, #{organizePercent},
  86. #{shopPercent})
  87. </insert>
  88. <insert id="insertOrderPromotions" keyColumn="id" keyProperty="id"
  89. parameterType="com.caimei365.order.model.vo.PromotionsVo" useGeneratedKeys="true">
  90. INSERT INTO cm_promotions_order (orderId, promotionsId, name, description, type, mode, touchPrice, reducedPrice,
  91. discount, status, beginTime, endTime)
  92. VALUES (#{orderId}, #{id}, #{name}, #{description}, #{type}, #{mode}, #{touchPrice}, #{reducedPrice},
  93. #{discount},
  94. #{status}, #{beginTime}, #{endTime})
  95. </insert>
  96. <insert id="insertLadderPrices" keyColumn="id" keyProperty="id"
  97. parameterType="com.caimei365.order.model.vo.LadderPriceVo" useGeneratedKeys="true">
  98. INSERT INTO order_product_ladder_price (orderProductId, ladderNum, buyNum, buyPrice, createDate)
  99. VALUES (#{orderProductId}, #{ladderNum}, #{buyNum}, #{buyPrice}, #{createDate})
  100. </insert>
  101. <update id="updateShopOrderIds">
  102. UPDATE cm_order
  103. SET shopOrderIDs = #{shopOrderIds}
  104. WHERE orderID = #{orderId}
  105. </update>
  106. <insert id="insertOrderInvoice" parameterType="com.caimei365.order.model.po.InvoicePo">
  107. INSERT INTO bp_order_invoice (orderId, invoiceTitle, type, invoiceContent, invoiceTitleType, corporationTaxNum,
  108. registeredAddress, registeredPhone, bankAccountNo, openBank)
  109. VALUES (#{orderId}, #{invoiceTitle}, #{type}, #{invoiceContent}, #{headingType}, #{corporationTaxNum},
  110. #{registeredAddress}, #{registeredPhone}, #{bankAccountNo}, #{openBank})
  111. </insert>
  112. <insert id="insertOrderUserInfo" parameterType="com.caimei365.order.model.po.OrderUserInfoPo">
  113. INSERT INTO bp_order_userinfo (orderId, clubId, userId, name, shouHuoRen, mobile,
  114. townId, province, city, town, address)
  115. VALUES (#{orderId}, #{clubId}, #{userId}, #{name}, #{receiver}, #{mobile},
  116. #{townId}, #{province}, #{city}, #{town}, #{address})
  117. </insert>
  118. <insert id="insertCouponOrderRecord" parameterType="com.caimei365.order.model.po.CouponOrderRecordPo">
  119. INSERT INTO cm_coupon_order_record (orderId, clubCouponId, couponType, couponAmount, touchPrice, createDate)
  120. VALUES (#{orderId}, #{clubCouponId}, #{couponType}, #{couponAmount}, #{touchPrice}, #{createDate})
  121. </insert>
  122. <update id="updateUserMoney">
  123. UPDATE USER
  124. SET userMoney = #{userMoney},
  125. ableUserMoney = #{ableUserMoney}
  126. WHERE userID = #{userId}
  127. </update>
  128. <update id="updateOrderInvoice">
  129. UPDATE bp_order_invoice SET orderId=#{orderId},
  130. <set>
  131. <if test="invoiceTitle != null">
  132. invoiceTitle = #{invoiceTitle},
  133. </if>
  134. <if test="type != null">
  135. type = #{type,jdbcType=CHAR},
  136. </if>
  137. <if test="invoiceContent != null">
  138. invoiceContent = #{invoiceContent},
  139. </if>
  140. <if test="invoiceTitleType != null">
  141. invoiceTitleType = #{invoiceTitleType},
  142. </if>
  143. <if test="corporationTaxNum != null">
  144. corporationTaxNum = #{corporationTaxNum},
  145. </if>
  146. <if test="registeredAddress != null">
  147. registeredAddress = #{registeredAddress},
  148. </if>
  149. <if test="registeredPhone != null">
  150. registeredPhone = #{registeredPhone},
  151. </if>
  152. <if test="bankAccountNo != null">
  153. bankAccountNo = #{bankAccountNo},
  154. </if>
  155. <if test="openBank != null">
  156. openBank = #{openBank},
  157. </if>
  158. </set>
  159. WHERE id = #{id}
  160. </update>
  161. <update id="updateOnlinePayFlag">
  162. UPDATE cm_order
  163. SET onlinePayFlag = #{onlinePayFlag}
  164. WHERE orderID = #{orderId}
  165. </update>
  166. <update id="updateOnlinePayWays">
  167. UPDATE cm_shop_order
  168. SET onlinePayWays = #{onlinePayWays}
  169. WHERE orderID = #{orderId}
  170. </update>
  171. <select id="getOrganizeSkuInfo" resultType="com.caimei365.order.model.po.CmOrganizeSkuPo">
  172. SELECT distinct cs.skuId,
  173. cs.productId,
  174. cs.minBuyNumber,
  175. cs.price,
  176. cs.unit,
  177. cs.stock,
  178. ifnull(copi.costCheckFlag, 1) as costCheckFlag,
  179. IFNULL(cs.organizeCostPrice, 0) AS organizeCostPrice,
  180. IFNULL(cs.cmCostPrice, 0) AS cmCostPrice,
  181. ifnull(cs.organizePercent, 0) as organizePercent,
  182. ifnull(cs.shopPercent, 0) as shopPercent,
  183. ifnull(cs.cmPercent, 0) as cmPercent
  184. FROM cm_sku cs
  185. LEFT JOIN cm_organize_product_info copi ON cs.productId = copi.productId
  186. WHERE cs.skuId = #{skuId}
  187. AND cs.organizeId = #{organizeId}
  188. AND copi.organizeId = #{organizeId}
  189. </select>
  190. <select id="getDistributionSkuInfo" resultType="com.caimei365.order.model.po.CmOrganizeSkuPo">
  191. SELECT distinct cs.skuId,
  192. cs.productId,
  193. cs.minBuyNumber,
  194. cds.price,
  195. cs.unit,
  196. cs.stock,
  197. ifnull(cds.costCheckFlag, 1) as costCheckFlag,
  198. IFNULL(cds.organizeCostPrice, 0) AS organizeCostPrice,
  199. IFNULL(cds.cmCostPrice, 0) AS cmCostPrice,
  200. ifnull(cds.organizePercent, 0) as organizePercent,
  201. ifnull(cds.shopPercent, 0) as shopPercent,
  202. ifnull(cds.cmPercent, 0) as cmPercent
  203. FROM cm_sku cs
  204. LEFT JOIN cm_distribution_sku cds ON cs.skuId = cds.skuId
  205. LEFT JOIN cm_organize_product_info copi ON cs.productId = copi.productId
  206. WHERE cs.skuId = #{skuId}
  207. AND cs.organizeId = #{organizeId}
  208. AND copi.organizeId = #{organizeId}
  209. </select>
  210. <select id="getOrderInvoice" resultType="com.caimei365.order.model.po.InvoicePo">
  211. SELECT id,
  212. orderId,
  213. invoiceTitle,
  214. corporationTaxNum,
  215. registeredAddress,
  216. registeredPhone,
  217. bankAccountNo,
  218. openBank
  219. FROM bp_order_invoice
  220. WHERE orderId = #{orderId}
  221. </select>
  222. <select id="getOperationIdByUnionId" resultType="java.lang.Integer">
  223. SELECT `id`
  224. FROM cm_mall_operation_user
  225. WHERE unionId = #{unionId}
  226. AND userID = #{userId}
  227. AND delFlag = '0'
  228. </select>
  229. <select id="getServiceProviderUserId" resultType="java.lang.Integer">
  230. SELECT userID
  231. FROM serviceprovider
  232. WHERE serviceProviderID = #{serviceProviderId}
  233. </select>
  234. <select id="getDistributionUserId" resultType="java.lang.Integer">
  235. SELECT userID
  236. FROM cm_distribution
  237. WHERE id = #{id}
  238. </select>
  239. <select id="getOrderUserBoById" resultType="com.caimei365.order.model.bo.OrderParamBo">
  240. SELECT userID AS userId,
  241. clubID AS clubId,
  242. userName,
  243. bindMobile,
  244. userMoney,
  245. ableUserMoney,
  246. userIdentity,
  247. userBeans
  248. FROM user
  249. WHERE userID = #{userId}
  250. </select>
  251. <select id="getProductDetails" resultType="com.caimei365.order.model.po.OrderProductPo">
  252. SELECT cs.skuId AS skuId,
  253. p.productID AS productId,
  254. p.shopID AS shopId,
  255. p.`name` AS `name`,
  256. p.mainImage AS image,
  257. cs.price,
  258. cs.costPrice,
  259. IFNULL((SELECT costCheckFlag
  260. FROM cm_organize_product_info
  261. WHERE productId = cs.productId AND organizeId = cs.organizeId), 1) AS costCheckFlag,
  262. cs.shopPercent as costProportional,
  263. p.productCategory,
  264. cs.ladderPriceFlag,
  265. p.includedTax,
  266. p.invoiceType,
  267. p.taxPoint AS taxRate,
  268. cs.unit AS productUnit,
  269. cs.normalPrice,
  270. p.supplierTaxPoint AS shopTaxRate,
  271. p.splitCode as splitCode
  272. FROM product p
  273. LEFT JOIN cm_sku cs on p.productID = cs.productId
  274. WHERE cs.skuId = #{skuId}
  275. and cs.organizeId = 0
  276. </select>
  277. <select id="getDistributionProductDetails" resultType="com.caimei365.order.model.po.OrderProductPo">
  278. SELECT cs.skuId AS skuId,
  279. p.productID AS productId,
  280. p.shopID AS shopId,
  281. p.`name` AS `name`,
  282. p.mainImage AS image,
  283. cds.price,
  284. cds.costPrice,
  285. cds.costCheckFlag AS costCheckFlag,
  286. cds.shopPercent as costProportional,
  287. p.productCategory,
  288. cs.ladderPriceFlag,
  289. cdp.includedTax,
  290. cdp.invoiceType,
  291. cdp.clubTaxPoint AS taxRate,
  292. cs.unit AS productUnit,
  293. cs.normalPrice,
  294. cdp.shopTaxPoint AS shopTaxRate,
  295. p.splitCode as splitCode
  296. FROM product p
  297. LEFT JOIN cm_distribution_product cdp ON p.productID = cdp.productId
  298. LEFT JOIN cm_sku cs on p.productID = cs.productId
  299. LEFT JOIN cm_distribution_sku cds on cds.productID = cs.productId and cds.skuId = cs.skuId
  300. WHERE cs.skuId = #{skuId}
  301. and cs.organizeId = 0
  302. </select>
  303. <select id="getProductOrganizeDetails" resultType="com.caimei365.order.model.po.OrderProductPo">
  304. SELECT cs.skuId AS skuId,
  305. p.productID AS productId,
  306. p.shopID AS shopId,
  307. p.`name` AS `name`,
  308. p.mainImage AS image,
  309. cs.price,
  310. cs.costPrice,
  311. IFNULL((SELECT costCheckFlag
  312. FROM cm_organize_product_info
  313. WHERE productId = cs.productId AND organizeId = cs.organizeId), 1) AS costCheckFlag,
  314. cs.shopPercent as costProportional,
  315. p.productCategory,
  316. cs.ladderPriceFlag,
  317. p.includedTax,
  318. p.invoiceType,
  319. p.taxPoint AS taxRate,
  320. cs.unit AS productUnit,
  321. cs.normalPrice,
  322. p.supplierTaxPoint AS shopTaxRate,
  323. p.splitCode as splitCode
  324. FROM product p
  325. LEFT JOIN cm_sku cs on p.productID = cs.productId
  326. WHERE cs.skuId = #{skuId}
  327. and cs.organizeId = 4
  328. </select>
  329. <select id="getClauseNameById" resultType="java.lang.String">
  330. SELECT `name`
  331. FROM bp_clause
  332. WHERE id = #{clauseId}
  333. </select>
  334. <select id="getClubId" resultType="java.lang.Integer">
  335. select clubId
  336. from club
  337. where userId = #{userId}
  338. </select>
  339. <select id="getAddressDetailById" resultType="com.caimei365.order.model.vo.AddressVo">
  340. SELECT a.addressID AS addressId,
  341. a.userID AS userId,
  342. a.shouHuoRen AS receiver,
  343. a.townID AS townId,
  344. a.address,
  345. a.mobile,
  346. a.defaultFlag,
  347. t.name AS town,
  348. c.name AS city,
  349. c.cityID AS cityId,
  350. p.name AS province,
  351. p.provinceID AS provinceId
  352. FROM address a
  353. LEFT JOIN town t ON t.townID = a.townID
  354. LEFT JOIN city c ON c.cityID = t.cityID
  355. LEFT JOIN province p ON p.provinceID = c.provinceID
  356. WHERE a.addressID = #{addressId}
  357. LIMIT 1
  358. </select>
  359. <select id="getSvipProductDetails" resultType="com.caimei365.order.model.po.SvipProductPo">
  360. select if(id is not null and csp.status = 0, 1, 0) as svipProductFlag,
  361. priceType as svipPriceType,
  362. discount as svipDiscount,
  363. discountPrice as svipDiscountPrice
  364. from cm_svip_product_sku
  365. left join cm_svip_product csp on cm_svip_product_sku.productId = csp.productId
  366. where skuId = #{skuId}
  367. and csp.status = 0
  368. </select>
  369. <select id="findLowOrder" resultType="java.lang.Integer">
  370. select orderID
  371. from cm_order
  372. where status not in (6, 7)
  373. and payTotalFee <![CDATA[ < ]]> 1000
  374. and orderTime <![CDATA[ > ]]> #{orderTime}
  375. and userID = #{userId}
  376. </select>
  377. <select id="findShops" resultType="com.caimei365.order.model.po.OrderShopPo">
  378. SELECT DISTINCT
  379. s.shopID AS shopId,
  380. p.splitCode
  381. FROM shop s
  382. LEFT JOIN product p ON p.shopID = s.shopID
  383. WHERE p.productID IN
  384. <foreach collection="productIdList" open="(" separator="," close=")" item="productId">
  385. #{productId}
  386. </foreach>
  387. GROUP BY s.shopID,p.splitCode
  388. </select>
  389. <select id="findSplitResult" resultType="java.lang.Integer">
  390. SELECT COUNT(*) FROM product
  391. WHERE productId IN
  392. <foreach collection="productIdList" open="(" separator="," close=")" item="productId">
  393. #{productId}
  394. </foreach>
  395. AND (splitcode IS NULL OR splitcode ='')
  396. </select>
  397. <select id="getRechargeProductDetails" resultType="com.caimei365.order.model.po.OrderProductPo">
  398. SELECT cs.skuId AS skuId,
  399. p.productID AS productId,
  400. p.shopID AS shopId,
  401. p.`name` AS `name`,
  402. p.mainImage AS image,
  403. cs.price,
  404. cs.costPrice,
  405. IFNULL((SELECT costCheckFlag
  406. FROM cm_organize_product_info
  407. WHERE productId = cs.productId AND organizeId = cs.organizeId), 1) AS costCheckFlag,
  408. cs.shopPercent as costProportional,
  409. p.productCategory,
  410. cs.ladderPriceFlag,
  411. p.includedTax,
  412. p.invoiceType,
  413. p.taxPoint AS taxRate,
  414. cs.unit AS productUnit,
  415. cs.normalPrice,
  416. p.supplierTaxPoint AS shopTaxRate,
  417. p.splitCode as splitCode
  418. FROM product p
  419. LEFT JOIN cm_sku cs on p.productID = cs.productId
  420. WHERE cs.productId = #{productId}
  421. and cs.organizeId = 0
  422. </select>
  423. <select id="findOrderProducts" resultType="com.caimei365.order.model.vo.OrderProductVo">
  424. select
  425. orderProductId,
  426. orderNo,
  427. orderId,
  428. shopOrderId,
  429. shopOrderNo,
  430. shopID,
  431. productId,
  432. organizeId,
  433. num,
  434. presentNum,
  435. outStoreType,
  436. skuId,
  437. productNo,
  438. price,
  439. normalPrice,
  440. costPrice,
  441. totalAmount,
  442. totalFee,
  443. shouldPayFee,
  444. discount,
  445. discountPrice,
  446. includedTax,
  447. invoiceType,
  448. ladderPriceFlag,
  449. taxRate,
  450. supplierTaxRate,
  451. addedValueTax,
  452. totalAddedValueTax,
  453. shouldPayTotalTax,
  454. singleShouldPayTotalTax,
  455. shopProductAmount,
  456. shopFee,
  457. otherFee,
  458. cmFee,
  459. singleShopFee,
  460. singleOtherFee,
  461. singleCmFee,
  462. status,
  463. totalBeans,
  464. useBalanceAmount,
  465. useBeanAmount,
  466. notOutStore,
  467. cmbeanPrice,
  468. isActProduct,
  469. isGiftProduct,
  470. productActInfo,
  471. buyAgainFlag,
  472. confirmProductFlag,
  473. payStatus,
  474. shopName,
  475. name,
  476. productUnit,
  477. productImage,
  478. actType,
  479. actPreferential,
  480. ifnull(productType,0) as productType,
  481. orderPromotionsId,
  482. preferential,
  483. discountFee,
  484. cancelNum,
  485. heUserId,
  486. svipPriceFlag,
  487. svipPriceType,
  488. svipDiscount,
  489. svipReduction,
  490. cmPercent,
  491. organizePercent,
  492. shopPercent
  493. from cm_order_product
  494. where orderProductID in
  495. <foreach item="orderProductId" index="index" collection="orderProductIds" open="(" separator="," close=")">
  496. #{orderProductId}
  497. </foreach>
  498. </select>
  499. <update id="updateOrderProduct">
  500. update cm_order_product
  501. set price = #{price},
  502. discountPrice = #{price},
  503. costPrice = #{costPrice},
  504. totalAmount = #{totalAmount},
  505. totalFee = #{totalFee},
  506. shouldPayFee = #{shouldPayFee},
  507. ladderPriceFlag = #{ladderPriceFlag},
  508. taxRate = #{taxRate},
  509. addedValueTax = #{addedValueTax},
  510. totalAddedValueTax = #{totalAddedValueTax},
  511. shouldPayTotalTax = #{shouldPayTotalTax},
  512. singleShouldPayTotalTax = #{singleShouldPayTotalTax},
  513. shopProductAmount = #{shopProductAmount},
  514. singleShopFee = #{singleShopFee},
  515. shopFee = #{shopFee}
  516. where orderProductId = #{orderProductId}
  517. </update>
  518. <update id="updateShopOrder">
  519. update cm_shop_order
  520. set
  521. <if test="status != null">
  522. shopStatus = #{status},
  523. </if>
  524. <if test="realNeedPay != null">
  525. realPay = #{realNeedPay},
  526. </if>
  527. <if test="receiptAmount != null">
  528. receiptAmount = #{receiptAmount},
  529. </if>
  530. <if test="accountAmount != null">
  531. accountAmount = #{accountAmount},
  532. </if>
  533. <if test="productAmount != null">
  534. productAmount = #{productAmount},
  535. </if>
  536. <if test="totalAmount != null">
  537. totalAmount = #{totalAmount},
  538. </if>
  539. <if test="needPayAmount != null">
  540. needPayAmount = #{needPayAmount},
  541. </if>
  542. <if test="promotionFullReduction != null">
  543. promotionFullReduction = #{promotionFullReduction},
  544. </if>
  545. <if test="receiptStatus != null">
  546. receiptStatus = #{receiptStatus},
  547. </if>
  548. <if test="shopProductAmount != null">
  549. shopProductAmount = #{shopProductAmount},
  550. </if>
  551. <if test="shopTaxFee != null">
  552. shopTaxFee = #{shopTaxFee},
  553. </if>
  554. <if test="shouldPayShopAmount != null">
  555. shouldPayShopAmount = #{shouldPayShopAmount}
  556. </if>
  557. where shopOrderId = #{shopOrderId}
  558. </update>
  559. <update id="updateUserMoneyByChange">
  560. update user
  561. set userMoney = userMoney + #{change},
  562. ableUserMoney = ableUserMoney + #{change}
  563. where userId = #{userId}
  564. </update>
  565. <update id="updateShopOrderCoupon">
  566. update cm_shop_order
  567. set needPayAmount = #{needPayAmount},
  568. totalAmount = #{totalAmount},
  569. couponAmount = #{couponAmount},
  570. couponClubId = #{couponClubId},
  571. realPay = #{realPay},
  572. shopProductAmount = #{shopProductAmount},
  573. shouldPayShopAmount = #{shouldPayShopAmount}
  574. where shopOrderId = #{shopOrderId}
  575. </update>
  576. </mapper>