OrderSubmitMapper.xml 48 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.caimei.mapper.OrderSubmitMapper">
  6. <select id="findShopByCartIds" resultType="com.caimei.model.vo.ShopVo">
  7. SELECT DISTINCT
  8. s.shopID AS shopId,
  9. s.name,
  10. s.logo,
  11. p.returnGoodsStutas,
  12. p.splitCode
  13. FROM
  14. cm_cart cc
  15. LEFT JOIN product p ON cc.productID = p.productID
  16. LEFT JOIN shop s ON p.shopID = s.shopID
  17. WHERE
  18. cc.cm_cartID IN
  19. <foreach item="cartId" index="index" collection="cartIds" open="(" separator="," close=")">
  20. #{cartId}
  21. </foreach>
  22. group by cc.shopID
  23. ORDER BY
  24. cc.addTime DESC
  25. </select>
  26. <select id="findByShopCartProduct" resultType="com.caimei.model.vo.CartProductVo">
  27. SELECT
  28. cc.skuId,
  29. cc.cm_cartID AS cartId,
  30. cc.productID AS productId,
  31. cc.productCount as num,
  32. cc.heUserId,
  33. chs.price,
  34. chs.price as normalPrice,
  35. chp.includedTax,
  36. chp.invoiceType,
  37. chp.clubTaxPoint,
  38. cs.cmPercent,
  39. cs.organizePercent,
  40. cs.shopPercent,
  41. copi.costCheckFlag,
  42. p.name,
  43. p.shopID AS shopId,
  44. p.mainImage as productImage,
  45. cs.unit as productUnit
  46. FROM cm_cart cc
  47. LEFT JOIN cm_sku cs on cc.skuId=cs.skuId
  48. LEFT JOIN cm_hehe_sku chs on cc.skuId=chs.skuId
  49. LEFT JOIN cm_hehe_product chp ON cc.productID = chp.productId
  50. LEFT JOIN product p ON cc.productID = p.productID
  51. left join cm_organize_product_info copi on copi.productId = p.productID and copi.organizeId=(SELECT SUBSTRING(groundMall, 1, 1)FROM product WHERE productID=p.productId)
  52. WHERE
  53. chp.validFlag = 1
  54. AND p.shopID = #{shopId}
  55. and p.splitCode = #{splitCode}
  56. AND cc.cm_cartID IN
  57. <foreach item="cartId" index="index" collection="cartIds" open="(" separator="," close=")">
  58. #{cartId}
  59. </foreach>
  60. </select>
  61. <select id="findUser" resultType="com.caimei.model.po.UserPo">
  62. SELECT userID,
  63. mobile,
  64. bindMobile,
  65. userName,
  66. name
  67. FROM user
  68. WHERE userID = #{userId}
  69. </select>
  70. <select id="getProduct" resultType="com.caimei.model.po.CmHeHeProductPo">
  71. SELECT cs.skuId,
  72. chp.id,
  73. chp.productId,
  74. chs.price,
  75. chs.price as normalPrice,
  76. chp.includedTax,
  77. chp.invoiceType,
  78. copi.costCheckFlag AS costType,
  79. chp.clubTaxPoint,
  80. chp.shopTaxPoint,
  81. cs.costPrice,
  82. cs.shopPercent AS costProportional,
  83. p.shopID AS shopId,
  84. cs.unit,
  85. cs.cmPercent,
  86. cs.organizePercent,
  87. cs.shopPercent,
  88. copi.costCheckFlag,
  89. p.name,
  90. p.mainImage,
  91. p.splitCode,
  92. s.name AS shopName
  93. FROM cm_hehe_product chp
  94. LEFT JOIN cm_sku cs on cs.productId = chp.productId
  95. LEFT JOIN cm_hehe_sku chs on cs.skuId=chs.skuId
  96. LEFT JOIN product p ON chp.productId = p.productID
  97. left join cm_organize_product_info copi on copi.productId = p.productID and copi.organizeId=(SELECT SUBSTRING(groundMall, 1, 1)FROM product WHERE productID=p.productId)
  98. LEFT JOIN shop s ON p.shopID = s.shopID
  99. WHERE cs.skuId = #{skuId}
  100. </select>
  101. <delete id="deleteCartByProductId">
  102. DELETE
  103. FROM cm_cart
  104. WHERE userID = #{userId}
  105. AND skuId = #{skuId}
  106. AND heUserId = #{heUserId}
  107. </delete>
  108. <insert id="insertOrder" keyColumn="orderID" keyProperty="orderID" parameterType="com.caimei.model.po.CmOrderPo"
  109. useGeneratedKeys="true">
  110. insert into cm_order
  111. <trim prefix="(" suffix=")" suffixOverrides=",">
  112. <if test="orderNo != null">
  113. orderNo,
  114. </if>
  115. <if test="organizeID != null">
  116. organizeID,
  117. </if>
  118. <if test="userID != null">
  119. userID,
  120. </if>
  121. <if test="buyUserID != null">
  122. buyUserID,
  123. </if>
  124. <if test="shopOrderIDs != null">
  125. shopOrderIDs,
  126. </if>
  127. <if test="orderSubmitType != null">
  128. orderSubmitType,
  129. </if>
  130. <if test="orderType != null">
  131. orderType,
  132. </if>
  133. <if test="secondHandOrderFlag != null">
  134. secondHandOrderFlag,
  135. </if>
  136. <if test="hasActProduct != null">
  137. hasActProduct,
  138. </if>
  139. <if test="status != null">
  140. `status`,
  141. </if>
  142. <if test="receiptStatus != null">
  143. receiptStatus,
  144. </if>
  145. <if test="payStatus != null">
  146. payStatus,
  147. </if>
  148. <if test="sendOutStatus != null">
  149. sendOutStatus,
  150. </if>
  151. <if test="refundType != null">
  152. refundType,
  153. </if>
  154. <if test="payFlag != null">
  155. payFlag,
  156. </if>
  157. <if test="onlinePayFlag != null">
  158. onlinePayFlag,
  159. </if>
  160. <if test="productTotalFee != null">
  161. productTotalFee,
  162. </if>
  163. <if test="orderTotalFee != null">
  164. orderTotalFee,
  165. </if>
  166. <if test="payTotalFee != null">
  167. payTotalFee,
  168. </if>
  169. <if test="payableAmount != null">
  170. payableAmount,
  171. </if>
  172. <if test="balancePayFee != null">
  173. balancePayFee,
  174. </if>
  175. <if test="preferential != null">
  176. preferential,
  177. </if>
  178. <if test="discountFee != null">
  179. discountFee,
  180. </if>
  181. <if test="promotionFullReduction != null">
  182. promotionFullReduction,
  183. </if>
  184. <if test="spID != null">
  185. spID,
  186. </if>
  187. <if test="mainSpID != null">
  188. mainSpID,
  189. </if>
  190. <if test="note != null">
  191. note,
  192. </if>
  193. <if test="clubID != null">
  194. clubID,
  195. </if>
  196. <if test="clubScanTime != null">
  197. clubScanTime,
  198. </if>
  199. <if test="orderSource != null">
  200. orderSource,
  201. </if>
  202. <if test="closeTime != null">
  203. closeTime,
  204. </if>
  205. <if test="confirmTime != null">
  206. confirmTime,
  207. </if>
  208. <if test="payTime != null">
  209. payTime,
  210. </if>
  211. <if test="orderTime != null">
  212. orderTime,
  213. </if>
  214. <if test="productCount != null">
  215. productCount,
  216. </if>
  217. <if test="presentCount != null">
  218. presentCount,
  219. </if>
  220. <if test="promotionalGiftsCount != null">
  221. promotionalGiftsCount,
  222. </if>
  223. <if test="invoiceFlag != null">
  224. invoiceFlag,
  225. </if>
  226. <if test="confirmFlag != null">
  227. confirmFlag,
  228. </if>
  229. <if test="clauseID != null">
  230. clauseID,
  231. </if>
  232. <if test="clauseContent != null">
  233. clauseContent,
  234. </if>
  235. <if test="clauseName != null">
  236. clauseName,
  237. </if>
  238. <if test="updateDate != null">
  239. updateDate,
  240. </if>
  241. <if test="freePostFlag != null">
  242. freePostFlag,
  243. </if>
  244. <if test="freight != null">
  245. freight,
  246. </if>
  247. <if test="couponAmount != null">
  248. couponAmount,
  249. </if>
  250. <if test="reductionAmount != null">
  251. reductionAmount,
  252. </if>
  253. <if test="delFlag != null">
  254. delFlag,
  255. </if>
  256. <if test="freePostageTicketID != null">
  257. freePostageTicketID,
  258. </if>
  259. <if test="splitFlag != null">
  260. splitFlag,
  261. </if>
  262. <if test="closeReason != null">
  263. closeReason,
  264. </if>
  265. <if test="postageOrderFlag != null">
  266. postageOrderFlag,
  267. </if>
  268. <if test="thirdPartyOrderNo != null">
  269. thirdPartyOrderNo,
  270. </if>
  271. <if test="affirmPaymentFlag != null">
  272. affirmPaymentFlag,
  273. </if>
  274. <if test="rebateFlag != null">
  275. rebateFlag,
  276. </if>
  277. <if test="zeroCostFlag != null">
  278. zeroCostFlag,
  279. </if>
  280. </trim>
  281. <trim prefix="values (" suffix=")" suffixOverrides=",">
  282. <if test="orderNo != null">
  283. #{orderNo,jdbcType=VARCHAR},
  284. </if>
  285. <if test="organizeID != null">
  286. #{organizeID},
  287. </if>
  288. <if test="userID != null">
  289. #{userID,jdbcType=BIGINT},
  290. </if>
  291. <if test="buyUserID != null">
  292. #{buyUserID,jdbcType=INTEGER},
  293. </if>
  294. <if test="shopOrderIDs != null">
  295. #{shopOrderIDs,jdbcType=VARCHAR},
  296. </if>
  297. <if test="orderSubmitType != null">
  298. #{orderSubmitType,jdbcType=INTEGER},
  299. </if>
  300. <if test="orderType != null">
  301. #{orderType,jdbcType=INTEGER},
  302. </if>
  303. <if test="secondHandOrderFlag != null">
  304. #{secondHandOrderFlag,jdbcType=VARCHAR},
  305. </if>
  306. <if test="hasActProduct != null">
  307. #{hasActProduct,jdbcType=CHAR},
  308. </if>
  309. <if test="status != null">
  310. #{status,jdbcType=CHAR},
  311. </if>
  312. <if test="receiptStatus != null">
  313. #{receiptStatus,jdbcType=CHAR},
  314. </if>
  315. <if test="payStatus != null">
  316. #{payStatus,jdbcType=CHAR},
  317. </if>
  318. <if test="sendOutStatus != null">
  319. #{sendOutStatus,jdbcType=CHAR},
  320. </if>
  321. <if test="refundType != null">
  322. #{refundType,jdbcType=CHAR},
  323. </if>
  324. <if test="payFlag != null">
  325. #{payFlag,jdbcType=CHAR},
  326. </if>
  327. <if test="onlinePayFlag != null">
  328. #{onlinePayFlag,jdbcType=CHAR},
  329. </if>
  330. <if test="productTotalFee != null">
  331. #{productTotalFee,jdbcType=DECIMAL},
  332. </if>
  333. <if test="orderTotalFee != null">
  334. #{orderTotalFee,jdbcType=DECIMAL},
  335. </if>
  336. <if test="payTotalFee != null">
  337. #{payTotalFee,jdbcType=DECIMAL},
  338. </if>
  339. <if test="payableAmount != null">
  340. #{payableAmount,jdbcType=DECIMAL},
  341. </if>
  342. <if test="balancePayFee != null">
  343. #{balancePayFee,jdbcType=DECIMAL},
  344. </if>
  345. <if test="preferential != null">
  346. #{preferential,jdbcType=DECIMAL},
  347. </if>
  348. <if test="discountFee != null">
  349. #{discountFee,jdbcType=DECIMAL},
  350. </if>
  351. <if test="promotionFullReduction != null">
  352. #{promotionFullReduction,jdbcType=DECIMAL},
  353. </if>
  354. <if test="spID != null">
  355. #{spID,jdbcType=BIGINT},
  356. </if>
  357. <if test="mainSpID != null">
  358. #{mainSpID,jdbcType=BIGINT},
  359. </if>
  360. <if test="note != null">
  361. #{note,jdbcType=VARCHAR},
  362. </if>
  363. <if test="clubID != null">
  364. #{clubID,jdbcType=BIGINT},
  365. </if>
  366. <if test="clubScanTime != null">
  367. #{clubScanTime,jdbcType=VARCHAR},
  368. </if>
  369. <if test="orderSource != null">
  370. #{orderSource,jdbcType=CHAR},
  371. </if>
  372. <if test="closeTime != null">
  373. #{closeTime,jdbcType=VARCHAR},
  374. </if>
  375. <if test="confirmTime != null">
  376. #{confirmTime,jdbcType=VARCHAR},
  377. </if>
  378. <if test="payTime != null">
  379. #{payTime,jdbcType=VARCHAR},
  380. </if>
  381. <if test="orderTime != null">
  382. #{orderTime,jdbcType=VARCHAR},
  383. </if>
  384. <if test="productCount != null">
  385. #{productCount,jdbcType=INTEGER},
  386. </if>
  387. <if test="presentCount != null">
  388. #{presentCount,jdbcType=INTEGER},
  389. </if>
  390. <if test="promotionalGiftsCount != null">
  391. #{promotionalGiftsCount,jdbcType=INTEGER},
  392. </if>
  393. <if test="invoiceFlag != null">
  394. #{invoiceFlag,jdbcType=CHAR},
  395. </if>
  396. <if test="confirmFlag != null">
  397. #{confirmFlag,jdbcType=CHAR},
  398. </if>
  399. <if test="clauseID != null">
  400. #{clauseID,jdbcType=BIGINT},
  401. </if>
  402. <if test="clauseContent != null">
  403. #{clauseContent,jdbcType=VARCHAR},
  404. </if>
  405. <if test="clauseName != null">
  406. #{clauseName,jdbcType=VARCHAR},
  407. </if>
  408. <if test="updateDate != null">
  409. #{updateDate,jdbcType=VARCHAR},
  410. </if>
  411. <if test="freePostFlag != null">
  412. #{freePostFlag,jdbcType=CHAR},
  413. </if>
  414. <if test="freight != null">
  415. #{freight,jdbcType=DECIMAL},
  416. </if>
  417. <if test="couponAmount != null">
  418. #{couponAmount,jdbcType=DECIMAL},
  419. </if>
  420. <if test="reductionAmount != null">
  421. #{reductionAmount,jdbcType=DECIMAL},
  422. </if>
  423. <if test="delFlag != null">
  424. #{delFlag,jdbcType=CHAR},
  425. </if>
  426. <if test="freePostageTicketID != null">
  427. #{freePostageTicketID,jdbcType=INTEGER},
  428. </if>
  429. <if test="splitFlag != null">
  430. #{splitFlag,jdbcType=CHAR},
  431. </if>
  432. <if test="closeReason != null">
  433. #{closeReason,jdbcType=VARCHAR},
  434. </if>
  435. <if test="postageOrderFlag != null">
  436. #{postageOrderFlag,jdbcType=CHAR},
  437. </if>
  438. <if test="thirdPartyOrderNo != null">
  439. #{thirdPartyOrderNo,jdbcType=CHAR},
  440. </if>
  441. <if test="affirmPaymentFlag != null">
  442. #{affirmPaymentFlag,jdbcType=CHAR},
  443. </if>
  444. <if test="rebateFlag != null">
  445. #{rebateFlag,jdbcType=CHAR},
  446. </if>
  447. <if test="zeroCostFlag != null">
  448. #{zeroCostFlag,jdbcType=INTEGER},
  449. </if>
  450. </trim>
  451. </insert>
  452. <select id="findMaxShopOrderNo" resultType="java.lang.String">
  453. SELECT shopOrderNo
  454. FROM cm_shop_order
  455. WHERE orderID = #{orderId}
  456. ORDER BY shopOrderNo DESC
  457. LIMIT 1
  458. </select>
  459. <insert id="insertShopOrder" keyColumn="shopOrderID" keyProperty="shopOrderID"
  460. parameterType="com.caimei.model.po.CmShopOrderPo" useGeneratedKeys="true">
  461. insert into cm_shop_order
  462. <trim prefix="(" suffix=")" suffixOverrides=",">
  463. <if test="shopOrderNo != null">
  464. shopOrderNo,
  465. </if>
  466. <if test="orderNo != null">
  467. orderNo,
  468. </if>
  469. <if test="orderID != null">
  470. orderID,
  471. </if>
  472. <if test="organizeID != null">
  473. organizeID,
  474. </if>
  475. <if test="userID != null">
  476. userID,
  477. </if>
  478. <if test="shopID != null">
  479. shopID,
  480. </if>
  481. <if test="orderPromotionsId != null">
  482. orderPromotionsId,
  483. </if>
  484. <if test="orderType != null">
  485. orderType,
  486. </if>
  487. <if test="orderSubmitType != null">
  488. orderSubmitType,
  489. </if>
  490. <if test="presentNum != null">
  491. presentNum,
  492. </if>
  493. <if test="itemCount != null">
  494. itemCount,
  495. </if>
  496. <if test="outStoreNum != null">
  497. outStoreNum,
  498. </if>
  499. <if test="outStoreTimes != null">
  500. outStoreTimes,
  501. </if>
  502. <if test="townID != null">
  503. townID,
  504. </if>
  505. <if test="note != null">
  506. note,
  507. </if>
  508. <if test="accountAmount != null">
  509. accountAmount,
  510. </if>
  511. <if test="productAmount != null">
  512. productAmount,
  513. </if>
  514. <if test="totalAmount != null">
  515. totalAmount,
  516. </if>
  517. <if test="needPayAmount != null">
  518. needPayAmount,
  519. </if>
  520. <if test="discountAmount != null">
  521. discountAmount,
  522. </if>
  523. <if test="preferential != null">
  524. preferential,
  525. </if>
  526. <if test="promotionFullReduction != null">
  527. promotionFullReduction,
  528. </if>
  529. <if test="payFlag != null">
  530. payFlag,
  531. </if>
  532. <if test="orderTime != null">
  533. orderTime,
  534. </if>
  535. <if test="payTime != null">
  536. payTime,
  537. </if>
  538. <if test="finishTime != null">
  539. finishTime,
  540. </if>
  541. <if test="autoOverTimeMills != null">
  542. autoOverTimeMills,
  543. </if>
  544. <if test="payStatus != null">
  545. payStatus,
  546. </if>
  547. <if test="sendOutStatus != null">
  548. sendOutStatus,
  549. </if>
  550. <if test="refundStatus != null">
  551. refundStatus,
  552. </if>
  553. <if test="returnGoodsStatus != null">
  554. returnGoodsStatus,
  555. </if>
  556. <if test="receiveGoodsTime != null">
  557. receiveGoodsTime,
  558. </if>
  559. <if test="autoReceiveTimeMills != null">
  560. autoReceiveTimeMills,
  561. </if>
  562. <if test="totalAddedValueTax != null">
  563. totalAddedValueTax,
  564. </if>
  565. <if test="canRefundAmount != null">
  566. canRefundAmount,
  567. </if>
  568. <if test="refundAmount != null">
  569. refundAmount,
  570. </if>
  571. <if test="clubID != null">
  572. clubID,
  573. </if>
  574. <if test="spID != null">
  575. spID,
  576. </if>
  577. <if test="mainSpID != null">
  578. mainSpID,
  579. </if>
  580. <if test="orderBeanAmount != null">
  581. orderBeanAmount,
  582. </if>
  583. <if test="useBeanAmount != null">
  584. useBeanAmount,
  585. </if>
  586. <if test="useBeanFlag != null">
  587. useBeanFlag,
  588. </if>
  589. <if test="canRefundFlag != null">
  590. canRefundFlag,
  591. </if>
  592. <if test="useBalanceFlag != null">
  593. useBalanceFlag,
  594. </if>
  595. <if test="canRefundBeans != null">
  596. canRefundBeans,
  597. </if>
  598. <if test="freePostageFee != null">
  599. freePostageFee,
  600. </if>
  601. <if test="freePostageTicketID != null">
  602. freePostageTicketID,
  603. </if>
  604. <if test="brokerage != null">
  605. brokerage,
  606. </if>
  607. <if test="delFlag != null">
  608. delFlag,
  609. </if>
  610. <if test="refundsAmount != null">
  611. refundsAmount,
  612. </if>
  613. <if test="orderStatusFlag != null">
  614. orderStatusFlag,
  615. </if>
  616. <if test="buyStatus != null">
  617. buyStatus,
  618. </if>
  619. <if test="deliveryTimeMills != null">
  620. deliveryTimeMills,
  621. </if>
  622. <if test="orderDeliveryID != null">
  623. orderDeliveryID,
  624. </if>
  625. <if test="splitFlag != null">
  626. splitFlag,
  627. </if>
  628. <if test="receiptedFlag != null">
  629. receiptedFlag,
  630. </if>
  631. <if test="receiptedType != null">
  632. receiptedType,
  633. </if>
  634. <if test="paying != null">
  635. paying,
  636. </if>
  637. <if test="shopProductAmount != null">
  638. shopProductAmount,
  639. </if>
  640. <if test="shopPostFee != null">
  641. shopPostFee,
  642. </if>
  643. <if test="shopTaxFee != null">
  644. shopTaxFee,
  645. </if>
  646. <if test="shouldPayShopAmount != null">
  647. shouldPayShopAmount,
  648. </if>
  649. <if test="payedShopAmount != null">
  650. payedShopAmount,
  651. </if>
  652. <if test="shopOtherFee != null">
  653. shopOtherFee,
  654. </if>
  655. <if test="costType != null">
  656. costType,
  657. </if>
  658. <if test="proportional != null">
  659. proportional,
  660. </if>
  661. <if test="modifyShouldPayNote != null">
  662. modifyShouldPayNote,
  663. </if>
  664. <if test="modifyShouldPayUserID != null">
  665. modifyShouldPayUserID,
  666. </if>
  667. <if test="modifyShouldPayDate != null">
  668. modifyShouldPayDate,
  669. </if>
  670. <if test="zeroCostFlag != null">
  671. zeroCostFlag,
  672. </if>
  673. <if test="splitCode != null">
  674. splitCode,
  675. </if>
  676. <if test="realPay != null">
  677. realPay,
  678. </if>
  679. <if test="eachDiscount != null">
  680. eachDiscount,
  681. </if>
  682. <if test="receiptAmount != null">
  683. receiptAmount,
  684. </if>
  685. <if test="receiptStatus != null">
  686. receiptStatus,
  687. </if>
  688. <if test="isColdChina != null">
  689. isColdChina,
  690. </if>
  691. <if test="shopPostFlag != null">
  692. shopPostFlag,
  693. </if>
  694. <if test="onlinePayWays != null">
  695. onlinePayWays,
  696. </if>
  697. <if test="shopStatus != null">
  698. shopStatus,
  699. </if>
  700. </trim>
  701. <trim prefix="values (" suffix=")" suffixOverrides=",">
  702. <if test="shopOrderNo != null">
  703. #{shopOrderNo,jdbcType=VARCHAR},
  704. </if>
  705. <if test="orderNo != null">
  706. #{orderNo,jdbcType=VARCHAR},
  707. </if>
  708. <if test="orderID != null">
  709. #{orderID,jdbcType=BIGINT},
  710. </if>
  711. <if test="organizeID != null">
  712. #{organizeID},
  713. </if>
  714. <if test="userID != null">
  715. #{userID,jdbcType=INTEGER},
  716. </if>
  717. <if test="shopID != null">
  718. #{shopID,jdbcType=INTEGER},
  719. </if>
  720. <if test="orderPromotionsId != null">
  721. #{orderPromotionsId},
  722. </if>
  723. <if test="orderType != null">
  724. #{orderType,jdbcType=INTEGER},
  725. </if>
  726. <if test="orderSubmitType != null">
  727. #{orderSubmitType,jdbcType=INTEGER},
  728. </if>
  729. <if test="presentNum != null">
  730. #{presentNum,jdbcType=INTEGER},
  731. </if>
  732. <if test="itemCount != null">
  733. #{itemCount,jdbcType=INTEGER},
  734. </if>
  735. <if test="outStoreNum != null">
  736. #{outStoreNum,jdbcType=INTEGER},
  737. </if>
  738. <if test="outStoreTimes != null">
  739. #{outStoreTimes,jdbcType=INTEGER},
  740. </if>
  741. <if test="townID != null">
  742. #{townID,jdbcType=INTEGER},
  743. </if>
  744. <if test="note != null">
  745. #{note,jdbcType=VARCHAR},
  746. </if>
  747. <if test="accountAmount != null">
  748. #{accountAmount,jdbcType=DECIMAL},
  749. </if>
  750. <if test="productAmount != null">
  751. #{productAmount,jdbcType=DECIMAL},
  752. </if>
  753. <if test="totalAmount != null">
  754. #{totalAmount,jdbcType=DECIMAL},
  755. </if>
  756. <if test="needPayAmount != null">
  757. #{needPayAmount,jdbcType=DECIMAL},
  758. </if>
  759. <if test="discountAmount != null">
  760. #{discountAmount,jdbcType=DECIMAL},
  761. </if>
  762. <if test="preferential != null">
  763. #{preferential,jdbcType=DECIMAL},
  764. </if>
  765. <if test="promotionFullReduction != null">
  766. #{promotionFullReduction},
  767. </if>
  768. <if test="payFlag != null">
  769. #{payFlag,jdbcType=CHAR},
  770. </if>
  771. <if test="orderTime != null">
  772. #{orderTime,jdbcType=VARCHAR},
  773. </if>
  774. <if test="payTime != null">
  775. #{payTime,jdbcType=VARCHAR},
  776. </if>
  777. <if test="finishTime != null">
  778. #{finishTime,jdbcType=VARCHAR},
  779. </if>
  780. <if test="autoOverTimeMills != null">
  781. #{autoOverTimeMills,jdbcType=BIGINT},
  782. </if>
  783. <if test="payStatus != null">
  784. #{payStatus,jdbcType=CHAR},
  785. </if>
  786. <if test="sendOutStatus != null">
  787. #{sendOutStatus,jdbcType=CHAR},
  788. </if>
  789. <if test="refundStatus != null">
  790. #{refundStatus,jdbcType=INTEGER},
  791. </if>
  792. <if test="returnGoodsStatus != null">
  793. #{returnGoodsStatus,jdbcType=INTEGER},
  794. </if>
  795. <if test="receiveGoodsTime != null">
  796. #{receiveGoodsTime,jdbcType=VARCHAR},
  797. </if>
  798. <if test="autoReceiveTimeMills != null">
  799. #{autoReceiveTimeMills,jdbcType=BIGINT},
  800. </if>
  801. <if test="totalAddedValueTax != null">
  802. #{totalAddedValueTax,jdbcType=DECIMAL},
  803. </if>
  804. <if test="canRefundAmount != null">
  805. #{canRefundAmount,jdbcType=FLOAT},
  806. </if>
  807. <if test="refundAmount != null">
  808. #{refundAmount,jdbcType=FLOAT},
  809. </if>
  810. <if test="clubID != null">
  811. #{clubID,jdbcType=INTEGER},
  812. </if>
  813. <if test="spID != null">
  814. #{spID,jdbcType=INTEGER},
  815. </if>
  816. <if test="mainSpID != null">
  817. #{mainSpID,jdbcType=INTEGER},
  818. </if>
  819. <if test="orderBeanAmount != null">
  820. #{orderBeanAmount,jdbcType=INTEGER},
  821. </if>
  822. <if test="useBeanAmount != null">
  823. #{useBeanAmount,jdbcType=INTEGER},
  824. </if>
  825. <if test="useBeanFlag != null">
  826. #{useBeanFlag,jdbcType=INTEGER},
  827. </if>
  828. <if test="canRefundFlag != null">
  829. #{canRefundFlag,jdbcType=INTEGER},
  830. </if>
  831. <if test="useBalanceFlag != null">
  832. #{useBalanceFlag,jdbcType=INTEGER},
  833. </if>
  834. <if test="canRefundBeans != null">
  835. #{canRefundBeans,jdbcType=INTEGER},
  836. </if>
  837. <if test="freePostageFee != null">
  838. #{freePostageFee,jdbcType=DECIMAL},
  839. </if>
  840. <if test="freePostageTicketID != null">
  841. #{freePostageTicketID,jdbcType=INTEGER},
  842. </if>
  843. <if test="brokerage != null">
  844. #{brokerage,jdbcType=DECIMAL},
  845. </if>
  846. <if test="delFlag != null">
  847. #{delFlag,jdbcType=VARCHAR},
  848. </if>
  849. <if test="refundsAmount != null">
  850. #{refundsAmount,jdbcType=DECIMAL},
  851. </if>
  852. <if test="orderStatusFlag != null">
  853. #{orderStatusFlag,jdbcType=CHAR},
  854. </if>
  855. <if test="buyStatus != null">
  856. #{buyStatus,jdbcType=VARCHAR},
  857. </if>
  858. <if test="deliveryTimeMills != null">
  859. #{deliveryTimeMills,jdbcType=VARCHAR},
  860. </if>
  861. <if test="orderDeliveryID != null">
  862. #{orderDeliveryID,jdbcType=INTEGER},
  863. </if>
  864. <if test="splitFlag != null">
  865. #{splitFlag,jdbcType=CHAR},
  866. </if>
  867. <if test="receiptedFlag != null">
  868. #{receiptedFlag,jdbcType=VARCHAR},
  869. </if>
  870. <if test="receiptedType != null">
  871. #{receiptedType,jdbcType=VARCHAR},
  872. </if>
  873. <if test="paying != null">
  874. #{paying,jdbcType=CHAR},
  875. </if>
  876. <if test="shopProductAmount != null">
  877. #{shopProductAmount,jdbcType=DECIMAL},
  878. </if>
  879. <if test="shopPostFee != null">
  880. #{shopPostFee,jdbcType=DECIMAL},
  881. </if>
  882. <if test="shopTaxFee != null">
  883. #{shopTaxFee,jdbcType=DECIMAL},
  884. </if>
  885. <if test="shouldPayShopAmount != null">
  886. #{shouldPayShopAmount,jdbcType=DECIMAL},
  887. </if>
  888. <if test="payedShopAmount != null">
  889. #{payedShopAmount,jdbcType=DECIMAL},
  890. </if>
  891. <if test="shopOtherFee != null">
  892. #{shopOtherFee,jdbcType=DECIMAL},
  893. </if>
  894. <if test="costType != null">
  895. #{costType,jdbcType=CHAR},
  896. </if>
  897. <if test="proportional != null">
  898. #{proportional,jdbcType=DECIMAL},
  899. </if>
  900. <if test="modifyShouldPayNote != null">
  901. #{modifyShouldPayNote,jdbcType=VARCHAR},
  902. </if>
  903. <if test="modifyShouldPayUserID != null">
  904. #{modifyShouldPayUserID,jdbcType=BIGINT},
  905. </if>
  906. <if test="modifyShouldPayDate != null">
  907. #{modifyShouldPayDate,jdbcType=TIMESTAMP},
  908. </if>
  909. <if test="zeroCostFlag != null">
  910. #{zeroCostFlag,jdbcType=INTEGER},
  911. </if>
  912. <if test="splitCode != null">
  913. #{splitCode},
  914. </if>
  915. <if test="realPay != null">
  916. #{realPay},
  917. </if>
  918. <if test="eachDiscount != null">
  919. #{eachDiscount},
  920. </if>
  921. <if test="receiptAmount != null">
  922. #{receiptAmount},
  923. </if>
  924. <if test="receiptStatus != null">
  925. #{receiptStatus},
  926. </if>
  927. <if test="isColdChina != null">
  928. #{isColdChina},
  929. </if>
  930. <if test="shopPostFlag != null">
  931. #{shopPostFlag},
  932. </if>
  933. <if test="onlinePayWays != null">
  934. #{onlinePayWays},
  935. </if>
  936. <if test="shopStatus != null">
  937. #{shopStatus},
  938. </if>
  939. </trim>
  940. </insert>
  941. <insert id="insertOrderProduct" keyColumn="orderProductID" keyProperty="orderProductID"
  942. parameterType="com.caimei.model.po.CmOrderProductPo" useGeneratedKeys="true">
  943. INSERT INTO cm_order_product (orderID, orderNo, shopOrderID, shopOrderNo, organizeID, orderPromotionsId,
  944. productId, shopId,
  945. name,
  946. productImage, price, shopName, costPrice, normalPrice, ladderPriceFlag,
  947. discountPrice, discount,
  948. totalAmount, totalFee, shouldPayFee, productUnit, num, presentNum, discountFee,
  949. includedTax,
  950. invoiceType, taxRate, addedValueTax, totalAddedValueTax, supplierTaxRate,
  951. singleShouldPayTotalTax, shouldPayTotalTax,
  952. shopProductAmount, singleShopFee, shopFee, singleOtherFee, otherFee, singleCmFee,
  953. cmFee,
  954. payStatus, buyAgainFlag, notOutStore, isActProduct, productType, svipPriceFlag,
  955. svipPriceType,
  956. svipDiscount, svipReduction, skuID, cmPercent, organizePercent, shopPercent)
  957. VALUES (#{orderID}, #{orderNo}, #{shopOrderID}, #{shopOrderNo}, #{organizeID}, #{orderPromotionsId},
  958. #{productID}, #{shopID},
  959. #{name},
  960. #{productImage}, #{price}, #{shopName}, #{costPrice}, #{normalPrice}, #{ladderPriceFlag},
  961. #{discountPrice}, #{discount},
  962. #{totalAmount}, #{totalFee}, #{shouldPayFee}, #{productUnit}, #{num}, #{presentNum}, #{discountFee},
  963. #{includedTax},
  964. #{invoiceType}, #{taxRate}, #{addedValueTax}, #{totalAddedValueTax}, #{supplierTaxRate},
  965. #{singleShouldPayTotalTax}, #{shouldPayTotalTax},
  966. #{shopProductAmount}, #{singleShopFee}, #{shopFee}, #{singleOtherFee}, #{otherFee}, #{singleCmFee},
  967. #{cmFee},
  968. #{payStatus}, #{buyAgainFlag}, #{notOutStore}, #{isActProduct}, #{productType}, #{svipPriceFlag},
  969. #{svipPriceType}, #{svipDiscount}, #{svipReduction}, #{skuId}, #{cmPercent}, #{organizePercent},
  970. #{shopPercent})
  971. </insert>
  972. <insert id="insertOrderProductLadderPrice" keyColumn="id" keyProperty="id" useGeneratedKeys="true"
  973. parameterType="com.caimei.model.po.OrderProductLadderPricePo">
  974. insert into order_product_ladder_price (orderProductId, ladderNum, buyNum, buyPrice, createDate)
  975. values (#{orderProductId}, #{ladderNum}, #{buyNum}, #{buyPrice}, #{createDate})
  976. </insert>
  977. <update id="updateOrder" parameterType="com.caimei.model.po.CmOrderPo">
  978. update cm_order
  979. <set>
  980. <if test="orderNo != null">
  981. orderNo = #{orderNo,jdbcType=VARCHAR},
  982. </if>
  983. <if test="userID != null">
  984. userID = #{userID,jdbcType=BIGINT},
  985. </if>
  986. <if test="buyUserID != null">
  987. buyUserID = #{buyUserID,jdbcType=INTEGER},
  988. </if>
  989. <if test="shopOrderIDs != null">
  990. shopOrderIDs = #{shopOrderIDs,jdbcType=VARCHAR},
  991. </if>
  992. <if test="orderSubmitType != null">
  993. orderSubmitType = #{orderSubmitType,jdbcType=INTEGER},
  994. </if>
  995. <if test="orderType != null">
  996. orderType = #{orderType,jdbcType=INTEGER},
  997. </if>
  998. <if test="hasActProduct != null">
  999. hasActProduct = #{hasActProduct,jdbcType=CHAR},
  1000. </if>
  1001. <if test="status != null">
  1002. `status` = #{status,jdbcType=CHAR},
  1003. </if>
  1004. <if test="receiptStatus != null">
  1005. receiptStatus = #{receiptStatus,jdbcType=CHAR},
  1006. </if>
  1007. <if test="payStatus != null">
  1008. payStatus = #{payStatus,jdbcType=CHAR},
  1009. </if>
  1010. <if test="sendOutStatus != null">
  1011. sendOutStatus = #{sendOutStatus,jdbcType=CHAR},
  1012. </if>
  1013. <if test="refundType != null">
  1014. refundType = #{refundType,jdbcType=CHAR},
  1015. </if>
  1016. <if test="payFlag != null">
  1017. payFlag = #{payFlag,jdbcType=CHAR},
  1018. </if>
  1019. <if test="onlinePayFlag != null">
  1020. onlinePayFlag = #{onlinePayFlag,jdbcType=CHAR},
  1021. </if>
  1022. <if test="productTotalFee != null">
  1023. productTotalFee = #{productTotalFee,jdbcType=DECIMAL},
  1024. </if>
  1025. <if test="orderTotalFee != null">
  1026. orderTotalFee = #{orderTotalFee,jdbcType=DECIMAL},
  1027. </if>
  1028. <if test="payTotalFee != null">
  1029. payTotalFee = #{payTotalFee,jdbcType=DECIMAL},
  1030. </if>
  1031. <if test="payableAmount != null">
  1032. payableAmount = #{payableAmount,jdbcType=DECIMAL},
  1033. </if>
  1034. <if test="balancePayFee != null">
  1035. balancePayFee = #{balancePayFee,jdbcType=DECIMAL},
  1036. </if>
  1037. <if test="preferential != null">
  1038. preferential = #{preferential,jdbcType=DECIMAL},
  1039. </if>
  1040. <if test="discountFee != null">
  1041. discountFee = #{discountFee,jdbcType=DECIMAL},
  1042. </if>
  1043. <if test="spID != null">
  1044. spID = #{spID,jdbcType=BIGINT},
  1045. </if>
  1046. <if test="mainSpID != null">
  1047. mainSpID = #{mainSpID,jdbcType=BIGINT},
  1048. </if>
  1049. <if test="note != null">
  1050. note = #{note,jdbcType=VARCHAR},
  1051. </if>
  1052. <if test="clubID != null">
  1053. clubID = #{clubID,jdbcType=BIGINT},
  1054. </if>
  1055. <if test="clubScanTime != null">
  1056. clubScanTime = #{clubScanTime,jdbcType=VARCHAR},
  1057. </if>
  1058. <if test="orderSource != null">
  1059. orderSource = #{orderSource,jdbcType=CHAR},
  1060. </if>
  1061. <if test="closeTime != null">
  1062. closeTime = #{closeTime,jdbcType=VARCHAR},
  1063. </if>
  1064. <if test="confirmTime != null">
  1065. confirmTime = #{confirmTime,jdbcType=VARCHAR},
  1066. </if>
  1067. <if test="payTime != null">
  1068. payTime = #{payTime,jdbcType=VARCHAR},
  1069. </if>
  1070. <if test="orderTime != null">
  1071. orderTime = #{orderTime,jdbcType=VARCHAR},
  1072. </if>
  1073. <if test="productCount != null">
  1074. productCount = #{productCount,jdbcType=INTEGER},
  1075. </if>
  1076. <if test="presentCount != null">
  1077. presentCount = #{presentCount,jdbcType=INTEGER},
  1078. </if>
  1079. <if test="invoiceFlag != null">
  1080. invoiceFlag = #{invoiceFlag,jdbcType=CHAR},
  1081. </if>
  1082. <if test="confirmFlag != null">
  1083. confirmFlag = #{confirmFlag,jdbcType=CHAR},
  1084. </if>
  1085. <if test="clauseID != null">
  1086. clauseID = #{clauseID,jdbcType=BIGINT},
  1087. </if>
  1088. <if test="clauseContent != null">
  1089. clauseContent = #{clauseContent,jdbcType=VARCHAR},
  1090. </if>
  1091. <if test="clauseName != null">
  1092. clauseName = #{clauseName,jdbcType=VARCHAR},
  1093. </if>
  1094. <if test="updateDate != null">
  1095. updateDate = #{updateDate,jdbcType=VARCHAR},
  1096. </if>
  1097. <if test="freePostFlag != null">
  1098. freePostFlag = #{freePostFlag,jdbcType=CHAR},
  1099. </if>
  1100. <if test="freight != null">
  1101. freight = #{freight,jdbcType=DECIMAL},
  1102. </if>
  1103. <if test="delFlag != null">
  1104. delFlag = #{delFlag,jdbcType=CHAR},
  1105. </if>
  1106. <if test="freePostageTicketID != null">
  1107. freePostageTicketID = #{freePostageTicketID,jdbcType=INTEGER},
  1108. </if>
  1109. <if test="splitFlag != null">
  1110. splitFlag = #{splitFlag,jdbcType=CHAR},
  1111. </if>
  1112. <if test="closeReason != null">
  1113. closeReason = #{closeReason,jdbcType=VARCHAR},
  1114. </if>
  1115. <if test="postageOrderFlag != null">
  1116. postageOrderFlag = #{postageOrderFlag,jdbcType=CHAR},
  1117. </if>
  1118. <if test="affirmPaymentFlag != null">
  1119. affirmPaymentFlag = #{affirmPaymentFlag,jdbcType=CHAR},
  1120. </if>
  1121. <if test="rebateFlag != null">
  1122. rebateFlag = #{rebateFlag,jdbcType=CHAR},
  1123. </if>
  1124. <if test="zeroCostFlag != null">
  1125. zeroCostFlag = #{zeroCostFlag,jdbcType=INTEGER},
  1126. </if>
  1127. </set>
  1128. where orderID = #{orderID,jdbcType=BIGINT}
  1129. </update>
  1130. <update id="updateReceiveCouponStatus">
  1131. update cm_hehe_receive_coupon
  1132. set status = 2,
  1133. useTime = NOW(),
  1134. orderId = #{orderId}
  1135. where id = #{receiveCouponId}
  1136. </update>
  1137. <update id="updateReductionUserId">
  1138. update cm_hehe_reduction_user
  1139. set orderId = #{orderId}
  1140. where id = #{reductionUserId}
  1141. </update>
  1142. <select id="findByAddressId" resultType="com.caimei.model.vo.AddressVo">
  1143. SELECT a.addressID AS addressId,
  1144. a.userID AS userId,
  1145. a.shouHuoRen,
  1146. a.townID AS townId,
  1147. a.address,
  1148. a.postalCode,
  1149. a.phone,
  1150. a.mobile,
  1151. a.defaultFlag,
  1152. c.cityID AS cityId,
  1153. p.provinceID AS provinceId,
  1154. t.name AS townName,
  1155. c.name AS cityName,
  1156. p.name AS provinceName
  1157. FROM address a
  1158. LEFT JOIN town t ON t.townID = a.townID
  1159. LEFT JOIN city c ON c.cityID = t.cityID
  1160. LEFT JOIN province p ON p.provinceID = c.provinceID
  1161. WHERE a.addressID = #{addressId}
  1162. </select>
  1163. <insert id="insertUserInfo" keyColumn="id" keyProperty="id" parameterType="com.caimei.model.po.BpOrderUserInfoPo"
  1164. useGeneratedKeys="true">
  1165. insert into bp_order_userinfo
  1166. <trim prefix="(" suffix=")" suffixOverrides=",">
  1167. <if test="orderId != null">
  1168. orderId,
  1169. </if>
  1170. <if test="clubId != null">
  1171. clubId,
  1172. </if>
  1173. <if test="userId != null">
  1174. userId,
  1175. </if>
  1176. <if test="name != null">
  1177. `name`,
  1178. </if>
  1179. <if test="shouHuoRen != null">
  1180. shouHuoRen,
  1181. </if>
  1182. <if test="mobile != null">
  1183. mobile,
  1184. </if>
  1185. <if test="phone != null">
  1186. phone,
  1187. </if>
  1188. <if test="postalCode != null">
  1189. postalCode,
  1190. </if>
  1191. <if test="townId != null">
  1192. townId,
  1193. </if>
  1194. <if test="province != null">
  1195. province,
  1196. </if>
  1197. <if test="city != null">
  1198. city,
  1199. </if>
  1200. <if test="town != null">
  1201. town,
  1202. </if>
  1203. <if test="address != null">
  1204. address,
  1205. </if>
  1206. </trim>
  1207. <trim prefix="values (" suffix=")" suffixOverrides=",">
  1208. <if test="orderId != null">
  1209. #{orderId,jdbcType=BIGINT},
  1210. </if>
  1211. <if test="clubId != null">
  1212. #{clubId,jdbcType=BIGINT},
  1213. </if>
  1214. <if test="userId != null">
  1215. #{userId,jdbcType=BIGINT},
  1216. </if>
  1217. <if test="name != null">
  1218. #{name,jdbcType=VARCHAR},
  1219. </if>
  1220. <if test="shouHuoRen != null">
  1221. #{shouHuoRen,jdbcType=VARCHAR},
  1222. </if>
  1223. <if test="mobile != null">
  1224. #{mobile,jdbcType=VARCHAR},
  1225. </if>
  1226. <if test="phone != null">
  1227. #{phone,jdbcType=VARCHAR},
  1228. </if>
  1229. <if test="postalCode != null">
  1230. #{postalCode,jdbcType=VARCHAR},
  1231. </if>
  1232. <if test="townId != null">
  1233. #{townId,jdbcType=INTEGER},
  1234. </if>
  1235. <if test="province != null">
  1236. #{province,jdbcType=VARCHAR},
  1237. </if>
  1238. <if test="city != null">
  1239. #{city,jdbcType=VARCHAR},
  1240. </if>
  1241. <if test="town != null">
  1242. #{town,jdbcType=VARCHAR},
  1243. </if>
  1244. <if test="address != null">
  1245. #{address,jdbcType=VARCHAR},
  1246. </if>
  1247. </trim>
  1248. </insert>
  1249. <insert id="insertCouponOrderRecord">
  1250. INSERT INTO cm_hehe_coupon_order_record (orderId, receiveCouponId, couponType, couponAmount, touchPrice,
  1251. createDate)
  1252. VALUES (#{orderId}, #{receiveCouponId}, #{couponType}, #{couponAmount}, #{touchPrice}, #{createDate})
  1253. </insert>
  1254. <insert id="insertReductionUser" keyColumn="id" keyProperty="reductionUserId"
  1255. parameterType="com.caimei.model.po.ReductionUserPo" useGeneratedKeys="true">
  1256. insert into cm_hehe_reduction_user (userId, reductionId, shareType, touchPrice, reductionAmount, shareTime)
  1257. values (#{userId}, #{reductionId}, #{shareType}, #{touchPrice}, #{reducedAmount}, NOW())
  1258. </insert>
  1259. <select id="findShopByProductId" resultType="com.caimei.model.vo.ShopVo">
  1260. SELECT s.shopID AS shopId,
  1261. s.name,
  1262. s.logo,
  1263. p.returnGoodsStutas,
  1264. p.splitCode
  1265. FROM cm_hehe_product chp
  1266. LEFT JOIN product p ON chp.productId = p.productID
  1267. LEFT JOIN shop s ON p.shopID = s.shopID
  1268. WHERE chp.productId = (SELECT productId FROM cm_hehe_sku WHERE skuId=#{skuId})
  1269. AND chp.validFlag = 1
  1270. </select>
  1271. <select id="findProductById" resultType="com.caimei.model.vo.CartProductVo">
  1272. SELECT cs.skuId,
  1273. chp.productId,
  1274. chs.price,
  1275. chs.price as normalPrice,
  1276. chp.includedTax,
  1277. chp.invoiceType,
  1278. chp.clubTaxPoint,
  1279. cs.cmPercent,
  1280. cs.organizePercent,
  1281. cs.shopPercent,
  1282. copi.costCheckFlag,
  1283. p.name,
  1284. p.shopID AS shopId,
  1285. p.mainImage as productImage,
  1286. cs.unit as productUnit
  1287. FROM cm_hehe_product chp
  1288. LEFT JOIN product p ON chp.productId = p.productID
  1289. left join cm_organize_product_info copi on copi.productId = p.productID and copi.organizeId=(SELECT SUBSTRING(groundMall, 1, 1)FROM product WHERE productID=p.productId)
  1290. LEFT JOIN cm_sku cs on p.productID=cs.productId
  1291. LEFT JOIN cm_hehe_sku chs on chs.skuId=cs.skuId
  1292. WHERE chp.validFlag = 1
  1293. AND cs.skuId = #{skuId}
  1294. </select>
  1295. <select id="findCartProducts" resultType="com.caimei.model.vo.CartProductVo">
  1296. SELECT
  1297. cc.cm_cartID AS cartId,
  1298. cc.productID AS productId,
  1299. cc.productCount as num,
  1300. cc.heUserId,
  1301. chp.includedTax,
  1302. chp.invoiceType,
  1303. chp.clubTaxPoint,
  1304. p.name,
  1305. p.shopID AS shopId,
  1306. p.mainImage as productImage,
  1307. FROM
  1308. cm_cart cc
  1309. LEFT JOIN cm_hehe_product chp ON cc.productID = chp.productId
  1310. LEFT JOIN product p ON cc.productID = p.productID
  1311. WHERE
  1312. chp.validFlag = 1
  1313. AND cc.cm_cartID IN
  1314. <foreach item="cartId" index="index" collection="cartIds" open="(" separator="," close=")">
  1315. #{cartId}
  1316. </foreach>
  1317. </select>
  1318. <select id="findCurrentReduction" resultType="com.caimei.model.vo.ReductionVo">
  1319. select id as reductionId, reducedAmount, touchPrice, shareNum
  1320. from cm_hehe_reduction
  1321. where NOW() <![CDATA[ >= ]]> startTime
  1322. and NOW() <![CDATA[ <= ]]> endTime
  1323. </select>
  1324. <select id="findShareNum" resultType="java.lang.Integer">
  1325. select count(*)
  1326. from cm_hehe_reduction_user
  1327. where userId = #{userId}
  1328. and reductionId = #{reductionId}
  1329. </select>
  1330. <select id="findReduction" resultType="com.caimei.model.vo.ReductionVo">
  1331. select chr.id as reductionId, reducedAmount, chr.touchPrice
  1332. from cm_hehe_reduction chr
  1333. left join cm_hehe_reduction_user chru on chr.id = chru.reductionId
  1334. where chru.id = #{reductionUserId}
  1335. and chru.orderId is null
  1336. </select>
  1337. <select id="getHelpContent" resultType="java.lang.String">
  1338. select content from helppage where helpPageID=#{helpId}
  1339. </select>
  1340. </mapper>