ShopOrderMapper.xml 139 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528
  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.caimei.modules.order.dao.NewShopOrderDao">
  4. <sql id="shopOrderColumns">
  5. co.rebateFee as rebateFee,
  6. co.couponAmount as couponAmount,
  7. co.userBeans as userBeans,
  8. a.shopOrderID AS shopOrderID,
  9. a.shopStatus AS status,
  10. a.shopPostFlag AS shopPostFlag,
  11. a.orderID AS orderID,
  12. a.organizeID AS organizeID,
  13. a.shopOrderNo AS shopOrderNo,
  14. a.orderNo AS orderNo,
  15. a.userID AS userID,
  16. a.shopID AS shopID,
  17. a.isColdChina AS isColdChina,
  18. a.itemCount AS itemCount,
  19. a.townID AS townID,
  20. a.productAmount AS productAmount,
  21. a.discountAmount AS discountAmount,
  22. a.accountAmount AS accountAmount,
  23. a.totalAmount AS totalAmount,
  24. a.payFlag AS payFlag,
  25. a.payTime AS payTime,
  26. a.finishTime AS finishTime,
  27. a.refundStatus AS refundStatus,
  28. a.needPayAmount AS needPayAmount,
  29. a.splitCode,
  30. ifnull(a.realPay, a.needPayAmount) AS realPay,
  31. a.eachDiscount AS eachDiscount,
  32. ifnull(a.receiptAmount,0) AS receiptAmount,
  33. (ifnull(a.realPay,0) - ifnull(a.receiptAmount,0)) as restAmount,
  34. a.receiptStatus as shopReceiptStatus,
  35. a.receiptStatus as ReceiptStatus,
  36. a.canRefundAmount AS canRefundAmount,
  37. a.refundAmount AS refundAmount,
  38. a.clubID AS clubID,
  39. a.spID AS spID,
  40. a.mainSpID AS mainSpID,
  41. a.orderBeanAmount AS orderBeanAmount,
  42. a.useBeanAmount AS useBeanAmount,
  43. a.useBeanFlag AS useBeanFlag,
  44. a.canRefundFlag AS canRefundFlag,
  45. a.useBalanceFlag AS useBalanceFlag,
  46. a.canRefundBeans AS canRefundBeans,
  47. a.freePostageFee AS freePostageFee,
  48. a.freePostageTicketID AS freePostageTicketID,
  49. a.brokerage AS brokerage,
  50. a.delFlag AS delFlag,
  51. a.refundsAmount AS refundsAmount,
  52. a.orderStatusFlag AS orderStatusFlag,
  53. a.buyStatus AS buyStatus,
  54. a.orderSubmitType AS orderSubmitType,
  55. a.orderType AS orderType,
  56. a.orderTime AS orderTime,
  57. a.deliveryTimeMills AS deliveryTimeMills,
  58. a.presentNum AS presentNum,
  59. a.preferential AS preferential,
  60. a.outStoreNum AS outStoreNum,
  61. IFNULL(a.outStoreTimes, 0) AS outStoreTimes,
  62. a.splitFlag AS splitFlag,
  63. a.autoReceiveTimeMills AS autoReceiveTimeMills,
  64. a.autoOverTimeMills AS autoOverTimeMills,
  65. a.receiveGoodsTime AS receiveGoodsTime,
  66. a.totalAddedValueTax AS totalAddedValueTax,
  67. a.note AS note,
  68. a.payStatus AS payStatus,
  69. a.sendOutStatus AS sendOutStatus,
  70. a.shopProductAmount AS shopProductAmount,
  71. a.shopPostFee AS shopPostFee,
  72. a.shopTaxFee AS shopTaxFee,
  73. a.shouldPayShopAmount AS shouldPayShopAmount,
  74. a.payedShopAmount AS payedShopAmount,
  75. a.shopOtherFee AS shopOtherFee,
  76. a.paying AS paying,
  77. a.costType AS costType,
  78. a.settleStatus AS settleStatus,
  79. a.modifyShouldPayNote AS modifyShouldPayNote,
  80. a.orderPromotionsId AS orderPromotionsId,
  81. a.differenceType AS differenceType,
  82. a.differencePrice AS differencePrice,
  83. a.proportional AS proportional,
  84. a.promotionFullReduction As promotionFullReduction,
  85. a.zeroCostFlag AS zeroCostFlag
  86. </sql>
  87. <select id="get" resultType="NewShopOrder" useCache="false" flushCache="true">
  88. select
  89. <include refid="shopOrderColumns"/>
  90. from cm_shop_order a
  91. left join cm_order co on co.orderID = a.orderID
  92. where a.shopOrderID = #{shopOrderID}
  93. </select>
  94. <delete id="deleteByOrderID">
  95. DELETE
  96. FROM cm_shop_order
  97. WHERE orderID = #{orderID}
  98. </delete>
  99. <insert id="insert" parameterType="NewShopOrder" keyProperty="shopOrderID" useGeneratedKeys="true">
  100. INSERT INTO cm_shop_order(orderID,
  101. shopOrderNo,
  102. orderNo,
  103. userID,
  104. shopID,
  105. itemCount,
  106. townID,
  107. productAmount,
  108. discountAmount,
  109. accountAmount,
  110. totalAmount,
  111. payFlag,
  112. payTime,
  113. finishTime,
  114. refundStatus,
  115. needPayAmount,
  116. canRefundAmount,
  117. refundAmount,
  118. clubID,
  119. spID,
  120. mainSpID,
  121. orderBeanAmount,
  122. useBeanAmount,
  123. useBeanFlag,
  124. canRefundFlag,
  125. useBalanceFlag,
  126. canRefundBeans,
  127. freePostageFee,
  128. freePostageTicketID,
  129. brokerage,
  130. delFlag,
  131. refundsAmount,
  132. orderStatusFlag,
  133. buyStatus,
  134. orderSubmitType,
  135. orderType,
  136. orderTime,
  137. deliveryTimeMills,
  138. presentNum,
  139. preferential,
  140. splitFlag,
  141. autoReceiveTimeMills,
  142. autoOverTimeMills,
  143. totalAddedValueTax,
  144. receiveGoodsTime,
  145. sendOutStatus,
  146. payStatus,
  147. costType,
  148. orderPromotionsId,
  149. promotionFullReduction,
  150. zeroCostFlag,
  151. svipShopReduction,
  152. realPay,
  153. eachDiscount,
  154. receiptStatus,
  155. receiptAmount,
  156. splitCode)
  157. VALUES (#{orderID},
  158. #{shopOrderNo},
  159. #{orderNo},
  160. #{userID},
  161. #{shopID},
  162. #{itemCount},
  163. #{townID},
  164. #{productAmount},
  165. #{discountAmount},
  166. #{accountAmount},
  167. #{totalAmount},
  168. #{payFlag},
  169. #{payTime},
  170. #{finishTime},
  171. #{refundStatus},
  172. #{needPayAmount},
  173. #{canRefundAmount},
  174. #{refundAmount},
  175. #{clubID},
  176. #{spID},
  177. #{mainSpID},
  178. #{orderBeanAmount},
  179. #{useBeanAmount},
  180. #{useBeanFlag},
  181. #{canRefundFlag},
  182. #{useBalanceFlag},
  183. #{canRefundBeans},
  184. #{freePostageFee},
  185. #{freePostageTicketID},
  186. #{brokerage},
  187. #{delFlag},
  188. #{refundsAmount},
  189. #{orderStatusFlag},
  190. #{buyStatus},
  191. #{orderSubmitType},
  192. #{orderType},
  193. #{orderTime},
  194. #{deliveryTimeMills},
  195. #{presentNum},
  196. #{preferential},
  197. #{splitFlag},
  198. #{autoReceiveTimeMills},
  199. #{autoOverTimeMills},
  200. #{totalAddedValueTax},
  201. #{receiveGoodsTime},
  202. #{sendOutStatus},
  203. #{payStatus},
  204. #{costType},
  205. #{orderPromotionsId},
  206. #{promotionFullReduction},
  207. #{zeroCostFlag},
  208. #{svipShopReduction},
  209. #{realPay},
  210. #{eachDiscount},
  211. #{shopReceiptStatus},
  212. #{receiptAmount},
  213. #{splitCode})
  214. </insert>
  215. <select id="findByShopOrderID" resultType="newShopOrder">
  216. select
  217. <include refid="shopOrderColumns"/>
  218. from cm_shop_order a
  219. left join cm_order co on co.orderID = a.orderID
  220. where a.shopOrderID = #{shopOrderID}
  221. </select>
  222. <select id="findByPayShopID" resultType="java.lang.Double">
  223. SELECT SUM(cpsr.payAmount)
  224. FROM cm_pay_shop cps
  225. LEFT JOIN cm_pay_shop_record cpsr ON cpsr.payShopID = cps.id
  226. WHERE cpsr.delFlag = 0
  227. AND cps.delFlag = 0
  228. AND cpsr.shopOrderId = #{shopOrderID}
  229. </select>
  230. <select id="findList" resultType="newShopOrder">
  231. SELECT
  232. <include refid="shopOrderColumns"/>
  233. FROM cm_shop_order a
  234. left join cm_order co on co.orderID = a.orderID
  235. <where>
  236. <if test="shopOrderNo != null and itemCount != ''">
  237. AND a.shopOrderNo = #{shopOrderNo}
  238. </if>
  239. <if test="orderNo != null and itemCount != ''">
  240. AND a.orderNo = #{orderNo}
  241. </if>
  242. <if test="orderID != null and itemCount != ''">
  243. AND a.orderID = #{orderID}
  244. </if>
  245. <if test="userID != null and itemCount != ''">
  246. AND a.userID = #{userID}
  247. </if>
  248. <if test="shopID != null and itemCount != ''">
  249. AND a.shopID = #{shopID}
  250. </if>
  251. <if test="payFlag != null and itemCount != ''">
  252. AND a.payFlag = #{payFlag}
  253. </if>
  254. </where>
  255. <choose>
  256. <when test="page !=null and page.orderBy != null and page.orderBy != ''">
  257. ORDER BY ${page.orderBy}
  258. </when>
  259. <otherwise>
  260. </otherwise>
  261. </choose>
  262. </select>
  263. <select id="findListByOrderID" resultType="newShopOrder">
  264. SELECT<include refid="shopOrderColumns"/>,
  265. b.name as shopName,
  266. oa.id as orderArchiveId,
  267. co.receiptStatus
  268. FROM cm_shop_order a
  269. left join shop b on a.shopID = b.shopID
  270. left join cm_order_archive oa on a.shopOrderID = oa.shopOrderId
  271. left join cm_order co on co.orderID = a.orderID
  272. WHERE a.orderID = #{orderID} ORDER BY a.shopOrderNo DESC
  273. </select>
  274. <select id="findCommercialCode" resultType="String">
  275. select commercialCode
  276. FROM cm_shop_order a
  277. left join cm_shop_splitcode css on a.shopID = css.shopId
  278. WHERE a.orderID = #{orderID}
  279. </select>
  280. <update id="update" parameterType="newShopOrder">
  281. update cm_shop_order
  282. <set>
  283. <if test="shopOrderNo != null and shopOrderNo != ''">
  284. shopOrderNo = #{shopOrderNo},
  285. </if>
  286. <if test="status != null and status != ''">
  287. shopStatus = #{status},
  288. </if>
  289. <if test="confirmTime != null and confirmTime != ''">
  290. confirmTime = #{confirmTime},
  291. </if>
  292. <if test="shopOrderNo != null and shopOrderNo != ''">
  293. orderID = #{orderID},
  294. </if>
  295. <if test="orderNo != null and orderNo != ''">
  296. orderNo = #{orderNo},
  297. </if>
  298. <if test="userID != null and userID != ''">
  299. userID = #{userID},
  300. </if>
  301. <if test="shopID != null and shopID != ''">
  302. shopID = #{shopID},
  303. </if>
  304. <if test="itemCount != null and itemCount != ''">
  305. itemCount = #{itemCount},
  306. </if>
  307. <if test="townID != null and itemCount != ''">
  308. townID = #{townID,jdbcType=INTEGER},
  309. </if>
  310. <if test="productAmount != null and productAmount != ''">
  311. productAmount = #{productAmount},
  312. </if>
  313. <if test="discountAmount != null and discountAmount != ''">
  314. discountAmount = #{discountAmount},
  315. </if>
  316. <if test="accountAmount != null and accountAmount != ''">
  317. accountAmount = #{accountAmount},
  318. </if>
  319. <if test="totalAmount != null and totalAmount != ''">
  320. totalAmount = #{totalAmount},
  321. </if>
  322. <if test="payFlag != null and payFlag != ''">
  323. payFlag = #{payFlag},
  324. </if>
  325. <if test="payTime != null and payTime != ''">
  326. payTime = #{payTime},
  327. </if>
  328. <if test="finishTime != null and finishTime != ''">
  329. finishTime = #{finishTime},
  330. </if>
  331. <if test="refundStatus != null and refundStatus != ''">
  332. refundStatus = #{refundStatus},
  333. </if>
  334. <if test="needPayAmount != null and needPayAmount != ''">
  335. needPayAmount = #{needPayAmount},
  336. </if>
  337. <if test="canRefundAmount != null and canRefundAmount != ''">
  338. canRefundAmount = #{canRefundAmount},
  339. </if>
  340. <if test="refundAmount != null and refundAmount != ''">
  341. refundAmount = #{refundAmount},
  342. </if>
  343. <if test="clubID != null and clubID != ''">
  344. clubID = #{clubID},
  345. </if>
  346. <if test="spID != null and itemCount != ''">
  347. spID = #{spID,jdbcType=INTEGER},
  348. </if>
  349. <if test="mainSpID != null and mainSpID != ''">
  350. mainSpID = #{mainSpID},
  351. </if>
  352. <if test="orderBeanAmount != null and orderBeanAmount != ''">
  353. orderBeanAmount = #{orderBeanAmount},
  354. </if>
  355. <if test="useBeanAmount != null and useBeanAmount != ''">
  356. useBeanAmount = #{useBeanAmount},
  357. </if>
  358. <if test="useBeanFlag != null and useBeanFlag != ''">
  359. useBeanFlag = #{useBeanFlag},
  360. </if>
  361. <if test="canRefundFlag != null and canRefundFlag != ''">
  362. canRefundFlag = #{canRefundFlag},
  363. </if>
  364. <if test="useBalanceFlag != null and useBalanceFlag != ''">
  365. useBalanceFlag = #{useBalanceFlag},
  366. </if>
  367. <if test="canRefundBeans != null and canRefundBeans != ''">
  368. canRefundBeans = #{canRefundBeans},
  369. </if>
  370. <if test="freePostageFee != null and freePostageFee != ''">
  371. freePostageFee = #{freePostageFee},
  372. </if>
  373. <if test="freePostageTicketID != null and freePostageTicketID != ''">
  374. freePostageTicketID = #{freePostageTicketID},
  375. </if>
  376. <if test="brokerage != null and brokerage != ''">
  377. brokerage = #{brokerage},
  378. </if>
  379. <if test="delFlag != null and delFlag != ''">
  380. delFlag = #{delFlag},
  381. </if>
  382. <if test="refundsAmount != null and refundsAmount != ''">
  383. refundsAmount = #{refundsAmount},
  384. </if>
  385. <if test="orderStatusFlag != null and orderStatusFlag != ''">
  386. orderStatusFlag = #{orderStatusFlag},
  387. </if>
  388. <if test="buyStatus != null and buyStatus != ''">
  389. buyStatus = #{buyStatus},
  390. </if>
  391. <if test="deliveryTimeMills != null and deliveryTimeMills != ''">
  392. deliveryTimeMills = #{deliveryTimeMills},
  393. </if>
  394. <if test="orderSubmitType != null and orderSubmitType != ''">
  395. orderSubmitType = #{orderSubmitType},
  396. </if>
  397. <if test="orderType != null and orderType != ''">
  398. orderType = #{orderType},
  399. </if>
  400. <if test="orderTime != null and orderTime != ''">
  401. orderTime = #{orderTime},
  402. </if>
  403. <if test="presentNum != null and presentNum != ''">
  404. presentNum = #{presentNum},
  405. </if>
  406. <if test="preferential != null and preferential != ''">
  407. preferential = #{preferential},
  408. </if>
  409. <if test="outStoreNum != null and outStoreNum != ''">
  410. outStoreNum = #{outStoreNum},
  411. </if>
  412. <if test="outStoreTimes != null and outStoreTimes != ''">
  413. outStoreTimes = #{outStoreTimes},
  414. </if>
  415. <if test="splitFlag != null and splitFlag != ''">
  416. splitFlag = #{splitFlag},
  417. </if>
  418. <if test="autoReceiveTimeMills != null and autoReceiveTimeMills != ''">
  419. autoReceiveTimeMills = #{autoReceiveTimeMills},
  420. </if>
  421. <if test="autoOverTimeMills != null and autoOverTimeMills != ''">
  422. autoOverTimeMills = #{autoOverTimeMills},
  423. </if>
  424. <if test="receiveGoodsTime != null and receiveGoodsTime != ''">
  425. receiveGoodsTime = #{receiveGoodsTime},
  426. </if>
  427. <if test="totalAddedValueTax != null and totalAddedValueTax != ''">
  428. totalAddedValueTax = #{totalAddedValueTax},
  429. </if>
  430. <if test="note != null and note != ''">
  431. note = #{note},
  432. </if>
  433. <if test="sendOutStatus != null and sendOutStatus != ''">
  434. sendOutStatus = #{sendOutStatus},
  435. </if>
  436. <if test="paying != null and paying != ''">
  437. paying = #{paying},
  438. </if>
  439. <if test="shopProductAmount != null">
  440. shopProductAmount = #{shopProductAmount},
  441. </if>
  442. <if test="shopPostFee != null">
  443. shopPostFee = #{shopPostFee},
  444. </if>
  445. <if test="shopTaxFee != null">
  446. shopTaxFee = #{shopTaxFee},
  447. </if>
  448. <if test="shouldPayShopAmount != null">
  449. shouldPayShopAmount = #{shouldPayShopAmount},
  450. </if>
  451. <if test="payedShopAmount != null">
  452. payedShopAmount = #{payedShopAmount},
  453. </if>
  454. <if test="shopOtherFee != null">
  455. shopOtherFee = #{shopOtherFee},
  456. </if>
  457. <if test="payStatus != null">
  458. payStatus = #{payStatus},
  459. </if>
  460. <if test="costType != null">
  461. costType = #{costType},
  462. </if>
  463. <if test="proportional != null">
  464. proportional = #{proportional},
  465. </if>
  466. <if test="modifyShouldPayNote != null">
  467. modifyShouldPayNote = #{modifyShouldPayNote},
  468. </if>
  469. <if test="modifyShouldPayUserID != null">
  470. modifyShouldPayUserID = #{modifyShouldPayUserID},
  471. </if>
  472. <if test="modifyShouldPayDate != null">
  473. modifyShouldPayDate = #{modifyShouldPayDate},
  474. </if>
  475. <if test="orderPromotionsId != null">
  476. orderPromotionsId = #{orderPromotionsId},
  477. </if>
  478. <if test="promotionFullReduction != null">
  479. promotionFullReduction = #{promotionFullReduction},
  480. </if>
  481. <if test="zeroCostFlag != null">
  482. zeroCostFlag = #{zeroCostFlag},
  483. </if>
  484. <if test="svipShopReduction != null">
  485. svipShopReduction = #{svipShopReduction},
  486. </if>
  487. <if test="realPay != null">
  488. realPay = #{realPay},
  489. </if>
  490. <if test="eachDiscount != null">
  491. eachDiscount = #{eachDiscount},
  492. </if>
  493. <if test="receiptStatus != null">
  494. receiptStatus = #{receiptStatus},
  495. </if>
  496. <if test="receiptAmount != null">
  497. receiptAmount = #{receiptAmount},
  498. </if>
  499. <if test="splitCode != null">
  500. splitCode = #{splitCode},
  501. </if>
  502. </set>
  503. <where>
  504. <if test="shopOrderID != null and shopOrderID != ''">
  505. AND shopOrderID = #{shopOrderID}
  506. </if>
  507. <if test="orderID != null and orderID != ''">
  508. AND orderID = #{orderID}
  509. </if>
  510. </where>
  511. </update>
  512. <delete id="delete">
  513. DELETE
  514. FROM cm_shop_order
  515. WHERE shopOrderID = #{shopOrderID}
  516. </delete>
  517. <select id="findIDsByOrderID" resultType="int">
  518. select shopOrderID
  519. from cm_shop_order
  520. where orderID = #{orderID}
  521. </select>
  522. <update id="updateNote">
  523. UPDATE cm_shop_order
  524. SET note = #{note}
  525. WHERE shopOrderID = #{shopOrderID}
  526. </update>
  527. <select id="findShopOrderNum" resultType="int">
  528. select count(1)
  529. from cm_shop_order
  530. where orderID = #{orderID}
  531. </select>
  532. <update id="updateByShopOrderID" parameterType="newShopOrder">
  533. update cm_shop_order
  534. <set>
  535. <if test="status != null and status != ''">
  536. shopStatus = #{status},
  537. </if>
  538. <if test="shopOrderNo != null and shopOrderNo != ''">
  539. shopOrderNo = #{shopOrderNo},
  540. </if>
  541. <if test="orderID != null and orderID != ''">
  542. orderID = #{orderID},
  543. </if>
  544. <if test="orderNo != null and orderNo != ''">
  545. orderNo = #{orderNo},
  546. </if>
  547. <if test="userID != null and userID != ''">
  548. userID = #{userID},
  549. </if>
  550. <if test="shopID != null and shopID != ''">
  551. shopID = #{shopID},
  552. </if>
  553. <if test="itemCount != null and itemCount != ''">
  554. itemCount = #{itemCount},
  555. </if>
  556. <if test="townID != null and itemCount != ''">
  557. townID = #{townID,jdbcType=INTEGER},
  558. </if>
  559. <if test="productAmount != null and productAmount != ''">
  560. productAmount = #{productAmount},
  561. </if>
  562. <if test="discountAmount != null and discountAmount != ''">
  563. discountAmount = #{discountAmount},
  564. </if>
  565. <if test="accountAmount != null and accountAmount != ''">
  566. accountAmount = #{accountAmount},
  567. </if>
  568. <if test="totalAmount != null and totalAmount != ''">
  569. totalAmount = #{totalAmount},
  570. </if>
  571. <if test="payFlag != null and payFlag != ''">
  572. payFlag = #{payFlag},
  573. </if>
  574. <if test="payTime != null and payTime != ''">
  575. payTime = #{payTime},
  576. </if>
  577. <if test="finishTime != null and finishTime != ''">
  578. finishTime = #{finishTime},
  579. </if>
  580. <if test="refundStatus != null and refundStatus != ''">
  581. refundStatus = #{refundStatus},
  582. </if>
  583. <if test="needPayAmount != null and needPayAmount != ''">
  584. needPayAmount = #{needPayAmount},
  585. </if>
  586. <if test="canRefundAmount != null and canRefundAmount != ''">
  587. canRefundAmount = #{canRefundAmount},
  588. </if>
  589. <if test="refundAmount != null and refundAmount != ''">
  590. refundAmount = #{refundAmount},
  591. </if>
  592. <if test="clubID != null and clubID != ''">
  593. clubID = #{clubID},
  594. </if>
  595. <if test="spID != null and itemCount != ''">
  596. spID = #{spID,jdbcType=INTEGER},
  597. </if>
  598. <if test="mainSpID != null and mainSpID != ''">
  599. mainSpID = #{mainSpID},
  600. </if>
  601. <if test="orderBeanAmount != null and orderBeanAmount != ''">
  602. orderBeanAmount = #{orderBeanAmount},
  603. </if>
  604. <if test="useBeanAmount != null and useBeanAmount != ''">
  605. useBeanAmount = #{useBeanAmount},
  606. </if>
  607. <if test="useBeanFlag != null and useBeanFlag != ''">
  608. useBeanFlag = #{useBeanFlag},
  609. </if>
  610. <if test="canRefundFlag != null and canRefundFlag != ''">
  611. canRefundFlag = #{canRefundFlag},
  612. </if>
  613. <if test="useBalanceFlag != null and useBalanceFlag != ''">
  614. useBalanceFlag = #{useBalanceFlag},
  615. </if>
  616. <if test="canRefundBeans != null and canRefundBeans != ''">
  617. canRefundBeans = #{canRefundBeans},
  618. </if>
  619. <if test="freePostageFee != null and freePostageFee != ''">
  620. freePostageFee = #{freePostageFee},
  621. </if>
  622. <if test="freePostageTicketID != null and freePostageTicketID != ''">
  623. freePostageTicketID = #{freePostageTicketID},
  624. </if>
  625. <if test="brokerage != null and brokerage != ''">
  626. brokerage = #{brokerage},
  627. </if>
  628. <if test="delFlag != null and delFlag != ''">
  629. delFlag = #{delFlag},
  630. </if>
  631. <if test="refundsAmount != null and refundsAmount != ''">
  632. refundsAmount = #{refundsAmount},
  633. </if>
  634. <if test="orderStatusFlag != null and orderStatusFlag != ''">
  635. orderStatusFlag = #{orderStatusFlag},
  636. </if>
  637. <if test="buyStatus != null and buyStatus != ''">
  638. buyStatus = #{buyStatus},
  639. </if>
  640. <if test="deliveryTimeMills != null and deliveryTimeMills != ''">
  641. deliveryTimeMills = #{deliveryTimeMills},
  642. </if>
  643. <if test="orderSubmitType != null and orderSubmitType != ''">
  644. orderSubmitType = #{orderSubmitType},
  645. </if>
  646. <if test="orderType != null and orderType != ''">
  647. orderType = #{orderType},
  648. </if>
  649. <if test="orderTime != null and orderTime != ''">
  650. orderTime = #{orderTime},
  651. </if>
  652. <if test="presentNum != null and presentNum != ''">
  653. presentNum = #{presentNum},
  654. </if>
  655. <if test="preferential != null and preferential != ''">
  656. preferential = #{preferential},
  657. </if>
  658. <if test="outStoreNum != null and outStoreNum != ''">
  659. outStoreNum = #{outStoreNum},
  660. </if>
  661. <if test="outStoreTimes != null and outStoreTimes != ''">
  662. outStoreTimes = #{outStoreTimes},
  663. </if>
  664. <if test="splitFlag != null and splitFlag != ''">
  665. splitFlag = #{splitFlag},
  666. </if>
  667. <if test="autoReceiveTimeMills != null and autoReceiveTimeMills != ''">
  668. autoReceiveTimeMills = #{autoReceiveTimeMills},
  669. </if>
  670. <if test="autoOverTimeMills != null and autoOverTimeMills != ''">
  671. autoOverTimeMills = #{autoOverTimeMills},
  672. </if>
  673. <if test="receiveGoodsTime != null and receiveGoodsTime != ''">
  674. receiveGoodsTime = #{receiveGoodsTime},
  675. </if>
  676. <if test="totalAddedValueTax != null and totalAddedValueTax != ''">
  677. totalAddedValueTax = #{totalAddedValueTax},
  678. </if>
  679. <if test="note != null and note != ''">
  680. note = #{note},
  681. </if>
  682. <if test="sendOutStatus != null and sendOutStatus != ''">
  683. sendOutStatus = #{sendOutStatus}
  684. </if>
  685. </set>
  686. where shopOrderID = #{shopOrderID}
  687. </update>
  688. <select id="findPayOrderList" resultType="newShopOrder">
  689. select<include refid="shopOrderColumns"/>,
  690. co.payTotalFee AS payTotalFee,
  691. bou.name AS buyer,
  692. s.name AS shopName,
  693. c.name AS clubName,
  694. cdr.payWay AS payWay
  695. from cm_shop_order a
  696. left join cm_pay_shop_record cpsr on a.shopOrderID = cpsr.shopOrderID
  697. left join bp_order_userinfo bou on bou.orderId = a.orderID
  698. left join cm_order co on co.orderID = a.orderID
  699. LEFT JOIN cm_receipt_order_relation cror ON cror.orderId = co.orderId
  700. LEFT JOIN cm_discern_receipt cdr ON cror.receiptID = cdr.id
  701. left join shop s on s.shopID = a.shopID
  702. LEFT JOIN club c ON c.userID = a.userID
  703. <where>
  704. (s.shopId = 1161 OR s.AccountOwnership = 0 OR a.splitCode = 'E1807059160' or a.ordertype = 2)
  705. and a.shopStatus not in (4, 5)
  706. <if test="startTime != null and startTime != ''">
  707. AND (a.orderTime &gt; #{startTime} OR a.orderTime = #{startTime})
  708. </if>
  709. <if test="endTime != null and endTime != ''">
  710. AND (a.orderTime &lt; #{endTime} OR a.orderTime = #{endTime})
  711. </if>
  712. <if test="orderID != null and orderID != ''">
  713. AND a.orderID = #{orderID}
  714. </if>
  715. <if test="organizeID != null and organizeID != 9999">
  716. AND co.organizeID = #{organizeID}
  717. </if>
  718. <if test="organizeID == 9999 ">
  719. AND co.orderType = 2
  720. </if>
  721. <if test="orderNo != null and orderNo != ''">
  722. AND a.orderNo like concat('%', #{orderNo} ,'%')
  723. </if>
  724. <if test="ps != null and ps.length>0 ">
  725. AND a.payStatus in
  726. <foreach item="item" index="index" collection="ps" open="(" close=")" separator=",">
  727. #{item}
  728. </foreach>
  729. </if>
  730. <if test="shopName != null and shopName != ''">
  731. AND s.name like concat('%', #{shopName} ,'%')
  732. </if>
  733. <if test="buyer != null and buyer != ''">
  734. AND bou.name like concat('%', #{buyer} ,'%')
  735. </if>
  736. <if test="clubName != null and clubName != ''">
  737. AND c.name like concat('%', #{clubName} ,'%')
  738. </if>
  739. <if test="shopOrderID != null and shopOrderID != ''">
  740. AND a.shopOrderID = #{shopOrderID}
  741. </if>
  742. <if test="shopOrderNo != null and shopOrderNo != ''">
  743. AND a.shopOrderNo like concat('%', #{shopOrderNo} ,'%')
  744. </if>
  745. <if test="operatingMode != null and operatingMode == '1'.toString()">
  746. and a.payStatus != 3 and co.status NOT IN (6,7)
  747. </if>
  748. <if test="operatingMode != null and operatingMode == '2'.toString()">
  749. and a.payStatus != 1 and co.status != 6
  750. </if>
  751. <if test="operatingMode != null and operatingMode == '3'.toString()">
  752. and a.payStatus = 3 and co.status NOT IN (6,7)
  753. </if>
  754. and a.shopStatus != 0
  755. and co.delFlag = 0
  756. -- and not (co.secondHandOrderFlag=1 AND co.rebateFlag=1)
  757. and a.delFlag = 0
  758. and (a.organizeID!=4 or a.organizeID is null)
  759. and a.shopID != 998
  760. and co.orderID not in (
  761. SELECT orderID FROM cm_order_product WHERE productID IN
  762. (6060, 6061, 6062, 6063, 6064, 6065, 6066, 6067, 6068, 6069) GROUP BY orderID
  763. )
  764. </where>
  765. group by a.shopOrderID
  766. ORDER BY a.shopOrderID DESC
  767. </select>
  768. <select id="payThirdParties" resultType="newShopOrder">
  769. select<include refid="shopOrderColumns"/>,
  770. co.payTotalFee AS payTotalFee,
  771. bou.name AS buyer,
  772. s.name AS shopName,
  773. c.name AS clubName,
  774. cdr.payWay AS payWay
  775. from cm_shop_order a
  776. left join cm_pay_shop_record cpsr on a.shopOrderID = cpsr.shopOrderID
  777. left join bp_order_userinfo bou on bou.orderId = a.orderID
  778. left join cm_order co on co.orderID = a.orderID
  779. LEFT JOIN cm_receipt_order_relation cror ON cror.orderId = co.orderId
  780. LEFT JOIN cm_discern_receipt cdr ON cror.receiptID = cdr.id
  781. left join shop s on s.shopID = a.shopID
  782. LEFT JOIN club c ON c.userID = a.userID
  783. <where>
  784. s.name NOT LIKE '%综合供应商%'
  785. AND s.AccountOwnership = 1
  786. AND cdr.payWay = 2
  787. AND a.receiptStatus != 1
  788. <if test="startTime != null and startTime != ''">
  789. AND (a.orderTime &gt; #{startTime} OR a.orderTime = #{startTime})
  790. </if>
  791. <if test="endTime != null and endTime != ''">
  792. AND (a.orderTime &lt; #{endTime} OR a.orderTime = #{endTime})
  793. </if>
  794. <if test="orderID != null and orderID != ''">
  795. AND a.orderID = #{orderID}
  796. </if>
  797. <if test="organizeID != null and organizeID != 9999">
  798. AND co.organizeID = #{organizeID}
  799. </if>
  800. <if test="organizeID == 9999 ">
  801. AND co.orderType = 2
  802. </if>
  803. <if test="orderNo != null and orderNo != ''">
  804. AND a.orderNo like concat('%', #{orderNo} ,'%')
  805. </if>
  806. <if test="ps != null and ps.length>0 ">
  807. AND a.payStatus in
  808. <foreach item="item" index="index" collection="ps" open="(" close=")" separator=",">
  809. #{item}
  810. </foreach>
  811. </if>
  812. <if test="shopName != null and shopName != ''">
  813. AND s.name like concat('%', #{shopName} ,'%')
  814. </if>
  815. <if test="buyer != null and buyer != ''">
  816. AND bou.name like concat('%', #{buyer} ,'%')
  817. </if>
  818. <if test="clubName != null and clubName != ''">
  819. AND c.name like concat('%', #{clubName} ,'%')
  820. </if>
  821. <if test="shopOrderID != null and shopOrderID != ''">
  822. AND a.shopOrderID = #{shopOrderID}
  823. </if>
  824. <if test="shopOrderNo != null and shopOrderNo != ''">
  825. AND a.shopOrderNo like concat('%', #{shopOrderNo} ,'%')
  826. </if>
  827. and (co.confirmFlag = '1' or co.confirmFlag = '2')
  828. <if test="operatingMode != null and operatingMode == '1'.toString()">
  829. and a.payStatus != 3 and co.status NOT IN (6,7)
  830. </if>
  831. <if test="operatingMode != null and operatingMode == '2'.toString()">
  832. and a.payStatus != 1 and co.status != 6
  833. </if>
  834. <if test="operatingMode != null and operatingMode == '3'.toString()">
  835. and a.payStatus = 3 and co.status NOT IN (6,7)
  836. </if>
  837. and co.delFlag = 0
  838. -- and not (co.secondHandOrderFlag=1 AND co.rebateFlag=1)
  839. and a.delFlag = 0
  840. and (a.organizeID!=4 or a.organizeID is null)
  841. and a.shopID != 998
  842. and co.orderID not in (
  843. SELECT orderID FROM cm_order_product WHERE productID IN
  844. (6060, 6061, 6062, 6063, 6064, 6065, 6066, 6067, 6068, 6069) GROUP BY orderID
  845. )
  846. </where>
  847. group by a.shopOrderID
  848. ORDER BY a.shopOrderID DESC
  849. </select>
  850. <select id="findPayOrderListByIDs" resultType="newShopOrder">
  851. select distinct<include refid="shopOrderColumns"/>,
  852. co.payTotalFee AS payTotalFee,
  853. co.promotionFullReduction,
  854. bou.name AS buyer,
  855. s.name AS shopName
  856. from cm_shop_order a
  857. left join cm_pay_shop_record cpsr on a.shopOrderID = cpsr.shopOrderID
  858. left join bp_order_userinfo bou on bou.orderId = a.orderID
  859. left join cm_order co on co.orderID = a.orderID
  860. left join shop s on s.shopID = a.shopID
  861. <where>
  862. <if test="ids != null and ids != ''">
  863. and a.shopOrderID in
  864. <foreach collection="ids" open="(" close=")" item="id" separator=",">
  865. #{id}
  866. </foreach>
  867. </if>
  868. </where>
  869. ORDER BY a.shopOrderID DESC
  870. </select>
  871. <select id="findByRefundID" resultType="newShopOrder">
  872. select distinct<include refid="shopOrderColumns"/>,
  873. co.payTotalFee AS payTotalFee,
  874. bou.name AS buyer,
  875. s.name AS shopName
  876. from cm_shop_order a
  877. left join cm_pay_shop_record cpsr on a.shopOrderID = cpsr.shopOrderID
  878. left join bp_order_userinfo bou on bou.orderId = a.orderID
  879. left join cm_order co on co.orderID = a.orderID
  880. left join shop s on s.shopID = a.shopID
  881. where a.shopOrderID in
  882. (select crsr.shopOrderID
  883. from cm_refund_shop_record crsr
  884. left join cm_refund_shop crs on crsr.refundShopID = crs.id
  885. where crs.id = #{refundShopID} and crsr.shopOrderID is not null)
  886. ORDER BY a.shopOrderID DESC
  887. </select>
  888. <select id="updatePayShopAmount">
  889. UPDATE cm_shop_order
  890. <set>
  891. <if test="shopProductAmount != null">
  892. shopProductAmount = #{shopProductAmount},
  893. </if>
  894. <if test="shopPostFee != null">
  895. shopPostFee = #{shopPostFee},
  896. </if>
  897. <if test="shopTaxFee != null">
  898. shopTaxFee = #{shopTaxFee},
  899. </if>
  900. <if test="shouldPayShopAmount != null">
  901. shouldPayShopAmount = #{shouldPayShopAmount},
  902. </if>
  903. <if test="shopOtherFee != null">
  904. shopOtherFee = #{shopOtherFee},
  905. </if>
  906. <if test="payStatus != null">
  907. payStatus = #{payStatus},
  908. </if>
  909. <if test="payedShopAmount != null">
  910. payedShopAmount = #{payedShopAmount}
  911. </if>
  912. <if test="status != null and status != ''">
  913. shopStatus = #{status},
  914. </if>
  915. </set>
  916. WHERE shopOrderID = #{shopOrderID}
  917. </select>
  918. <select id="findByShopOrderIDs" resultType="newShopOrder">
  919. select distinct<include refid="shopOrderColumns"/>,
  920. co.payTotalFee AS payTotalFee,
  921. co.promotionFullReduction AS promotionFullReduction,
  922. bou.name AS buyer,
  923. s.name AS shopName,
  924. c.name AS clubName
  925. from cm_shop_order a
  926. left join cm_pay_shop_record cpsr on a.shopOrderID = cpsr.shopOrderID
  927. left join bp_order_userinfo bou on bou.orderId = a.orderID
  928. left join cm_order co on co.orderID = a.orderID
  929. left join shop s on s.shopID = a.shopID
  930. left join club c on c.userID = a.userID
  931. <if test="shopOrderIDs != null and shopOrderIDs.size() > 0">
  932. where a.shopOrderID in
  933. <foreach collection="shopOrderIDs" separator="," item="shopOrderID" open="(" close=")">
  934. #{shopOrderID}
  935. </foreach>
  936. </if>
  937. </select>
  938. <update id="updatePaying">
  939. update cm_shop_order
  940. set paying = #{paying}
  941. where shopOrderID = #{shopOrderID}
  942. </update>
  943. <update id="outPaying">
  944. update cm_shop_order
  945. set paying = '0'
  946. where shopOrderID in
  947. (select cpsr.shopOrderID
  948. from cm_pay_shop_record cpsr
  949. left join cm_pay_shop cps on cps.id = cpsr.payShopID
  950. where cps.id = #{payShopID}
  951. and cps.delFlag = '0'
  952. and cpsr.delFlag = '0'
  953. and cpsr.shopOrderID is not null)
  954. </update>
  955. <update id="inPaying">
  956. update cm_shop_order
  957. set paying = '1'
  958. where shopOrderID in
  959. (select cpsr.shopOrderID
  960. from cm_pay_shop_record cpsr
  961. left join cm_pay_shop cps on cps.id = cpsr.payShopID
  962. where cps.id = #{payShopID}
  963. and cps.delFlag = '0'
  964. and cpsr.delFlag = '0'
  965. and cpsr.shopOrderID is not null)
  966. </update>
  967. <update id="updatePayStatus">
  968. update cm_shop_order
  969. set payStatus = #{payStatus}
  970. where shopOrderID = #{shopOrderID}
  971. </update>
  972. <select id="findPayStatusByOrderID" resultType="string">
  973. select payStatus
  974. from cm_shop_order
  975. where orderID = #{orderID}
  976. AND shopID != 998
  977. </select>
  978. <select id="getPayingStatus" resultType="string">
  979. select ifnull(paying, '0')
  980. from cm_shop_order
  981. where shopOrderID in
  982. (select cpsr.shopOrderID
  983. from cm_pay_shop_record cpsr
  984. left join cm_pay_shop cps on cps.id = cpsr.payShopID
  985. where cps.id = #{payShopID}
  986. and cps.delFlag = '0'
  987. and cpsr.delFlag = '0'
  988. and cpsr.shopOrderID is not null)
  989. </select>
  990. <select id="findSiblingPostFeeOrder" resultType="newShopOrder">
  991. select
  992. <include refid="shopOrderColumns"/>
  993. from cm_shop_order a
  994. left join cm_order co on co.orderID = a.orderID
  995. where a.orderID = #{orderID} and a.shopID = 998
  996. </select>
  997. <select id="findShopOrderNos" resultType="java.lang.String">
  998. SELECT CONCAT(shopOrderNo, '(', shopOrderID, ')') AS result
  999. FROM cm_shop_order
  1000. WHERE orderID = #{orderID}
  1001. and shopId != 998
  1002. </select>
  1003. <select id="findIncome" resultType="java.lang.Double">
  1004. SELECT ROUND(IFNULL((
  1005. co.payTotalFee - (IFNULL((SELECT ROUND(SUM((IFNULL(op.costPrice, 0) *
  1006. (IFNULL(op.num, 0) + IFNULL(op.presentNum, 0))) +
  1007. IFNULL(op.shouldPayTotalTax, 0)),
  1008. 2)
  1009. FROM cm_order_product op
  1010. LEFT JOIN cm_shop_order cso ON cso.shopOrderID = op.shopOrderID
  1011. WHERE cso.orderID = co.orderID
  1012. AND op.productID != 999
  1013. GROUP BY cso.orderID), 0))
  1014. - (SELECT IFNULL(SUM(cso.shopOtherFee), 0)
  1015. FROM cm_shop_order cso
  1016. WHERE cso.orderID = co.orderID)
  1017. - IFNULL((SELECT SUM(shopPostFee + IF(differenceType = 1, differencePrice, 0) -
  1018. IF(differenceType = 2, differencePrice, 0))
  1019. FROM cm_shop_order
  1020. WHERE orderID = co.orderID), 0)
  1021. + IFNULL((SELECT SUM(cpsr.wipePayment)
  1022. FROM cm_pay_shop_record cpsr
  1023. WHERE cpsr.shopOrderID IN (SELECT cso.shopOrderID
  1024. FROM cm_shop_order cso
  1025. WHERE cso.orderID = co.orderID)
  1026. AND cpsr.delFlag = 0
  1027. AND (cpsr.`status` = 1 OR cpsr.`status` = 0)), 0)
  1028. + IFNULL(co.rebateFee, 0)
  1029. ), 0), 2) AS "采美总佣金"
  1030. FROM cm_order co
  1031. WHERE co.orderID = #{orderID}
  1032. </select>
  1033. <update id="updateByShopOtherFee">
  1034. UPDATE cm_shop_order
  1035. SET shopOtherFee = #{shopOtherFee}
  1036. WHERE shopOrderID = #{shopOrderId}
  1037. </update>
  1038. <update id="updateByDifferencePrice">
  1039. UPDATE cm_shop_order
  1040. SET differenceType = #{type},
  1041. differencePrice = #{differencePrice}
  1042. WHERE shopOrderID = #{shopOrderId}
  1043. </update>
  1044. <select id="findSplitList" resultType="newShopOrder">
  1045. SELECT co.couponAmount AS couponAmount,
  1046. co.userBeans AS userBeans,
  1047. a.shopOrderID AS shopOrderID,
  1048. a.orderID AS orderID,
  1049. a.organizeID AS organizeID,
  1050. a.shopOrderNo AS shopOrderNo,
  1051. a.orderNo AS orderNo,
  1052. a.userID AS userID,
  1053. a.shopID AS shopID,
  1054. a.itemCount AS itemCount,
  1055. a.townID AS townID,
  1056. a.productAmount AS productAmount,
  1057. a.discountAmount AS discountAmount,
  1058. a.accountAmount AS accountAmount,
  1059. a.totalAmount AS totalAmount,
  1060. a.payFlag AS payFlag,
  1061. a.payTime AS payTime,
  1062. a.finishTime AS finishTime,
  1063. a.refundStatus AS refundStatus,
  1064. a.needPayAmount AS needPayAmount,
  1065. a.canRefundAmount AS canRefundAmount,
  1066. a.refundAmount AS refundAmount,
  1067. a.clubID AS clubID,
  1068. a.spID AS spID,
  1069. a.mainSpID AS mainSpID,
  1070. a.orderBeanAmount AS orderBeanAmount,
  1071. a.useBeanAmount AS useBeanAmount,
  1072. a.useBeanFlag AS useBeanFlag,
  1073. a.canRefundFlag AS canRefundFlag,
  1074. a.useBalanceFlag AS useBalanceFlag,
  1075. a.canRefundBeans AS canRefundBeans,
  1076. a.freePostageFee AS freePostageFee,
  1077. a.freePostageTicketID AS freePostageTicketID,
  1078. a.brokerage AS brokerage,
  1079. a.delFlag AS delFlag,
  1080. a.refundsAmount AS refundsAmount,
  1081. a.orderStatusFlag AS orderStatusFlag,
  1082. a.buyStatus AS buyStatus,
  1083. a.orderSubmitType AS orderSubmitType,
  1084. a.orderType AS orderType,
  1085. a.orderTime AS orderTime,
  1086. a.deliveryTimeMills AS deliveryTimeMills,
  1087. a.presentNum AS presentNum,
  1088. a.preferential AS preferential,
  1089. a.outStoreNum AS outStoreNum,
  1090. IFNULL(a.outStoreTimes, 0) AS outStoreTimes,
  1091. a.splitFlag AS splitFlag,
  1092. a.autoReceiveTimeMills AS autoReceiveTimeMills,
  1093. a.autoOverTimeMills AS autoOverTimeMills,
  1094. a.receiveGoodsTime AS receiveGoodsTime,
  1095. a.totalAddedValueTax AS totalAddedValueTax,
  1096. a.note AS note,
  1097. a.payStatus AS payStatus,
  1098. a.sendOutStatus AS sendOutStatus,
  1099. a.shopProductAmount AS shopProductAmount,
  1100. a.shopPostFee AS shopPostFee,
  1101. a.shopTaxFee AS shopTaxFee,
  1102. a.shouldPayShopAmount AS shouldPayShopAmount,
  1103. a.payedShopAmount AS payedShopAmount,
  1104. a.shopOtherFee AS shopOtherFee,
  1105. a.paying AS paying,
  1106. a.costType AS costType,
  1107. a.modifyShouldPayNote AS modifyShouldPayNote,
  1108. a.orderPromotionsId AS orderPromotionsId,
  1109. a.differenceType AS differenceType,
  1110. a.differencePrice AS differencePrice,
  1111. a.proportional AS proportional,
  1112. a.promotionFullReduction AS promotionFullReduction,
  1113. a.zeroCostFlag AS zeroCostFlag,
  1114. co.payTotalFee AS payTotalFee,
  1115. co.status AS STATUS,
  1116. bou.name AS buyer,
  1117. s.name AS shopName,
  1118. c.name AS clubName
  1119. FROM cm_shop_order a
  1120. LEFT JOIN cm_pay_shop_record cpsr ON a.shopOrderID = cpsr.shopOrderID
  1121. LEFT JOIN bp_order_userinfo bou ON bou.orderId = a.orderID
  1122. LEFT JOIN cm_order co ON co.orderID = a.orderID
  1123. LEFT JOIN cm_receipt_order_relation cror ON cror.orderId = co.orderId
  1124. LEFT JOIN cm_discern_receipt cdr ON cror.receiptID = cdr.id
  1125. LEFT JOIN shop s ON s.shopID = a.shopID
  1126. LEFT JOIN club c ON c.userID = a.userID
  1127. WHERE co.organizeID = 0
  1128. AND a.refundStatus = 1
  1129. AND co.delFlag = 0
  1130. AND co.orderType != 2
  1131. AND a.delFlag = 0
  1132. AND a.shopID != 998
  1133. AND (a.organizeID != 4 or a.organizeID is null)
  1134. AND cdr.payWay = 1
  1135. AND cdr.receiptDate <![CDATA[ <= ]]> NOW()
  1136. AND cror.relationType = 2
  1137. AND cror.delFlag = 0
  1138. AND cror.mbOrderId IS NOT NULL
  1139. AND cror.splitStatus = 0
  1140. AND a.receiptStatus = 3
  1141. AND a.splitCode != 'E1807059160'
  1142. AND co.orderID NOT IN (SELECT orderID
  1143. FROM cm_order_product
  1144. WHERE productID IN
  1145. (6060, 6061, 6062, 6063, 6064, 6065, 6066, 6067, 6068, 6069)
  1146. GROUP BY orderID)
  1147. GROUP BY a.shopOrderID
  1148. ORDER BY a.shopOrderID DESC
  1149. </select>
  1150. <select id="getOpenidListByPermission" resultType="java.lang.String">
  1151. SELECT openid
  1152. FROM `wechat_user`
  1153. WHERE unionid = #{unionid}
  1154. </select>
  1155. <select id="FromUnionId" resultType="java.lang.String">
  1156. SELECT unionID
  1157. FROM `cm_order`
  1158. WHERE orderID = #{orderId}
  1159. </select>
  1160. <select id="UnionId" resultType="java.lang.String">
  1161. SELECT unionID
  1162. FROM `cm_order`
  1163. WHERE userID = #{userID}
  1164. ORDER BY orderID DESC
  1165. LIMIT 1
  1166. </select>
  1167. <select id="getProductOrder" resultType="java.lang.String">
  1168. SELECT productID
  1169. FROM `cm_order_product`
  1170. WHERE orderID = #{orderid}
  1171. </select>
  1172. <select id="payWay" resultType="java.lang.Integer">
  1173. SELECT cdr.payWay
  1174. FROM cm_shop_order a
  1175. LEFT JOIN cm_order co ON co.orderID = a.orderID
  1176. LEFT JOIN cm_receipt_order_relation cror ON cror.orderId = co.orderId
  1177. LEFT JOIN cm_discern_receipt cdr ON cror.receiptID = cdr.id
  1178. WHERE a.shopOrderID = #{shopOrderID}
  1179. </select>
  1180. <select id="findSettlementList" resultType="com.caimei.modules.order.entity.NewShopOrder">
  1181. SELECT co.couponAmount AS couponAmount,
  1182. co.userBeans AS userBeans,
  1183. a.shopOrderID AS shopOrderID,
  1184. a.orderID AS orderID,
  1185. a.organizeID AS organizeID,
  1186. a.shopOrderNo AS shopOrderNo,
  1187. a.orderNo AS orderNo,
  1188. a.userID AS userID,
  1189. a.shopID AS shopID,
  1190. a.itemCount AS itemCount,
  1191. a.townID AS townID,
  1192. a.productAmount AS productAmount,
  1193. a.discountAmount AS discountAmount,
  1194. a.accountAmount AS accountAmount,
  1195. a.totalAmount AS totalAmount,
  1196. a.payFlag AS payFlag,
  1197. a.payTime AS payTime,
  1198. a.finishTime AS finishTime,
  1199. a.refundStatus AS refundStatus,
  1200. a.needPayAmount AS needPayAmount,
  1201. a.canRefundAmount AS canRefundAmount,
  1202. a.refundAmount AS refundAmount,
  1203. a.clubID AS clubID,
  1204. a.spID AS spID,
  1205. a.mainSpID AS mainSpID,
  1206. a.orderBeanAmount AS orderBeanAmount,
  1207. a.useBeanAmount AS useBeanAmount,
  1208. a.useBeanFlag AS useBeanFlag,
  1209. a.canRefundFlag AS canRefundFlag,
  1210. a.useBalanceFlag AS useBalanceFlag,
  1211. a.canRefundBeans AS canRefundBeans,
  1212. a.freePostageFee AS freePostageFee,
  1213. a.freePostageTicketID AS freePostageTicketID,
  1214. a.brokerage AS brokerage,
  1215. a.delFlag AS delFlag,
  1216. a.refundsAmount AS refundsAmount,
  1217. a.orderStatusFlag AS orderStatusFlag,
  1218. a.buyStatus AS buyStatus,
  1219. a.orderSubmitType AS orderSubmitType,
  1220. a.orderType AS orderType,
  1221. a.orderTime AS orderTime,
  1222. a.deliveryTimeMills AS deliveryTimeMills,
  1223. a.presentNum AS presentNum,
  1224. a.preferential AS preferential,
  1225. a.outStoreNum AS outStoreNum,
  1226. IFNULL(a.outStoreTimes, 0) AS outStoreTimes,
  1227. a.splitFlag AS splitFlag,
  1228. a.autoReceiveTimeMills AS autoReceiveTimeMills,
  1229. a.autoOverTimeMills AS autoOverTimeMills,
  1230. a.receiveGoodsTime AS receiveGoodsTime,
  1231. a.totalAddedValueTax AS totalAddedValueTax,
  1232. a.note AS note,
  1233. a.payStatus AS payStatus,
  1234. a.sendOutStatus AS sendOutStatus,
  1235. a.shopProductAmount AS shopProductAmount,
  1236. a.shopPostFee AS shopPostFee,
  1237. a.shopTaxFee AS shopTaxFee,
  1238. a.shouldPayShopAmount AS shouldPayShopAmount,
  1239. a.payedShopAmount AS payedShopAmount,
  1240. a.shopOtherFee AS shopOtherFee,
  1241. a.paying AS paying,
  1242. a.costType AS costType,
  1243. a.modifyShouldPayNote AS modifyShouldPayNote,
  1244. a.orderPromotionsId AS orderPromotionsId,
  1245. a.differenceType AS differenceType,
  1246. a.differencePrice AS differencePrice,
  1247. a.proportional AS proportional,
  1248. a.promotionFullReduction AS promotionFullReduction,
  1249. a.zeroCostFlag AS zeroCostFlag,
  1250. a.settleStatus AS settleStatus,
  1251. co.payTotalFee AS payTotalFee,
  1252. co.status AS STATUS,
  1253. bou.name AS buyer,
  1254. s.name AS shopName,
  1255. c.name AS clubName
  1256. FROM cm_shop_order a
  1257. LEFT JOIN cm_pay_shop_record cpsr ON a.shopOrderID = cpsr.shopOrderID
  1258. LEFT JOIN bp_order_userinfo bou ON bou.orderId = a.orderID
  1259. LEFT JOIN cm_order co ON co.orderID = a.orderID
  1260. LEFT JOIN cm_receipt_order_relation cror ON cror.orderId = co.orderId
  1261. LEFT JOIN cm_discern_receipt cdr ON cror.receiptID = cdr.id
  1262. LEFT JOIN cm_split_account csa on csa.shopOrderId = a.shopOrderID
  1263. LEFT JOIN shop s ON s.shopID = a.shopID
  1264. LEFT JOIN club c ON c.userID = a.userID
  1265. WHERE co.organizeID = 0
  1266. AND co.refundType != 2
  1267. AND co.delFlag = 0
  1268. AND co.orderType != 2
  1269. AND co.receiptStatus = 3
  1270. AND a.delFlag = 0
  1271. AND a.refundStatus = 1
  1272. AND a.shopID != 998
  1273. AND (a.organizeID!=4 or a.organizeID is null)
  1274. AND cdr.payWay = 1
  1275. AND cror.relationType = 2
  1276. AND a.settleStatus in (1,2)
  1277. AND csa.settleStatus = 0
  1278. AND cror.delFlag = 0
  1279. AND cror.mbOrderId IS NOT NULL
  1280. AND cror.splitStatus = 1
  1281. AND a.splitCode != 'E1807059160'
  1282. <if test="startTime != null and startTime != ''">
  1283. AND (a.orderTime &gt; #{startTime} OR a.orderTime = #{startTime})
  1284. </if>
  1285. <if test="endTime != null and endTime != ''">
  1286. AND (a.orderTime &lt; #{endTime} OR a.orderTime = #{endTime})
  1287. </if>
  1288. <if test="orderID != null and orderID != ''">
  1289. AND a.orderID = #{orderID}
  1290. </if>
  1291. <if test="orderNo != null and orderNo != ''">
  1292. AND a.orderNo like concat('%', #{orderNo} ,'%')
  1293. </if>
  1294. <if test="ps != null and ps.length>0 ">
  1295. AND a.settleStatus in
  1296. <foreach item="item" index="index" collection="ps" open="(" close=")" separator=",">
  1297. #{item}
  1298. </foreach>
  1299. </if>
  1300. <if test="shopName != null and shopName != ''">
  1301. AND s.name like concat('%', #{shopName} ,'%')
  1302. </if>
  1303. <if test="clubName != null and clubName != ''">
  1304. AND c.name like concat('%', #{clubName} ,'%')
  1305. </if>
  1306. <if test="shopOrderID != null and shopOrderID != ''">
  1307. AND a.shopOrderID = #{shopOrderID}
  1308. </if>
  1309. <if test="shopOrderNo != null and shopOrderNo != ''">
  1310. AND a.shopOrderNo like concat('%', #{shopOrderNo} ,'%')
  1311. </if>
  1312. GROUP BY a.shopOrderID
  1313. ORDER BY a.shopOrderID DESC
  1314. </select>
  1315. <select id="findSettleRecord" resultType="com.caimei.modules.order.entity.SettleRecord">
  1316. select settleAmount, settleType, settleTime
  1317. from cm_settle_record
  1318. where shopOrderId = #{shopOrderID}
  1319. </select>
  1320. <select id="findListByShopOrderId" resultType="com.caimei.modules.order.entity.NewShopOrder">
  1321. SELECT<include refid="shopOrderColumns"/>,
  1322. b.name as shopName,
  1323. oa.id as orderArchiveId,
  1324. co.receiptStatus
  1325. FROM cm_shop_order a
  1326. left join shop b on a.shopID = b.shopID
  1327. left join cm_order_archive oa on a.shopOrderID = oa.shopOrderId
  1328. left join cm_order co on co.orderID = a.orderID
  1329. WHERE a.shopOrderId = #{onlineShopOrderId}
  1330. ORDER BY a.shopOrderNo DESC
  1331. </select>
  1332. <resultMap type="com.caimei.modules.order.entity.NewShopOrder" id="CmShopOrderResult">
  1333. <result property="shopOrderID" column="shopOrderID"/>
  1334. <result property="shopOrderNo" column="shopOrderNo"/>
  1335. <result property="orderNo" column="orderNo"/>
  1336. <result property="orderID" column="orderID"/>
  1337. <result property="organizeID" column="organizeID"/>
  1338. <result property="isColdChina" column="isColdChina"/>
  1339. <result property="userID" column="userID"/>
  1340. <result property="shopID" column="shopID"/>
  1341. <result property="orderPromotionsId" column="orderPromotionsId"/>
  1342. <result property="orderType" column="orderType"/>
  1343. <result property="orderSubmitType" column="orderSubmitType"/>
  1344. <result property="presentNum" column="presentNum"/>
  1345. <result property="itemCount" column="itemCount"/>
  1346. <result property="outStoreNum" column="outStoreNum"/>
  1347. <result property="outStoreTimes" column="outStoreTimes"/>
  1348. <result property="townID" column="townID"/>
  1349. <result property="note" column="note"/>
  1350. <result property="eachDiscount" column="eachDiscount"/>
  1351. <result property="realPay" column="realPay"/>
  1352. <result property="receiptAmount" column="receiptAmount"/>
  1353. <result property="accountAmount" column="accountAmount"/>
  1354. <result property="productAmount" column="productAmount"/>
  1355. <result property="totalAmount" column="totalAmount"/>
  1356. <result property="needPayAmount" column="needPayAmount"/>
  1357. <result property="discountAmount" column="discountAmount"/>
  1358. <result property="preferential" column="preferential"/>
  1359. <result property="promotionFullReduction" column="promotionFullReduction"/>
  1360. <result property="payFlag" column="payFlag"/>
  1361. <result property="orderTime" column="orderTime"/>
  1362. <result property="payTime" column="payTime"/>
  1363. <result property="finishTime" column="finishTime"/>
  1364. <result property="autoOverTimeMills" column="autoOverTimeMills"/>
  1365. <result property="settleStatus" column="settleStatus"/>
  1366. <result property="payStatus" column="payStatus"/>
  1367. <result property="receiptStatus" column="receiptStatus"/>
  1368. <result property="sendOutStatus" column="sendOutStatus"/>
  1369. <result property="refundStatus" column="refundStatus"/>
  1370. <result property="returnGoodsStatus" column="returnGoodsStatus"/>
  1371. <result property="receiveGoodsTime" column="receiveGoodsTime"/>
  1372. <result property="autoReceiveTimeMills" column="autoReceiveTimeMills"/>
  1373. <result property="totalAddedValueTax" column="totalAddedValueTax"/>
  1374. <result property="canRefundAmount" column="canRefundAmount"/>
  1375. <result property="refundAmount" column="refundAmount"/>
  1376. <result property="clubID" column="clubID"/>
  1377. <result property="spID" column="spID"/>
  1378. <result property="mainSpID" column="mainSpID"/>
  1379. <result property="orderBeanAmount" column="orderBeanAmount"/>
  1380. <result property="useBeanAmount" column="useBeanAmount"/>
  1381. <result property="useBeanFlag" column="useBeanFlag"/>
  1382. <result property="canRefundFlag" column="canRefundFlag"/>
  1383. <result property="useBalanceFlag" column="useBalanceFlag"/>
  1384. <result property="canRefundBeans" column="canRefundBeans"/>
  1385. <result property="freePostageFee" column="freePostageFee"/>
  1386. <result property="freePostageTicketID" column="freePostageTicketID"/>
  1387. <result property="brokerage" column="brokerage"/>
  1388. <result property="delFlag" column="delFlag"/>
  1389. <result property="refundsAmount" column="refundsAmount"/>
  1390. <result property="orderStatusFlag" column="orderStatusFlag"/>
  1391. <result property="buyStatus" column="buyStatus"/>
  1392. <result property="deliveryTimeMills" column="deliveryTimeMills"/>
  1393. <result property="orderDeliveryID" column="orderDeliveryID"/>
  1394. <result property="splitFlag" column="splitFlag"/>
  1395. <result property="paying" column="paying"/>
  1396. <result property="shopProductAmount" column="shopProductAmount"/>
  1397. <result property="shopPostFee" column="shopPostFee"/>
  1398. <result property="shopPostFlag" column="shopPostFlag"/>
  1399. <result property="shopTaxFee" column="shopTaxFee"/>
  1400. <result property="payCmAmount" column="payCmAmount"/>
  1401. <result property="shouldPayShopAmount" column="shouldPayShopAmount"/>
  1402. <result property="payedShopAmount" column="payedShopAmount"/>
  1403. <result property="shopOtherFee" column="shopOtherFee"/>
  1404. <result property="receiptedFlag" column="receiptedFlag"/>
  1405. <result property="receiptedType" column="receiptedType"/>
  1406. <result property="costType" column="costType"/>
  1407. <result property="proportional" column="proportional"/>
  1408. <result property="modifyShouldPayNote" column="modifyShouldPayNote"/>
  1409. <result property="modifyShouldPayUserID" column="modifyShouldPayUserID"/>
  1410. <result property="modifyShouldPayDate" column="modifyShouldPayDate"/>
  1411. <result property="zeroCostFlag" column="zeroCostFlag"/>
  1412. <result property="differenceType" column="differenceType"/>
  1413. <result property="differencePrice" column="differencePrice"/>
  1414. <result property="svipShopReduction" column="svipShopReduction"/>
  1415. <result property="splitCode" column="splitCode"/>
  1416. <result property="paySuccessCounter" column="paySuccessCounter"/>
  1417. <result property="onlinePayWays" column="onlinePayWays"/>
  1418. <result property="status" column="shopStatus"/>
  1419. </resultMap>
  1420. <sql id="selectCmShopOrderVo">
  1421. select cm_shop_order.shopOrderID,
  1422. cm_shop_order.shopOrderNo,
  1423. cm_shop_order.orderNo,
  1424. cm_shop_order.orderID,
  1425. cm_shop_order.organizeID,
  1426. cm_shop_order.isColdChina,
  1427. cm_shop_order.userID,
  1428. cm_shop_order.shopID,
  1429. cm_shop_order.orderPromotionsId,
  1430. cm_shop_order.orderType,
  1431. cm_shop_order.orderSubmitType,
  1432. cm_shop_order.presentNum,
  1433. cm_shop_order.itemCount,
  1434. cm_shop_order.outStoreNum,
  1435. cm_shop_order.outStoreTimes,
  1436. cm_shop_order.townID,
  1437. cm_shop_order.note,
  1438. ifnull(cm_shop_order.accountAmount, 0) AS accountAmount,
  1439. ifnull(cm_shop_order.productAmount, 0) AS productAmount,
  1440. ifnull(cm_shop_order.totalAmount, 0) AS totalAmount,
  1441. ifnull(cm_shop_order.needPayAmount, 0) AS needPayAmount,
  1442. ifnull(cm_shop_order.discountAmount, 0) AS discountAmount,
  1443. ifnull(cm_shop_order.preferential, 0) AS preferential,
  1444. ifnull(cm_shop_order.promotionFullReduction, 0) AS promotionFullReduction,
  1445. cm_shop_order.payFlag,
  1446. cm_shop_order.orderTime,
  1447. cm_shop_order.payTime,
  1448. cm_shop_order.finishTime,
  1449. cm_shop_order.autoOverTimeMills,
  1450. cm_shop_order.settleStatus,
  1451. cm_shop_order.payStatus,
  1452. cm_shop_order.sendOutStatus,
  1453. cm_shop_order.refundStatus,
  1454. cm_shop_order.shopStatus,
  1455. cm_shop_order.returnGoodsStatus,
  1456. cm_shop_order.receiveGoodsTime,
  1457. cm_shop_order.autoReceiveTimeMills,
  1458. ifnull(cm_shop_order.totalAddedValueTax, 0) AS totalAddedValueTax,
  1459. cm_shop_order.canRefundAmount,
  1460. cm_shop_order.refundAmount,
  1461. cm_shop_order.clubID,
  1462. cm_shop_order.spID,
  1463. cm_shop_order.mainSpID,
  1464. cm_shop_order.orderBeanAmount,
  1465. cm_shop_order.useBeanAmount,
  1466. cm_shop_order.useBeanFlag,
  1467. cm_shop_order.canRefundFlag,
  1468. cm_shop_order.useBalanceFlag,
  1469. cm_shop_order.canRefundBeans,
  1470. ifnull(cm_shop_order.freePostageFee, 0) AS freePostageFee,
  1471. cm_shop_order.freePostageTicketID,
  1472. ifnull(cm_shop_order.brokerage, 0) AS brokerage,
  1473. cm_shop_order.delFlag,
  1474. ifnull(cm_shop_order.refundsAmount, 0) AS refundsAmount,
  1475. cm_shop_order.orderStatusFlag,
  1476. cm_shop_order.buyStatus,
  1477. cm_shop_order.deliveryTimeMills,
  1478. cm_shop_order.confirmTime,
  1479. cm_shop_order.updateTime,
  1480. cm_shop_order.orderDeliveryID,
  1481. cm_shop_order.splitFlag,
  1482. cm_shop_order.receiptedFlag,
  1483. cm_shop_order.receiptedType,
  1484. cm_shop_order.paying,
  1485. ifnull(cm_shop_order.shopProductAmount, 0) AS shopProductAmount,
  1486. ifnull(cm_shop_order.shopPostFee, 0) AS shopPostFee,
  1487. cm_shop_order.shopPostFlag,
  1488. ifnull(cm_shop_order.shopTaxFee, 0) AS shopTaxFee,
  1489. ifnull(cm_shop_order.payCmAmount, 0) AS payCmAmount,
  1490. ifnull(cm_shop_order.shouldPayShopAmount, 0) AS shouldPayShopAmount,
  1491. ifnull(cm_shop_order.payedShopAmount, 0) AS payedShopAmount,
  1492. ifnull(cm_shop_order.shopOtherFee, 0) AS shopOtherFee,
  1493. cm_shop_order.costType,
  1494. ifnull(cm_shop_order.proportional, 0) AS proportional,
  1495. cm_shop_order.modifyShouldPayNote,
  1496. cm_shop_order.modifyShouldPayUserID,
  1497. cm_shop_order.modifyShouldPayDate,
  1498. cm_shop_order.zeroCostFlag,
  1499. cm_shop_order.differenceType,
  1500. ifnull(cm_shop_order.differencePrice, 0) AS differencePrice,
  1501. ifnull(cm_shop_order.svipShopReduction, 0) AS svipShopReduction,
  1502. ifnull(cm_shop_order.shopRefundAmount, 0) AS shopRefundAmount,
  1503. cm_shop_order.splitCode,
  1504. cm_shop_order.paySuccessCounter,
  1505. cm_shop_order.onlinePayWays,
  1506. cm_shop_order.receiptStatus,
  1507. ifnull(cm_shop_order.receiptAmount, 0) AS receiptAmount,
  1508. ifnull(cm_shop_order.eachDiscount, 0) AS eachDiscount,
  1509. ifnull(cm_shop_order.realPay, 0) AS realPay,
  1510. cm_shop_order.discountFee,
  1511. cm_shop_order.fee
  1512. </sql>
  1513. <select id="getByCmShopOrder" parameterType="com.caimei.modules.order.entity.NewShopOrder"
  1514. resultMap="CmShopOrderResult">
  1515. <include refid="selectCmShopOrderVo"/>
  1516. from cm_shop_order AS cm_shop_order
  1517. <where>cm_shop_order.delFlag = 0
  1518. <if test="shopOrderID != null and shopOrderID != ''">
  1519. and cm_shop_order.shopOrderID
  1520. = #{shopOrderID}
  1521. </if>
  1522. <if test="shopOrderID.toString().toUpperCase().indexOf('=')!=-1">
  1523. <if test="shopOrderID.toString().toUpperCase().indexOf('NOT')!=-1">not</if>
  1524. <if test="shopOrderID.toString().toUpperCase().indexOf('IN')!=-1">in</if>
  1525. <foreach item="shopOrderIDIn"
  1526. collection="shopOrderID.toString().substring(shopOrderID.toUpperCase().toString().indexOf('=')+1,shopOrderID.toString().length()).trim().split(',')"
  1527. open="(" separator="," close=")">
  1528. #{shopOrderIDIn}
  1529. </foreach>
  1530. </if>
  1531. <if test="shopOrderNo != null and shopOrderNo != ''">and cm_shop_order.shopOrderNo = #{shopOrderNo}</if>
  1532. <if test="orderNo != null and orderNo != ''">and cm_shop_order.orderNo = #{orderNo}</if>
  1533. <if test="orderID != null ">and cm_shop_order.orderID = #{orderID}</if>
  1534. <if test="organizeID != null ">and cm_shop_order.organizeID = #{organizeID}</if>
  1535. <if test="isColdChina != null ">and cm_shop_order.isColdChina = #{isColdChina}</if>
  1536. <if test="userID != null ">and cm_shop_order.userID = #{userID}</if>
  1537. <if test="shopID != null ">and cm_shop_order.shopID = #{shopID}</if>
  1538. <if test="orderPromotionsId != null ">and cm_shop_order.orderPromotionsId = #{orderPromotionsId}</if>
  1539. <if test="orderType != null ">and cm_shop_order.orderType = #{orderType}</if>
  1540. <if test="orderSubmitType != null ">and cm_shop_order.orderSubmitType = #{orderSubmitType}</if>
  1541. <if test="presentNum != null ">and cm_shop_order.presentNum = #{presentNum}</if>
  1542. <if test="itemCount != null ">and cm_shop_order.itemCount = #{itemCount}</if>
  1543. <if test="outStoreNum != null ">and cm_shop_order.outStoreNum = #{outStoreNum}</if>
  1544. <if test="outStoreTimes != null ">and cm_shop_order.outStoreTimes = #{outStoreTimes}</if>
  1545. <if test="townID != null ">and cm_shop_order.townID = #{townID}</if>
  1546. <if test="note != null and note != ''">and cm_shop_order.note = #{note}</if>
  1547. <if test="eachDiscount != null ">and cm_shop_order.eachDiscount = #{eachDiscount}</if>
  1548. <if test="realPay != null ">and cm_shop_order.realPay = #{realPay}</if>
  1549. <if test="receiptAmount != null ">and cm_shop_order.receiptAmount = #{receiptAmount}</if>
  1550. <if test="accountAmount != null ">and cm_shop_order.accountAmount = #{accountAmount}</if>
  1551. <if test="productAmount != null ">and cm_shop_order.productAmount = #{productAmount}</if>
  1552. <if test="totalAmount != null ">and cm_shop_order.totalAmount = #{totalAmount}</if>
  1553. <if test="needPayAmount != null ">and cm_shop_order.needPayAmount = #{needPayAmount}</if>
  1554. <if test="discountAmount != null ">and cm_shop_order.discountAmount = #{discountAmount}</if>
  1555. <if test="preferential != null ">and cm_shop_order.preferential = #{preferential}</if>
  1556. <if test="promotionFullReduction != null ">and cm_shop_order.promotionFullReduction =
  1557. #{promotionFullReduction}
  1558. </if>
  1559. <if test="payFlag != null and payFlag != ''">and cm_shop_order.payFlag = #{payFlag}</if>
  1560. <if test="orderTime != null and orderTime != ''">and cm_shop_order.orderTime = #{orderTime}</if>
  1561. <if test="payTime != null and payTime != ''">and cm_shop_order.payTime = #{payTime}</if>
  1562. <if test="finishTime != null and finishTime != ''">and cm_shop_order.finishTime = #{finishTime}</if>
  1563. <if test="autoOverTimeMills != null ">and cm_shop_order.autoOverTimeMills = #{autoOverTimeMills}</if>
  1564. <if test="settleStatus != null and settleStatus != ''">and cm_shop_order.settleStatus = #{settleStatus}
  1565. </if>
  1566. <if test="payStatus != null and payStatus != ''">and cm_shop_order.payStatus = #{payStatus}</if>
  1567. <if test="receiptStatus != null and receiptStatus != ''">and cm_shop_order.receiptStatus =
  1568. #{receiptStatus}
  1569. </if>
  1570. <if test="sendOutStatus != null and sendOutStatus != ''">and cm_shop_order.sendOutStatus =
  1571. #{sendOutStatus}
  1572. </if>
  1573. <if test="refundStatus != null ">and cm_shop_order.refundStatus = #{refundStatus}</if>
  1574. <if test="returnGoodsStatus != null ">and cm_shop_order.returnGoodsStatus = #{returnGoodsStatus}</if>
  1575. <if test="receiveGoodsTime != null and receiveGoodsTime != ''">and cm_shop_order.receiveGoodsTime =
  1576. #{receiveGoodsTime}
  1577. </if>
  1578. <if test="autoReceiveTimeMills != null ">and cm_shop_order.autoReceiveTimeMills = #{autoReceiveTimeMills}
  1579. </if>
  1580. <if test="totalAddedValueTax != null ">and cm_shop_order.totalAddedValueTax = #{totalAddedValueTax}</if>
  1581. <if test="canRefundAmount != null ">and cm_shop_order.canRefundAmount = #{canRefundAmount}</if>
  1582. <if test="refundAmount != null ">and cm_shop_order.refundAmount = #{refundAmount}</if>
  1583. <if test="clubID != null ">and cm_shop_order.clubID = #{clubID}</if>
  1584. <if test="spID != null ">and cm_shop_order.spID = #{spID}</if>
  1585. <if test="mainSpID != null ">and cm_shop_order.mainSpID = #{mainSpID}</if>
  1586. <if test="orderBeanAmount != null ">and cm_shop_order.orderBeanAmount = #{orderBeanAmount}</if>
  1587. <if test="useBeanAmount != null ">and cm_shop_order.useBeanAmount = #{useBeanAmount}</if>
  1588. <if test="useBeanFlag != null ">and cm_shop_order.useBeanFlag = #{useBeanFlag}</if>
  1589. <if test="canRefundFlag != null ">and cm_shop_order.canRefundFlag = #{canRefundFlag}</if>
  1590. <if test="useBalanceFlag != null ">and cm_shop_order.useBalanceFlag = #{useBalanceFlag}</if>
  1591. <if test="canRefundBeans != null ">and cm_shop_order.canRefundBeans = #{canRefundBeans}</if>
  1592. <if test="freePostageFee != null ">and cm_shop_order.freePostageFee = #{freePostageFee}</if>
  1593. <if test="freePostageTicketID != null ">and cm_shop_order.freePostageTicketID = #{freePostageTicketID}</if>
  1594. <if test="brokerage != null ">and cm_shop_order.brokerage = #{brokerage}</if>
  1595. <if test="delFlag != null and delFlag != ''">and cm_shop_order.delFlag = #{delFlag}</if>
  1596. <if test="refundsAmount != null ">and cm_shop_order.refundsAmount = #{refundsAmount}</if>
  1597. <if test="orderStatusFlag != null and orderStatusFlag != ''">and cm_shop_order.orderStatusFlag =
  1598. #{orderStatusFlag}
  1599. </if>
  1600. <if test="buyStatus != null and buyStatus != ''">and cm_shop_order.buyStatus = #{buyStatus}</if>
  1601. <if test="deliveryTimeMills != null and deliveryTimeMills != ''">and cm_shop_order.deliveryTimeMills =
  1602. #{deliveryTimeMills}
  1603. </if>
  1604. <if test="orderDeliveryID != null ">and cm_shop_order.orderDeliveryID = #{orderDeliveryID}</if>
  1605. <if test="splitFlag != null and splitFlag != ''">and cm_shop_order.splitFlag = #{splitFlag}</if>
  1606. <if test="paying != null and paying != ''">and cm_shop_order.paying = #{paying}</if>
  1607. <if test="shopProductAmount != null ">and cm_shop_order.shopProductAmount = #{shopProductAmount}</if>
  1608. <if test="shopPostFee != null ">and cm_shop_order.shopPostFee = #{shopPostFee}</if>
  1609. <if test="shopPostFlag != null and shopPostFlag != ''">and cm_shop_order.shopPostFlag = #{shopPostFlag}
  1610. </if>
  1611. <if test="shopTaxFee != null ">and cm_shop_order.shopTaxFee = #{shopTaxFee}</if>
  1612. <if test="payCmAmount != null ">and cm_shop_order.payCmAmount = #{payCmAmount}</if>
  1613. <if test="shouldPayShopAmount != null ">and cm_shop_order.shouldPayShopAmount = #{shouldPayShopAmount}</if>
  1614. <if test="payedShopAmount != null ">and cm_shop_order.payedShopAmount = #{payedShopAmount}</if>
  1615. <if test="shopOtherFee != null ">and cm_shop_order.shopOtherFee = #{shopOtherFee}</if>
  1616. <if test="receiptedFlag != null and receiptedFlag != ''">and cm_shop_order.receiptedFlag =
  1617. #{receiptedFlag}
  1618. </if>
  1619. <if test="receiptedType != null and receiptedType != ''">and cm_shop_order.receiptedType =
  1620. #{receiptedType}
  1621. </if>
  1622. <if test="costType != null and costType != ''">and cm_shop_order.costType = #{costType}</if>
  1623. <if test="proportional != null ">and cm_shop_order.proportional = #{proportional}</if>
  1624. <if test="modifyShouldPayNote != null and modifyShouldPayNote != ''">and cm_shop_order.modifyShouldPayNote
  1625. = #{modifyShouldPayNote}
  1626. </if>
  1627. <if test="modifyShouldPayUserID != null ">and cm_shop_order.modifyShouldPayUserID =
  1628. #{modifyShouldPayUserID}
  1629. </if>
  1630. <if test="modifyShouldPayDate != null ">and cm_shop_order.modifyShouldPayDate = #{modifyShouldPayDate}</if>
  1631. <if test="zeroCostFlag != null ">and cm_shop_order.zeroCostFlag = #{zeroCostFlag}</if>
  1632. <if test="differenceType != null and differenceType != ''">and cm_shop_order.differenceType =
  1633. #{differenceType}
  1634. </if>
  1635. <if test="differencePrice != null ">and cm_shop_order.differencePrice = #{differencePrice}</if>
  1636. <if test="svipShopReduction != null ">and cm_shop_order.svipShopReduction = #{svipShopReduction}</if>
  1637. <if test="splitCode != null and splitCode != ''">and cm_shop_order.splitCode = #{splitCode}</if>
  1638. <if test="paySuccessCounter != null ">and cm_shop_order.paySuccessCounter = #{paySuccessCounter}</if>
  1639. <if test="onlinePayWays != null and onlinePayWays != ''">and cm_shop_order.onlinePayWays =
  1640. #{onlinePayWays}
  1641. </if>
  1642. <if test="status != null and status != ''">and cm_shop_order.shopStatus = #{status}</if>
  1643. </where>
  1644. group by cm_shop_order.shopOrderID
  1645. order by cm_shop_order.orderTime desc
  1646. limit 0,1
  1647. </select>
  1648. <select id="getCmShopOrderList" parameterType="com.caimei.modules.order.entity.NewShopOrder"
  1649. resultMap="CmShopOrderResult">
  1650. <include refid="selectCmShopOrderVo"/>
  1651. from cm_shop_order AS cm_shop_order
  1652. <where>cm_shop_order.delFlag = 0
  1653. <if test="shopOrderID != null and shopOrderID != ''">
  1654. and cm_shop_order.shopOrderID
  1655. = #{shopOrderID}
  1656. </if>
  1657. <if test="shopOrderID.toString().toUpperCase().indexOf('=')!=-1">
  1658. <if test="shopOrderID.toString().toUpperCase().indexOf('NOT')!=-1">not</if>
  1659. <if test="shopOrderID.toString().toUpperCase().indexOf('IN')!=-1">in</if>
  1660. <foreach item="shopOrderIDIn"
  1661. collection="shopOrderID.toString().substring(shopOrderID.toUpperCase().toString().indexOf('=')+1,shopOrderID.toString().length()).trim().split(',')"
  1662. open="(" separator="," close=")">
  1663. #{shopOrderIDIn}
  1664. </foreach>
  1665. </if>
  1666. <if test="shopOrderNo != null and shopOrderNo != ''">and cm_shop_order.shopOrderNo = #{shopOrderNo}</if>
  1667. <if test="orderNo != null and orderNo != ''">and cm_shop_order.orderNo = #{orderNo}</if>
  1668. <if test="orderID != null ">and cm_shop_order.orderID = #{orderID}</if>
  1669. <if test="organizeID != null ">and cm_shop_order.organizeID = #{organizeID}</if>
  1670. <if test="isColdChina != null ">and cm_shop_order.isColdChina = #{isColdChina}</if>
  1671. <if test="userID != null ">and cm_shop_order.userID = #{userID}</if>
  1672. <if test="shopID != null ">and cm_shop_order.shopID = #{shopID}</if>
  1673. <if test="orderPromotionsId != null ">and cm_shop_order.orderPromotionsId = #{orderPromotionsId}</if>
  1674. <if test="orderType != null ">and cm_shop_order.orderType = #{orderType}</if>
  1675. <if test="orderSubmitType != null ">and cm_shop_order.orderSubmitType = #{orderSubmitType}</if>
  1676. <if test="presentNum != null ">and cm_shop_order.presentNum = #{presentNum}</if>
  1677. <if test="itemCount != null ">and cm_shop_order.itemCount = #{itemCount}</if>
  1678. <if test="outStoreNum != null ">and cm_shop_order.outStoreNum = #{outStoreNum}</if>
  1679. <if test="outStoreTimes != null ">and cm_shop_order.outStoreTimes = #{outStoreTimes}</if>
  1680. <if test="townID != null ">and cm_shop_order.townID = #{townID}</if>
  1681. <if test="note != null and note != ''">and cm_shop_order.note = #{note}</if>
  1682. <if test="eachDiscount != null ">and cm_shop_order.eachDiscount = #{eachDiscount}</if>
  1683. <if test="realPay != null ">and cm_shop_order.realPay = #{realPay}</if>
  1684. <if test="receiptAmount != null ">and cm_shop_order.receiptAmount = #{receiptAmount}</if>
  1685. <if test="accountAmount != null ">and cm_shop_order.accountAmount = #{accountAmount}</if>
  1686. <if test="productAmount != null ">and cm_shop_order.productAmount = #{productAmount}</if>
  1687. <if test="totalAmount != null ">and cm_shop_order.totalAmount = #{totalAmount}</if>
  1688. <if test="needPayAmount != null ">and cm_shop_order.needPayAmount = #{needPayAmount}</if>
  1689. <if test="discountAmount != null ">and cm_shop_order.discountAmount = #{discountAmount}</if>
  1690. <if test="preferential != null ">and cm_shop_order.preferential = #{preferential}</if>
  1691. <if test="promotionFullReduction != null ">and cm_shop_order.promotionFullReduction =
  1692. #{promotionFullReduction}
  1693. </if>
  1694. <if test="payFlag != null and payFlag != ''">and cm_shop_order.payFlag = #{payFlag}</if>
  1695. <if test="orderTime != null and orderTime != ''">and cm_shop_order.orderTime = #{orderTime}</if>
  1696. <if test="payTime != null and payTime != ''">and cm_shop_order.payTime = #{payTime}</if>
  1697. <if test="finishTime != null and finishTime != ''">and cm_shop_order.finishTime = #{finishTime}</if>
  1698. <if test="autoOverTimeMills != null ">and cm_shop_order.autoOverTimeMills = #{autoOverTimeMills}</if>
  1699. <if test="settleStatus != null and settleStatus != ''">and cm_shop_order.settleStatus = #{settleStatus}
  1700. </if>
  1701. <if test="payStatus != null and payStatus != ''">and cm_shop_order.payStatus = #{payStatus}</if>
  1702. <if test="receiptStatus != null and receiptStatus != ''">and cm_shop_order.receiptStatus =
  1703. #{receiptStatus}
  1704. </if>
  1705. <if test="sendOutStatus != null and sendOutStatus != ''">and cm_shop_order.sendOutStatus =
  1706. #{sendOutStatus}
  1707. </if>
  1708. <if test="refundStatus != null ">and cm_shop_order.refundStatus = #{refundStatus}</if>
  1709. <if test="returnGoodsStatus != null ">and cm_shop_order.returnGoodsStatus = #{returnGoodsStatus}</if>
  1710. <if test="receiveGoodsTime != null and receiveGoodsTime != ''">and cm_shop_order.receiveGoodsTime =
  1711. #{receiveGoodsTime}
  1712. </if>
  1713. <if test="autoReceiveTimeMills != null ">and cm_shop_order.autoReceiveTimeMills = #{autoReceiveTimeMills}
  1714. </if>
  1715. <if test="totalAddedValueTax != null ">and cm_shop_order.totalAddedValueTax = #{totalAddedValueTax}</if>
  1716. <if test="canRefundAmount != null ">and cm_shop_order.canRefundAmount = #{canRefundAmount}</if>
  1717. <if test="refundAmount != null ">and cm_shop_order.refundAmount = #{refundAmount}</if>
  1718. <if test="clubID != null ">and cm_shop_order.clubID = #{clubID}</if>
  1719. <if test="spID != null ">and cm_shop_order.spID = #{spID}</if>
  1720. <if test="mainSpID != null ">and cm_shop_order.mainSpID = #{mainSpID}</if>
  1721. <if test="orderBeanAmount != null ">and cm_shop_order.orderBeanAmount = #{orderBeanAmount}</if>
  1722. <if test="useBeanAmount != null ">and cm_shop_order.useBeanAmount = #{useBeanAmount}</if>
  1723. <if test="useBeanFlag != null ">and cm_shop_order.useBeanFlag = #{useBeanFlag}</if>
  1724. <if test="canRefundFlag != null ">and cm_shop_order.canRefundFlag = #{canRefundFlag}</if>
  1725. <if test="useBalanceFlag != null ">and cm_shop_order.useBalanceFlag = #{useBalanceFlag}</if>
  1726. <if test="canRefundBeans != null ">and cm_shop_order.canRefundBeans = #{canRefundBeans}</if>
  1727. <if test="freePostageFee != null ">and cm_shop_order.freePostageFee = #{freePostageFee}</if>
  1728. <if test="freePostageTicketID != null ">and cm_shop_order.freePostageTicketID = #{freePostageTicketID}</if>
  1729. <if test="brokerage != null ">and cm_shop_order.brokerage = #{brokerage}</if>
  1730. <if test="delFlag != null and delFlag != ''">and cm_shop_order.delFlag = #{delFlag}</if>
  1731. <if test="refundsAmount != null ">and cm_shop_order.refundsAmount = #{refundsAmount}</if>
  1732. <if test="orderStatusFlag != null and orderStatusFlag != ''">and cm_shop_order.orderStatusFlag =
  1733. #{orderStatusFlag}
  1734. </if>
  1735. <if test="buyStatus != null and buyStatus != ''">and cm_shop_order.buyStatus = #{buyStatus}</if>
  1736. <if test="deliveryTimeMills != null and deliveryTimeMills != ''">and cm_shop_order.deliveryTimeMills =
  1737. #{deliveryTimeMills}
  1738. </if>
  1739. <if test="orderDeliveryID != null ">and cm_shop_order.orderDeliveryID = #{orderDeliveryID}</if>
  1740. <if test="splitFlag != null and splitFlag != ''">and cm_shop_order.splitFlag = #{splitFlag}</if>
  1741. <if test="paying != null and paying != ''">and cm_shop_order.paying = #{paying}</if>
  1742. <if test="shopProductAmount != null ">and cm_shop_order.shopProductAmount = #{shopProductAmount}</if>
  1743. <if test="shopPostFee != null ">and cm_shop_order.shopPostFee = #{shopPostFee}</if>
  1744. <if test="shopPostFlag != null and shopPostFlag != ''">and cm_shop_order.shopPostFlag = #{shopPostFlag}
  1745. </if>
  1746. <if test="shopTaxFee != null ">and cm_shop_order.shopTaxFee = #{shopTaxFee}</if>
  1747. <if test="payCmAmount != null ">and cm_shop_order.payCmAmount = #{payCmAmount}</if>
  1748. <if test="shouldPayShopAmount != null ">and cm_shop_order.shouldPayShopAmount = #{shouldPayShopAmount}</if>
  1749. <if test="payedShopAmount != null ">and cm_shop_order.payedShopAmount = #{payedShopAmount}</if>
  1750. <if test="shopOtherFee != null ">and cm_shop_order.shopOtherFee = #{shopOtherFee}</if>
  1751. <if test="receiptedFlag != null and receiptedFlag != ''">and cm_shop_order.receiptedFlag =
  1752. #{receiptedFlag}
  1753. </if>
  1754. <if test="receiptedType != null and receiptedType != ''">and cm_shop_order.receiptedType =
  1755. #{receiptedType}
  1756. </if>
  1757. <if test="costType != null and costType != ''">and cm_shop_order.costType = #{costType}</if>
  1758. <if test="proportional != null ">and cm_shop_order.proportional = #{proportional}</if>
  1759. <if test="modifyShouldPayNote != null and modifyShouldPayNote != ''">and cm_shop_order.modifyShouldPayNote
  1760. = #{modifyShouldPayNote}
  1761. </if>
  1762. <if test="modifyShouldPayUserID != null ">and cm_shop_order.modifyShouldPayUserID =
  1763. #{modifyShouldPayUserID}
  1764. </if>
  1765. <if test="modifyShouldPayDate != null ">and cm_shop_order.modifyShouldPayDate = #{modifyShouldPayDate}</if>
  1766. <if test="zeroCostFlag != null ">and cm_shop_order.zeroCostFlag = #{zeroCostFlag}</if>
  1767. <if test="differenceType != null and differenceType != ''">and cm_shop_order.differenceType =
  1768. #{differenceType}
  1769. </if>
  1770. <if test="differencePrice != null ">and cm_shop_order.differencePrice = #{differencePrice}</if>
  1771. <if test="svipShopReduction != null ">and cm_shop_order.svipShopReduction = #{svipShopReduction}</if>
  1772. <if test="splitCode != null and splitCode != ''">and cm_shop_order.splitCode = #{splitCode}</if>
  1773. <if test="paySuccessCounter != null ">and cm_shop_order.paySuccessCounter = #{paySuccessCounter}</if>
  1774. <if test="onlinePayWays != null and onlinePayWays != ''">and cm_shop_order.onlinePayWays =
  1775. #{onlinePayWays}
  1776. </if>
  1777. <if test="status != null and status != ''">and cm_shop_order.shopStatus = #{status}</if>
  1778. </where>
  1779. group by cm_shop_order.shopOrderID
  1780. order by cm_shop_order.orderTime desc
  1781. </select>
  1782. <select id="getCmShopOrderCount" parameterType="com.caimei.modules.order.entity.NewShopOrder" resultType="String">
  1783. select count(1)
  1784. from cm_shop_order AS cm_shop_order
  1785. <where>cm_shop_order.delFlag = 0
  1786. <if test="shopOrderID != null and shopOrderID != ''">
  1787. and cm_shop_order.shopOrderID
  1788. = #{shopOrderID}
  1789. </if>
  1790. <if test="shopOrderID.toString().toUpperCase().indexOf('=')!=-1">
  1791. <if test="shopOrderID.toString().toUpperCase().indexOf('NOT')!=-1">not</if>
  1792. <if test="shopOrderID.toString().toUpperCase().indexOf('IN')!=-1">in</if>
  1793. <foreach item="shopOrderIDIn"
  1794. collection="shopOrderID.toString().substring(shopOrderID.toUpperCase().toString().indexOf('=')+1,shopOrderID.toString().length()).trim().split(',')"
  1795. open="(" separator="," close=")">
  1796. #{shopOrderIDIn}
  1797. </foreach>
  1798. </if>
  1799. <if test="shopOrderNo != null and shopOrderNo != ''">and cm_shop_order.shopOrderNo = #{shopOrderNo}</if>
  1800. <if test="orderNo != null and orderNo != ''">and cm_shop_order.orderNo = #{orderNo}</if>
  1801. <if test="orderID != null ">and cm_shop_order.orderID = #{orderID}</if>
  1802. <if test="organizeID != null ">and cm_shop_order.organizeID = #{organizeID}</if>
  1803. <if test="isColdChina != null ">and cm_shop_order.isColdChina = #{isColdChina}</if>
  1804. <if test="userID != null ">and cm_shop_order.userID = #{userID}</if>
  1805. <if test="shopID != null ">and cm_shop_order.shopID = #{shopID}</if>
  1806. <if test="orderPromotionsId != null ">and cm_shop_order.orderPromotionsId = #{orderPromotionsId}</if>
  1807. <if test="orderType != null ">and cm_shop_order.orderType = #{orderType}</if>
  1808. <if test="orderSubmitType != null ">and cm_shop_order.orderSubmitType = #{orderSubmitType}</if>
  1809. <if test="presentNum != null ">and cm_shop_order.presentNum = #{presentNum}</if>
  1810. <if test="itemCount != null ">and cm_shop_order.itemCount = #{itemCount}</if>
  1811. <if test="outStoreNum != null ">and cm_shop_order.outStoreNum = #{outStoreNum}</if>
  1812. <if test="outStoreTimes != null ">and cm_shop_order.outStoreTimes = #{outStoreTimes}</if>
  1813. <if test="townID != null ">and cm_shop_order.townID = #{townID}</if>
  1814. <if test="note != null and note != ''">and cm_shop_order.note = #{note}</if>
  1815. <if test="eachDiscount != null ">and cm_shop_order.eachDiscount = #{eachDiscount}</if>
  1816. <if test="realPay != null ">and cm_shop_order.realPay = #{realPay}</if>
  1817. <if test="receiptAmount != null ">and cm_shop_order.receiptAmount = #{receiptAmount}</if>
  1818. <if test="accountAmount != null ">and cm_shop_order.accountAmount = #{accountAmount}</if>
  1819. <if test="productAmount != null ">and cm_shop_order.productAmount = #{productAmount}</if>
  1820. <if test="totalAmount != null ">and cm_shop_order.totalAmount = #{totalAmount}</if>
  1821. <if test="needPayAmount != null ">and cm_shop_order.needPayAmount = #{needPayAmount}</if>
  1822. <if test="discountAmount != null ">and cm_shop_order.discountAmount = #{discountAmount}</if>
  1823. <if test="preferential != null ">and cm_shop_order.preferential = #{preferential}</if>
  1824. <if test="promotionFullReduction != null ">and cm_shop_order.promotionFullReduction =
  1825. #{promotionFullReduction}
  1826. </if>
  1827. <if test="payFlag != null and payFlag != ''">and cm_shop_order.payFlag = #{payFlag}</if>
  1828. <if test="orderTime != null and orderTime != ''">and cm_shop_order.orderTime = #{orderTime}</if>
  1829. <if test="payTime != null and payTime != ''">and cm_shop_order.payTime = #{payTime}</if>
  1830. <if test="finishTime != null and finishTime != ''">and cm_shop_order.finishTime = #{finishTime}</if>
  1831. <if test="autoOverTimeMills != null ">and cm_shop_order.autoOverTimeMills = #{autoOverTimeMills}</if>
  1832. <if test="settleStatus != null and settleStatus != ''">and cm_shop_order.settleStatus = #{settleStatus}
  1833. </if>
  1834. <if test="payStatus != null and payStatus != ''">and cm_shop_order.payStatus = #{payStatus}</if>
  1835. <if test="receiptStatus != null and receiptStatus != ''">and cm_shop_order.receiptStatus =
  1836. #{receiptStatus}
  1837. </if>
  1838. <if test="sendOutStatus != null and sendOutStatus != ''">and cm_shop_order.sendOutStatus =
  1839. #{sendOutStatus}
  1840. </if>
  1841. <if test="refundStatus != null ">and cm_shop_order.refundStatus = #{refundStatus}</if>
  1842. <if test="returnGoodsStatus != null ">and cm_shop_order.returnGoodsStatus = #{returnGoodsStatus}</if>
  1843. <if test="receiveGoodsTime != null and receiveGoodsTime != ''">and cm_shop_order.receiveGoodsTime =
  1844. #{receiveGoodsTime}
  1845. </if>
  1846. <if test="autoReceiveTimeMills != null ">and cm_shop_order.autoReceiveTimeMills = #{autoReceiveTimeMills}
  1847. </if>
  1848. <if test="totalAddedValueTax != null ">and cm_shop_order.totalAddedValueTax = #{totalAddedValueTax}</if>
  1849. <if test="canRefundAmount != null ">and cm_shop_order.canRefundAmount = #{canRefundAmount}</if>
  1850. <if test="refundAmount != null ">and cm_shop_order.refundAmount = #{refundAmount}</if>
  1851. <if test="clubID != null ">and cm_shop_order.clubID = #{clubID}</if>
  1852. <if test="spID != null ">and cm_shop_order.spID = #{spID}</if>
  1853. <if test="mainSpID != null ">and cm_shop_order.mainSpID = #{mainSpID}</if>
  1854. <if test="orderBeanAmount != null ">and cm_shop_order.orderBeanAmount = #{orderBeanAmount}</if>
  1855. <if test="useBeanAmount != null ">and cm_shop_order.useBeanAmount = #{useBeanAmount}</if>
  1856. <if test="useBeanFlag != null ">and cm_shop_order.useBeanFlag = #{useBeanFlag}</if>
  1857. <if test="canRefundFlag != null ">and cm_shop_order.canRefundFlag = #{canRefundFlag}</if>
  1858. <if test="useBalanceFlag != null ">and cm_shop_order.useBalanceFlag = #{useBalanceFlag}</if>
  1859. <if test="canRefundBeans != null ">and cm_shop_order.canRefundBeans = #{canRefundBeans}</if>
  1860. <if test="freePostageFee != null ">and cm_shop_order.freePostageFee = #{freePostageFee}</if>
  1861. <if test="freePostageTicketID != null ">and cm_shop_order.freePostageTicketID = #{freePostageTicketID}</if>
  1862. <if test="brokerage != null ">and cm_shop_order.brokerage = #{brokerage}</if>
  1863. <if test="delFlag != null and delFlag != ''">and cm_shop_order.delFlag = #{delFlag}</if>
  1864. <if test="refundsAmount != null ">and cm_shop_order.refundsAmount = #{refundsAmount}</if>
  1865. <if test="orderStatusFlag != null and orderStatusFlag != ''">and cm_shop_order.orderStatusFlag =
  1866. #{orderStatusFlag}
  1867. </if>
  1868. <if test="buyStatus != null and buyStatus != ''">and cm_shop_order.buyStatus = #{buyStatus}</if>
  1869. <if test="deliveryTimeMills != null and deliveryTimeMills != ''">and cm_shop_order.deliveryTimeMills =
  1870. #{deliveryTimeMills}
  1871. </if>
  1872. <if test="orderDeliveryID != null ">and cm_shop_order.orderDeliveryID = #{orderDeliveryID}</if>
  1873. <if test="splitFlag != null and splitFlag != ''">and cm_shop_order.splitFlag = #{splitFlag}</if>
  1874. <if test="paying != null and paying != ''">and cm_shop_order.paying = #{paying}</if>
  1875. <if test="shopProductAmount != null ">and cm_shop_order.shopProductAmount = #{shopProductAmount}</if>
  1876. <if test="shopPostFee != null ">and cm_shop_order.shopPostFee = #{shopPostFee}</if>
  1877. <if test="shopPostFlag != null and shopPostFlag != ''">and cm_shop_order.shopPostFlag = #{shopPostFlag}
  1878. </if>
  1879. <if test="shopTaxFee != null ">and cm_shop_order.shopTaxFee = #{shopTaxFee}</if>
  1880. <if test="payCmAmount != null ">and cm_shop_order.payCmAmount = #{payCmAmount}</if>
  1881. <if test="shouldPayShopAmount != null ">and cm_shop_order.shouldPayShopAmount = #{shouldPayShopAmount}</if>
  1882. <if test="payedShopAmount != null ">and cm_shop_order.payedShopAmount = #{payedShopAmount}</if>
  1883. <if test="shopOtherFee != null ">and cm_shop_order.shopOtherFee = #{shopOtherFee}</if>
  1884. <if test="receiptedFlag != null and receiptedFlag != ''">and cm_shop_order.receiptedFlag =
  1885. #{receiptedFlag}
  1886. </if>
  1887. <if test="receiptedType != null and receiptedType != ''">and cm_shop_order.receiptedType =
  1888. #{receiptedType}
  1889. </if>
  1890. <if test="costType != null and costType != ''">and cm_shop_order.costType = #{costType}</if>
  1891. <if test="proportional != null ">and cm_shop_order.proportional = #{proportional}</if>
  1892. <if test="modifyShouldPayNote != null and modifyShouldPayNote != ''">and cm_shop_order.modifyShouldPayNote
  1893. = #{modifyShouldPayNote}
  1894. </if>
  1895. <if test="modifyShouldPayUserID != null ">and cm_shop_order.modifyShouldPayUserID =
  1896. #{modifyShouldPayUserID}
  1897. </if>
  1898. <if test="modifyShouldPayDate != null ">and cm_shop_order.modifyShouldPayDate = #{modifyShouldPayDate}</if>
  1899. <if test="zeroCostFlag != null ">and cm_shop_order.zeroCostFlag = #{zeroCostFlag}</if>
  1900. <if test="differenceType != null and differenceType != ''">and cm_shop_order.differenceType =
  1901. #{differenceType}
  1902. </if>
  1903. <if test="differencePrice != null ">and cm_shop_order.differencePrice = #{differencePrice}</if>
  1904. <if test="svipShopReduction != null ">and cm_shop_order.svipShopReduction = #{svipShopReduction}</if>
  1905. <if test="splitCode != null and splitCode != ''">and cm_shop_order.splitCode = #{splitCode}</if>
  1906. <if test="paySuccessCounter != null ">and cm_shop_order.paySuccessCounter = #{paySuccessCounter}</if>
  1907. <if test="onlinePayWays != null and onlinePayWays != ''">and cm_shop_order.onlinePayWays =
  1908. #{onlinePayWays}
  1909. </if>
  1910. <if test="status != null and status != ''">and cm_shop_order.shopStatus = #{status}</if>
  1911. </where>
  1912. group by cm_shop_order.shopOrderID
  1913. </select>
  1914. <select id="getCmShopOrderByShopOrderID" parameterType="String" resultMap="CmShopOrderResult">
  1915. <include refid="selectCmShopOrderVo"/>
  1916. from cm_shop_order AS cm_shop_order
  1917. where cm_shop_order.delFlag = 0 and cm_shop_order.shopOrderID = #{shopOrderID}
  1918. </select>
  1919. <select id="getByIds" parameterType="com.caimei.modules.order.entity.NewShopOrder" resultType="String">
  1920. select shopOrderID
  1921. from cm_shop_order AS cm_shop_order
  1922. <where>cm_shop_order.delFlag = 0
  1923. <if test="shopOrderID != null and shopOrderID != ''">
  1924. and cm_shop_order.shopOrderID
  1925. = #{shopOrderID}
  1926. </if>
  1927. <if test="shopOrderID.toString().toUpperCase().indexOf('=')!=-1">
  1928. <if test="shopOrderID.toString().toUpperCase().indexOf('NOT')!=-1">not</if>
  1929. <if test="shopOrderID.toString().toUpperCase().indexOf('IN')!=-1">in</if>
  1930. <foreach item="shopOrderIDIn"
  1931. collection="shopOrderID.toString().substring(shopOrderID.toUpperCase().toString().indexOf('=')+1,shopOrderID.toString().length()).trim().split(',')"
  1932. open="(" separator="," close=")">
  1933. #{shopOrderIDIn}
  1934. </foreach>
  1935. </if>
  1936. <if test="shopOrderNo != null and shopOrderNo != ''">and cm_shop_order.shopOrderNo = #{shopOrderNo}</if>
  1937. <if test="orderNo != null and orderNo != ''">and cm_shop_order.orderNo = #{orderNo}</if>
  1938. <if test="orderID != null ">and cm_shop_order.orderID = #{orderID}</if>
  1939. <if test="organizeID != null ">and cm_shop_order.organizeID = #{organizeID}</if>
  1940. <if test="isColdChina != null ">and cm_shop_order.isColdChina = #{isColdChina}</if>
  1941. <if test="userID != null ">and cm_shop_order.userID = #{userID}</if>
  1942. <if test="shopID != null ">and cm_shop_order.shopID = #{shopID}</if>
  1943. <if test="orderPromotionsId != null ">and cm_shop_order.orderPromotionsId = #{orderPromotionsId}</if>
  1944. <if test="orderType != null ">and cm_shop_order.orderType = #{orderType}</if>
  1945. <if test="orderSubmitType != null ">and cm_shop_order.orderSubmitType = #{orderSubmitType}</if>
  1946. <if test="presentNum != null ">and cm_shop_order.presentNum = #{presentNum}</if>
  1947. <if test="itemCount != null ">and cm_shop_order.itemCount = #{itemCount}</if>
  1948. <if test="outStoreNum != null ">and cm_shop_order.outStoreNum = #{outStoreNum}</if>
  1949. <if test="outStoreTimes != null ">and cm_shop_order.outStoreTimes = #{outStoreTimes}</if>
  1950. <if test="townID != null ">and cm_shop_order.townID = #{townID}</if>
  1951. <if test="note != null and note != ''">and cm_shop_order.note = #{note}</if>
  1952. <if test="eachDiscount != null ">and cm_shop_order.eachDiscount = #{eachDiscount}</if>
  1953. <if test="realPay != null ">and cm_shop_order.realPay = #{realPay}</if>
  1954. <if test="receiptAmount != null ">and cm_shop_order.receiptAmount = #{receiptAmount}</if>
  1955. <if test="accountAmount != null ">and cm_shop_order.accountAmount = #{accountAmount}</if>
  1956. <if test="productAmount != null ">and cm_shop_order.productAmount = #{productAmount}</if>
  1957. <if test="totalAmount != null ">and cm_shop_order.totalAmount = #{totalAmount}</if>
  1958. <if test="needPayAmount != null ">and cm_shop_order.needPayAmount = #{needPayAmount}</if>
  1959. <if test="discountAmount != null ">and cm_shop_order.discountAmount = #{discountAmount}</if>
  1960. <if test="preferential != null ">and cm_shop_order.preferential = #{preferential}</if>
  1961. <if test="promotionFullReduction != null ">and cm_shop_order.promotionFullReduction =
  1962. #{promotionFullReduction}
  1963. </if>
  1964. <if test="payFlag != null and payFlag != ''">and cm_shop_order.payFlag = #{payFlag}</if>
  1965. <if test="orderTime != null and orderTime != ''">and cm_shop_order.orderTime = #{orderTime}</if>
  1966. <if test="payTime != null and payTime != ''">and cm_shop_order.payTime = #{payTime}</if>
  1967. <if test="finishTime != null and finishTime != ''">and cm_shop_order.finishTime = #{finishTime}</if>
  1968. <if test="autoOverTimeMills != null ">and cm_shop_order.autoOverTimeMills = #{autoOverTimeMills}</if>
  1969. <if test="settleStatus != null and settleStatus != ''">and cm_shop_order.settleStatus = #{settleStatus}
  1970. </if>
  1971. <if test="payStatus != null and payStatus != ''">and cm_shop_order.payStatus = #{payStatus}</if>
  1972. <if test="receiptStatus != null and receiptStatus != ''">and cm_shop_order.receiptStatus =
  1973. #{receiptStatus}
  1974. </if>
  1975. <if test="sendOutStatus != null and sendOutStatus != ''">and cm_shop_order.sendOutStatus =
  1976. #{sendOutStatus}
  1977. </if>
  1978. <if test="refundStatus != null ">and cm_shop_order.refundStatus = #{refundStatus}</if>
  1979. <if test="returnGoodsStatus != null ">and cm_shop_order.returnGoodsStatus = #{returnGoodsStatus}</if>
  1980. <if test="receiveGoodsTime != null and receiveGoodsTime != ''">and cm_shop_order.receiveGoodsTime =
  1981. #{receiveGoodsTime}
  1982. </if>
  1983. <if test="autoReceiveTimeMills != null ">and cm_shop_order.autoReceiveTimeMills = #{autoReceiveTimeMills}
  1984. </if>
  1985. <if test="totalAddedValueTax != null ">and cm_shop_order.totalAddedValueTax = #{totalAddedValueTax}</if>
  1986. <if test="canRefundAmount != null ">and cm_shop_order.canRefundAmount = #{canRefundAmount}</if>
  1987. <if test="refundAmount != null ">and cm_shop_order.refundAmount = #{refundAmount}</if>
  1988. <if test="clubID != null ">and cm_shop_order.clubID = #{clubID}</if>
  1989. <if test="spID != null ">and cm_shop_order.spID = #{spID}</if>
  1990. <if test="mainSpID != null ">and cm_shop_order.mainSpID = #{mainSpID}</if>
  1991. <if test="orderBeanAmount != null ">and cm_shop_order.orderBeanAmount = #{orderBeanAmount}</if>
  1992. <if test="useBeanAmount != null ">and cm_shop_order.useBeanAmount = #{useBeanAmount}</if>
  1993. <if test="useBeanFlag != null ">and cm_shop_order.useBeanFlag = #{useBeanFlag}</if>
  1994. <if test="canRefundFlag != null ">and cm_shop_order.canRefundFlag = #{canRefundFlag}</if>
  1995. <if test="useBalanceFlag != null ">and cm_shop_order.useBalanceFlag = #{useBalanceFlag}</if>
  1996. <if test="canRefundBeans != null ">and cm_shop_order.canRefundBeans = #{canRefundBeans}</if>
  1997. <if test="freePostageFee != null ">and cm_shop_order.freePostageFee = #{freePostageFee}</if>
  1998. <if test="freePostageTicketID != null ">and cm_shop_order.freePostageTicketID = #{freePostageTicketID}</if>
  1999. <if test="brokerage != null ">and cm_shop_order.brokerage = #{brokerage}</if>
  2000. <if test="delFlag != null and delFlag != ''">and cm_shop_order.delFlag = #{delFlag}</if>
  2001. <if test="refundsAmount != null ">and cm_shop_order.refundsAmount = #{refundsAmount}</if>
  2002. <if test="orderStatusFlag != null and orderStatusFlag != ''">and cm_shop_order.orderStatusFlag =
  2003. #{orderStatusFlag}
  2004. </if>
  2005. <if test="buyStatus != null and buyStatus != ''">and cm_shop_order.buyStatus = #{buyStatus}</if>
  2006. <if test="deliveryTimeMills != null and deliveryTimeMills != ''">and cm_shop_order.deliveryTimeMills =
  2007. #{deliveryTimeMills}
  2008. </if>
  2009. <if test="orderDeliveryID != null ">and cm_shop_order.orderDeliveryID = #{orderDeliveryID}</if>
  2010. <if test="splitFlag != null and splitFlag != ''">and cm_shop_order.splitFlag = #{splitFlag}</if>
  2011. <if test="paying != null and paying != ''">and cm_shop_order.paying = #{paying}</if>
  2012. <if test="shopProductAmount != null ">and cm_shop_order.shopProductAmount = #{shopProductAmount}</if>
  2013. <if test="shopPostFee != null ">and cm_shop_order.shopPostFee = #{shopPostFee}</if>
  2014. <if test="shopPostFlag != null and shopPostFlag != ''">and cm_shop_order.shopPostFlag = #{shopPostFlag}
  2015. </if>
  2016. <if test="shopTaxFee != null ">and cm_shop_order.shopTaxFee = #{shopTaxFee}</if>
  2017. <if test="payCmAmount != null ">and cm_shop_order.payCmAmount = #{payCmAmount}</if>
  2018. <if test="shouldPayShopAmount != null ">and cm_shop_order.shouldPayShopAmount = #{shouldPayShopAmount}</if>
  2019. <if test="payedShopAmount != null ">and cm_shop_order.payedShopAmount = #{payedShopAmount}</if>
  2020. <if test="shopOtherFee != null ">and cm_shop_order.shopOtherFee = #{shopOtherFee}</if>
  2021. <if test="receiptedFlag != null and receiptedFlag != ''">and cm_shop_order.receiptedFlag =
  2022. #{receiptedFlag}
  2023. </if>
  2024. <if test="receiptedType != null and receiptedType != ''">and cm_shop_order.receiptedType =
  2025. #{receiptedType}
  2026. </if>
  2027. <if test="costType != null and costType != ''">and cm_shop_order.costType = #{costType}</if>
  2028. <if test="proportional != null ">and cm_shop_order.proportional = #{proportional}</if>
  2029. <if test="modifyShouldPayNote != null and modifyShouldPayNote != ''">and cm_shop_order.modifyShouldPayNote
  2030. = #{modifyShouldPayNote}
  2031. </if>
  2032. <if test="modifyShouldPayUserID != null ">and cm_shop_order.modifyShouldPayUserID =
  2033. #{modifyShouldPayUserID}
  2034. </if>
  2035. <if test="modifyShouldPayDate != null ">and cm_shop_order.modifyShouldPayDate = #{modifyShouldPayDate}</if>
  2036. <if test="zeroCostFlag != null ">and cm_shop_order.zeroCostFlag = #{zeroCostFlag}</if>
  2037. <if test="differenceType != null and differenceType != ''">and cm_shop_order.differenceType =
  2038. #{differenceType}
  2039. </if>
  2040. <if test="differencePrice != null ">and cm_shop_order.differencePrice = #{differencePrice}</if>
  2041. <if test="svipShopReduction != null ">and cm_shop_order.svipShopReduction = #{svipShopReduction}</if>
  2042. <if test="splitCode != null and splitCode != ''">and cm_shop_order.splitCode = #{splitCode}</if>
  2043. <if test="paySuccessCounter != null ">and cm_shop_order.paySuccessCounter = #{paySuccessCounter}</if>
  2044. <if test="onlinePayWays != null and onlinePayWays != ''">and cm_shop_order.onlinePayWays =
  2045. #{onlinePayWays}
  2046. </if>
  2047. <if test="status != null and status != ''">and cm_shop_order.shopStatus = #{status}</if>
  2048. </where>
  2049. group by cm_shop_order.shopOrderID
  2050. </select>
  2051. <select id="getById" parameterType="com.caimei.modules.order.entity.NewShopOrder" resultType="String">
  2052. select shopOrderID
  2053. from cm_shop_order AS cm_shop_order
  2054. <where>cm_shop_order.delFlag = 0
  2055. <if test="shopOrderID != null and shopOrderID != ''">
  2056. and cm_shop_order.shopOrderID
  2057. = #{shopOrderID}
  2058. </if>
  2059. <if test="shopOrderID.toString().toUpperCase().indexOf('=')!=-1">
  2060. <if test="shopOrderID.toString().toUpperCase().indexOf('NOT')!=-1">not</if>
  2061. <if test="shopOrderID.toString().toUpperCase().indexOf('IN')!=-1">in</if>
  2062. <foreach item="shopOrderIDIn"
  2063. collection="shopOrderID.toString().substring(shopOrderID.toUpperCase().toString().indexOf('=')+1,shopOrderID.toString().length()).trim().split(',')"
  2064. open="(" separator="," close=")">
  2065. #{shopOrderIDIn}
  2066. </foreach>
  2067. </if>
  2068. <if test="shopOrderNo != null and shopOrderNo != ''">and cm_shop_order.shopOrderNo = #{shopOrderNo}</if>
  2069. <if test="orderNo != null and orderNo != ''">and cm_shop_order.orderNo = #{orderNo}</if>
  2070. <if test="orderID != null ">and cm_shop_order.orderID = #{orderID}</if>
  2071. <if test="organizeID != null ">and cm_shop_order.organizeID = #{organizeID}</if>
  2072. <if test="isColdChina != null ">and cm_shop_order.isColdChina = #{isColdChina}</if>
  2073. <if test="userID != null ">and cm_shop_order.userID = #{userID}</if>
  2074. <if test="shopID != null ">and cm_shop_order.shopID = #{shopID}</if>
  2075. <if test="orderPromotionsId != null ">and cm_shop_order.orderPromotionsId = #{orderPromotionsId}</if>
  2076. <if test="orderType != null ">and cm_shop_order.orderType = #{orderType}</if>
  2077. <if test="orderSubmitType != null ">and cm_shop_order.orderSubmitType = #{orderSubmitType}</if>
  2078. <if test="presentNum != null ">and cm_shop_order.presentNum = #{presentNum}</if>
  2079. <if test="itemCount != null ">and cm_shop_order.itemCount = #{itemCount}</if>
  2080. <if test="outStoreNum != null ">and cm_shop_order.outStoreNum = #{outStoreNum}</if>
  2081. <if test="outStoreTimes != null ">and cm_shop_order.outStoreTimes = #{outStoreTimes}</if>
  2082. <if test="townID != null ">and cm_shop_order.townID = #{townID}</if>
  2083. <if test="note != null and note != ''">and cm_shop_order.note = #{note}</if>
  2084. <if test="eachDiscount != null ">and cm_shop_order.eachDiscount = #{eachDiscount}</if>
  2085. <if test="realPay != null ">and cm_shop_order.realPay = #{realPay}</if>
  2086. <if test="receiptAmount != null ">and cm_shop_order.receiptAmount = #{receiptAmount}</if>
  2087. <if test="accountAmount != null ">and cm_shop_order.accountAmount = #{accountAmount}</if>
  2088. <if test="productAmount != null ">and cm_shop_order.productAmount = #{productAmount}</if>
  2089. <if test="totalAmount != null ">and cm_shop_order.totalAmount = #{totalAmount}</if>
  2090. <if test="needPayAmount != null ">and cm_shop_order.needPayAmount = #{needPayAmount}</if>
  2091. <if test="discountAmount != null ">and cm_shop_order.discountAmount = #{discountAmount}</if>
  2092. <if test="preferential != null ">and cm_shop_order.preferential = #{preferential}</if>
  2093. <if test="promotionFullReduction != null ">and cm_shop_order.promotionFullReduction =
  2094. #{promotionFullReduction}
  2095. </if>
  2096. <if test="payFlag != null and payFlag != ''">and cm_shop_order.payFlag = #{payFlag}</if>
  2097. <if test="orderTime != null and orderTime != ''">and cm_shop_order.orderTime = #{orderTime}</if>
  2098. <if test="payTime != null and payTime != ''">and cm_shop_order.payTime = #{payTime}</if>
  2099. <if test="finishTime != null and finishTime != ''">and cm_shop_order.finishTime = #{finishTime}</if>
  2100. <if test="autoOverTimeMills != null ">and cm_shop_order.autoOverTimeMills = #{autoOverTimeMills}</if>
  2101. <if test="settleStatus != null and settleStatus != ''">and cm_shop_order.settleStatus = #{settleStatus}
  2102. </if>
  2103. <if test="payStatus != null and payStatus != ''">and cm_shop_order.payStatus = #{payStatus}</if>
  2104. <if test="receiptStatus != null and receiptStatus != ''">and cm_shop_order.receiptStatus =
  2105. #{receiptStatus}
  2106. </if>
  2107. <if test="sendOutStatus != null and sendOutStatus != ''">and cm_shop_order.sendOutStatus =
  2108. #{sendOutStatus}
  2109. </if>
  2110. <if test="refundStatus != null ">and cm_shop_order.refundStatus = #{refundStatus}</if>
  2111. <if test="returnGoodsStatus != null ">and cm_shop_order.returnGoodsStatus = #{returnGoodsStatus}</if>
  2112. <if test="receiveGoodsTime != null and receiveGoodsTime != ''">and cm_shop_order.receiveGoodsTime =
  2113. #{receiveGoodsTime}
  2114. </if>
  2115. <if test="autoReceiveTimeMills != null ">and cm_shop_order.autoReceiveTimeMills = #{autoReceiveTimeMills}
  2116. </if>
  2117. <if test="totalAddedValueTax != null ">and cm_shop_order.totalAddedValueTax = #{totalAddedValueTax}</if>
  2118. <if test="canRefundAmount != null ">and cm_shop_order.canRefundAmount = #{canRefundAmount}</if>
  2119. <if test="refundAmount != null ">and cm_shop_order.refundAmount = #{refundAmount}</if>
  2120. <if test="clubID != null ">and cm_shop_order.clubID = #{clubID}</if>
  2121. <if test="spID != null ">and cm_shop_order.spID = #{spID}</if>
  2122. <if test="mainSpID != null ">and cm_shop_order.mainSpID = #{mainSpID}</if>
  2123. <if test="orderBeanAmount != null ">and cm_shop_order.orderBeanAmount = #{orderBeanAmount}</if>
  2124. <if test="useBeanAmount != null ">and cm_shop_order.useBeanAmount = #{useBeanAmount}</if>
  2125. <if test="useBeanFlag != null ">and cm_shop_order.useBeanFlag = #{useBeanFlag}</if>
  2126. <if test="canRefundFlag != null ">and cm_shop_order.canRefundFlag = #{canRefundFlag}</if>
  2127. <if test="useBalanceFlag != null ">and cm_shop_order.useBalanceFlag = #{useBalanceFlag}</if>
  2128. <if test="canRefundBeans != null ">and cm_shop_order.canRefundBeans = #{canRefundBeans}</if>
  2129. <if test="freePostageFee != null ">and cm_shop_order.freePostageFee = #{freePostageFee}</if>
  2130. <if test="freePostageTicketID != null ">and cm_shop_order.freePostageTicketID = #{freePostageTicketID}</if>
  2131. <if test="brokerage != null ">and cm_shop_order.brokerage = #{brokerage}</if>
  2132. <if test="delFlag != null and delFlag != ''">and cm_shop_order.delFlag = #{delFlag}</if>
  2133. <if test="refundsAmount != null ">and cm_shop_order.refundsAmount = #{refundsAmount}</if>
  2134. <if test="orderStatusFlag != null and orderStatusFlag != ''">and cm_shop_order.orderStatusFlag =
  2135. #{orderStatusFlag}
  2136. </if>
  2137. <if test="buyStatus != null and buyStatus != ''">and cm_shop_order.buyStatus = #{buyStatus}</if>
  2138. <if test="deliveryTimeMills != null and deliveryTimeMills != ''">and cm_shop_order.deliveryTimeMills =
  2139. #{deliveryTimeMills}
  2140. </if>
  2141. <if test="orderDeliveryID != null ">and cm_shop_order.orderDeliveryID = #{orderDeliveryID}</if>
  2142. <if test="splitFlag != null and splitFlag != ''">and cm_shop_order.splitFlag = #{splitFlag}</if>
  2143. <if test="paying != null and paying != ''">and cm_shop_order.paying = #{paying}</if>
  2144. <if test="shopProductAmount != null ">and cm_shop_order.shopProductAmount = #{shopProductAmount}</if>
  2145. <if test="shopPostFee != null ">and cm_shop_order.shopPostFee = #{shopPostFee}</if>
  2146. <if test="shopPostFlag != null and shopPostFlag != ''">and cm_shop_order.shopPostFlag = #{shopPostFlag}
  2147. </if>
  2148. <if test="shopTaxFee != null ">and cm_shop_order.shopTaxFee = #{shopTaxFee}</if>
  2149. <if test="payCmAmount != null ">and cm_shop_order.payCmAmount = #{payCmAmount}</if>
  2150. <if test="shouldPayShopAmount != null ">and cm_shop_order.shouldPayShopAmount = #{shouldPayShopAmount}</if>
  2151. <if test="payedShopAmount != null ">and cm_shop_order.payedShopAmount = #{payedShopAmount}</if>
  2152. <if test="shopOtherFee != null ">and cm_shop_order.shopOtherFee = #{shopOtherFee}</if>
  2153. <if test="receiptedFlag != null and receiptedFlag != ''">and cm_shop_order.receiptedFlag =
  2154. #{receiptedFlag}
  2155. </if>
  2156. <if test="receiptedType != null and receiptedType != ''">and cm_shop_order.receiptedType =
  2157. #{receiptedType}
  2158. </if>
  2159. <if test="costType != null and costType != ''">and cm_shop_order.costType = #{costType}</if>
  2160. <if test="proportional != null ">and cm_shop_order.proportional = #{proportional}</if>
  2161. <if test="modifyShouldPayNote != null and modifyShouldPayNote != ''">and cm_shop_order.modifyShouldPayNote
  2162. = #{modifyShouldPayNote}
  2163. </if>
  2164. <if test="modifyShouldPayUserID != null ">and cm_shop_order.modifyShouldPayUserID =
  2165. #{modifyShouldPayUserID}
  2166. </if>
  2167. <if test="modifyShouldPayDate != null ">and cm_shop_order.modifyShouldPayDate = #{modifyShouldPayDate}</if>
  2168. <if test="zeroCostFlag != null ">and cm_shop_order.zeroCostFlag = #{zeroCostFlag}</if>
  2169. <if test="differenceType != null and differenceType != ''">and cm_shop_order.differenceType =
  2170. #{differenceType}
  2171. </if>
  2172. <if test="differencePrice != null ">and cm_shop_order.differencePrice = #{differencePrice}</if>
  2173. <if test="svipShopReduction != null ">and cm_shop_order.svipShopReduction = #{svipShopReduction}</if>
  2174. <if test="splitCode != null and splitCode != ''">and cm_shop_order.splitCode = #{splitCode}</if>
  2175. <if test="paySuccessCounter != null ">and cm_shop_order.paySuccessCounter = #{paySuccessCounter}</if>
  2176. <if test="onlinePayWays != null and onlinePayWays != ''">and cm_shop_order.onlinePayWays =
  2177. #{onlinePayWays}
  2178. </if>
  2179. <if test="status != null and status != ''">and cm_shop_order.shopStatus = #{status}</if>
  2180. </where>
  2181. group by cm_shop_order.shopOrderID
  2182. limit 0,1
  2183. </select>
  2184. <insert id="addCmShopOrder" parameterType="com.caimei.modules.order.entity.NewShopOrder" useGeneratedKeys="true"
  2185. keyProperty="shopOrderID">
  2186. insert into cm_shop_order
  2187. <trim prefix="(" suffix=")" suffixOverrides=",">
  2188. <if test="shopOrderID != null and shopOrderID != ''">shopOrderID,</if>
  2189. <if test="shopOrderNo != null and shopOrderNo != ''">shopOrderNo,</if>
  2190. <if test="orderNo != null and orderNo != ''">orderNo,</if>
  2191. <if test="orderID != null">orderID,</if>
  2192. <if test="organizeID != null">organizeID,</if>
  2193. <if test="isColdChina != null">isColdChina,</if>
  2194. <if test="userID != null">userID,</if>
  2195. <if test="shopID != null">shopID,</if>
  2196. <if test="orderPromotionsId != null">orderPromotionsId,</if>
  2197. <if test="orderType != null">orderType,</if>
  2198. <if test="orderSubmitType != null">orderSubmitType,</if>
  2199. <if test="presentNum != null">presentNum,</if>
  2200. <if test="itemCount != null">itemCount,</if>
  2201. <if test="outStoreNum != null">outStoreNum,</if>
  2202. <if test="outStoreTimes != null">outStoreTimes,</if>
  2203. <if test="townID != null">townID,</if>
  2204. <if test="note != null and note != ''">note,</if>
  2205. <if test="eachDiscount != null">eachDiscount,</if>
  2206. <if test="realPay != null">realPay,</if>
  2207. <if test="receiptAmount != null">receiptAmount,</if>
  2208. <if test="accountAmount != null">accountAmount,</if>
  2209. <if test="productAmount != null">productAmount,</if>
  2210. <if test="totalAmount != null">totalAmount,</if>
  2211. <if test="needPayAmount != null">needPayAmount,</if>
  2212. <if test="discountAmount != null">discountAmount,</if>
  2213. <if test="preferential != null">preferential,</if>
  2214. <if test="promotionFullReduction != null">promotionFullReduction,</if>
  2215. <if test="payFlag != null and payFlag != ''">payFlag,</if>
  2216. <if test="orderTime != null and orderTime != ''">orderTime,</if>
  2217. <if test="payTime != null and payTime != ''">payTime,</if>
  2218. <if test="finishTime != null and finishTime != ''">finishTime,</if>
  2219. <if test="autoOverTimeMills != null">autoOverTimeMills,</if>
  2220. <if test="settleStatus != null and settleStatus != ''">settleStatus,</if>
  2221. <if test="payStatus != null and payStatus != ''">payStatus,</if>
  2222. <if test="receiptStatus != null and receiptStatus != ''">receiptStatus,</if>
  2223. <if test="sendOutStatus != null and sendOutStatus != ''">sendOutStatus,</if>
  2224. <if test="refundStatus != null">refundStatus,</if>
  2225. <if test="returnGoodsStatus != null">returnGoodsStatus,</if>
  2226. <if test="receiveGoodsTime != null and receiveGoodsTime != ''">receiveGoodsTime,</if>
  2227. <if test="autoReceiveTimeMills != null">autoReceiveTimeMills,</if>
  2228. <if test="totalAddedValueTax != null">totalAddedValueTax,</if>
  2229. <if test="canRefundAmount != null">canRefundAmount,</if>
  2230. <if test="refundAmount != null">refundAmount,</if>
  2231. <if test="clubID != null">clubID,</if>
  2232. <if test="spID != null">spID,</if>
  2233. <if test="mainSpID != null">mainSpID,</if>
  2234. <if test="orderBeanAmount != null">orderBeanAmount,</if>
  2235. <if test="useBeanAmount != null">useBeanAmount,</if>
  2236. <if test="useBeanFlag != null">useBeanFlag,</if>
  2237. <if test="canRefundFlag != null">canRefundFlag,</if>
  2238. <if test="useBalanceFlag != null">useBalanceFlag,</if>
  2239. <if test="canRefundBeans != null">canRefundBeans,</if>
  2240. <if test="freePostageFee != null">freePostageFee,</if>
  2241. <if test="freePostageTicketID != null">freePostageTicketID,</if>
  2242. <if test="brokerage != null">brokerage,</if>
  2243. <if test="delFlag != null and delFlag != ''">delFlag,</if>
  2244. <if test="refundsAmount != null">refundsAmount,</if>
  2245. <if test="orderStatusFlag != null and orderStatusFlag != ''">orderStatusFlag,</if>
  2246. <if test="buyStatus != null and buyStatus != ''">buyStatus,</if>
  2247. <if test="deliveryTimeMills != null and deliveryTimeMills != ''">deliveryTimeMills,</if>
  2248. <if test="orderDeliveryID != null">orderDeliveryID,</if>
  2249. <if test="splitFlag != null and splitFlag != ''">splitFlag,</if>
  2250. <if test="paying != null and paying != ''">paying,</if>
  2251. <if test="shopProductAmount != null">shopProductAmount,</if>
  2252. <if test="shopPostFee != null">shopPostFee,</if>
  2253. <if test="shopPostFlag != null and shopPostFlag != ''">shopPostFlag,</if>
  2254. <if test="shopTaxFee != null">shopTaxFee,</if>
  2255. <if test="payCmAmount != null">payCmAmount,</if>
  2256. <if test="shouldPayShopAmount != null">shouldPayShopAmount,</if>
  2257. <if test="payedShopAmount != null">payedShopAmount,</if>
  2258. <if test="shopOtherFee != null">shopOtherFee,</if>
  2259. <if test="receiptedFlag != null and receiptedFlag != ''">receiptedFlag,</if>
  2260. <if test="receiptedType != null and receiptedType != ''">receiptedType,</if>
  2261. <if test="costType != null and costType != ''">costType,</if>
  2262. <if test="proportional != null">proportional,</if>
  2263. <if test="modifyShouldPayNote != null and modifyShouldPayNote != ''">modifyShouldPayNote,</if>
  2264. <if test="modifyShouldPayUserID != null">modifyShouldPayUserID,</if>
  2265. <if test="modifyShouldPayDate != null">modifyShouldPayDate,</if>
  2266. <if test="zeroCostFlag != null">zeroCostFlag,</if>
  2267. <if test="differenceType != null and differenceType != ''">differenceType,</if>
  2268. <if test="differencePrice != null">differencePrice,</if>
  2269. <if test="svipShopReduction != null">svipShopReduction,</if>
  2270. <if test="splitCode != null and splitCode != ''">splitCode,</if>
  2271. <if test="paySuccessCounter != null">paySuccessCounter,</if>
  2272. <if test="onlinePayWays != null and onlinePayWays != ''">onlinePayWays,</if>
  2273. <if test="status != null and status != ''">shopStatus,</if>
  2274. </trim>
  2275. <trim prefix="values (" suffix=")" suffixOverrides=",">
  2276. <if test="shopOrderID != null and shopOrderID != ''">#{shopOrderID},</if>
  2277. <if test="shopOrderNo != null and shopOrderNo != ''">#{shopOrderNo},</if>
  2278. <if test="orderNo != null and orderNo != ''">#{orderNo},</if>
  2279. <if test="orderID != null">#{orderID},</if>
  2280. <if test="organizeID != null">#{organizeID},</if>
  2281. <if test="isColdChina != null">#{isColdChina},</if>
  2282. <if test="userID != null">#{userID},</if>
  2283. <if test="shopID != null">#{shopID},</if>
  2284. <if test="orderPromotionsId != null">#{orderPromotionsId},</if>
  2285. <if test="orderType != null">#{orderType},</if>
  2286. <if test="orderSubmitType != null">#{orderSubmitType},</if>
  2287. <if test="presentNum != null">#{presentNum},</if>
  2288. <if test="itemCount != null">#{itemCount},</if>
  2289. <if test="outStoreNum != null">#{outStoreNum},</if>
  2290. <if test="outStoreTimes != null">#{outStoreTimes},</if>
  2291. <if test="townID != null">#{townID},</if>
  2292. <if test="note != null and note != ''">#{note},</if>
  2293. <if test="eachDiscount != null">#{eachDiscount},</if>
  2294. <if test="realPay != null">#{realPay},</if>
  2295. <if test="receiptAmount != null">#{receiptAmount},</if>
  2296. <if test="accountAmount != null">#{accountAmount},</if>
  2297. <if test="productAmount != null">#{productAmount},</if>
  2298. <if test="totalAmount != null">#{totalAmount},</if>
  2299. <if test="needPayAmount != null">#{needPayAmount},</if>
  2300. <if test="discountAmount != null">#{discountAmount},</if>
  2301. <if test="preferential != null">#{preferential},</if>
  2302. <if test="promotionFullReduction != null">#{promotionFullReduction},</if>
  2303. <if test="payFlag != null and payFlag != ''">#{payFlag},</if>
  2304. <if test="orderTime != null and orderTime != ''">#{orderTime},</if>
  2305. <if test="payTime != null and payTime != ''">#{payTime},</if>
  2306. <if test="finishTime != null and finishTime != ''">#{finishTime},</if>
  2307. <if test="autoOverTimeMills != null">#{autoOverTimeMills},</if>
  2308. <if test="settleStatus != null and settleStatus != ''">#{settleStatus},</if>
  2309. <if test="payStatus != null and payStatus != ''">#{payStatus},</if>
  2310. <if test="receiptStatus != null and receiptStatus != ''">#{receiptStatus},</if>
  2311. <if test="sendOutStatus != null and sendOutStatus != ''">#{sendOutStatus},</if>
  2312. <if test="refundStatus != null">#{refundStatus},</if>
  2313. <if test="returnGoodsStatus != null">#{returnGoodsStatus},</if>
  2314. <if test="receiveGoodsTime != null and receiveGoodsTime != ''">#{receiveGoodsTime},</if>
  2315. <if test="autoReceiveTimeMills != null">#{autoReceiveTimeMills},</if>
  2316. <if test="totalAddedValueTax != null">#{totalAddedValueTax},</if>
  2317. <if test="canRefundAmount != null">#{canRefundAmount},</if>
  2318. <if test="refundAmount != null">#{refundAmount},</if>
  2319. <if test="clubID != null">#{clubID},</if>
  2320. <if test="spID != null">#{spID},</if>
  2321. <if test="mainSpID != null">#{mainSpID},</if>
  2322. <if test="orderBeanAmount != null">#{orderBeanAmount},</if>
  2323. <if test="useBeanAmount != null">#{useBeanAmount},</if>
  2324. <if test="useBeanFlag != null">#{useBeanFlag},</if>
  2325. <if test="canRefundFlag != null">#{canRefundFlag},</if>
  2326. <if test="useBalanceFlag != null">#{useBalanceFlag},</if>
  2327. <if test="canRefundBeans != null">#{canRefundBeans},</if>
  2328. <if test="freePostageFee != null">#{freePostageFee},</if>
  2329. <if test="freePostageTicketID != null">#{freePostageTicketID},</if>
  2330. <if test="brokerage != null">#{brokerage},</if>
  2331. <if test="delFlag != null and delFlag != ''">#{delFlag},</if>
  2332. <if test="refundsAmount != null">#{refundsAmount},</if>
  2333. <if test="orderStatusFlag != null and orderStatusFlag != ''">#{orderStatusFlag},</if>
  2334. <if test="buyStatus != null and buyStatus != ''">#{buyStatus},</if>
  2335. <if test="deliveryTimeMills != null and deliveryTimeMills != ''">#{deliveryTimeMills},</if>
  2336. <if test="orderDeliveryID != null">#{orderDeliveryID},</if>
  2337. <if test="splitFlag != null and splitFlag != ''">#{splitFlag},</if>
  2338. <if test="paying != null and paying != ''">#{paying},</if>
  2339. <if test="shopProductAmount != null">#{shopProductAmount},</if>
  2340. <if test="shopPostFee != null">#{shopPostFee},</if>
  2341. <if test="shopPostFlag != null and shopPostFlag != ''">#{shopPostFlag},</if>
  2342. <if test="shopTaxFee != null">#{shopTaxFee},</if>
  2343. <if test="payCmAmount != null">#{payCmAmount},</if>
  2344. <if test="shouldPayShopAmount != null">#{shouldPayShopAmount},</if>
  2345. <if test="payedShopAmount != null">#{payedShopAmount},</if>
  2346. <if test="shopOtherFee != null">#{shopOtherFee},</if>
  2347. <if test="receiptedFlag != null and receiptedFlag != ''">#{receiptedFlag},</if>
  2348. <if test="receiptedType != null and receiptedType != ''">#{receiptedType},</if>
  2349. <if test="costType != null and costType != ''">#{costType},</if>
  2350. <if test="proportional != null">#{proportional},</if>
  2351. <if test="modifyShouldPayNote != null and modifyShouldPayNote != ''">#{modifyShouldPayNote},</if>
  2352. <if test="modifyShouldPayUserID != null">#{modifyShouldPayUserID},</if>
  2353. <if test="modifyShouldPayDate != null">#{modifyShouldPayDate},</if>
  2354. <if test="zeroCostFlag != null">#{zeroCostFlag},</if>
  2355. <if test="differenceType != null and differenceType != ''">#{differenceType},</if>
  2356. <if test="differencePrice != null">#{differencePrice},</if>
  2357. <if test="svipShopReduction != null">#{svipShopReduction},</if>
  2358. <if test="splitCode != null and splitCode != ''">#{splitCode},</if>
  2359. <if test="paySuccessCounter != null">#{paySuccessCounter},</if>
  2360. <if test="onlinePayWays != null and onlinePayWays != ''">#{onlinePayWays},</if>
  2361. <if test="status != null and status != ''">#{status},</if>
  2362. </trim>
  2363. </insert>
  2364. <update id="updateCmShopOrder" parameterType="com.caimei.modules.order.entity.NewShopOrder">
  2365. update cm_shop_order
  2366. <trim prefix="SET" suffixOverrides=",">
  2367. <if test="shopOrderNo != null and shopOrderNo != ''">shopOrderNo = #{shopOrderNo},</if>
  2368. <if test="orderNo != null and orderNo != ''">orderNo = #{orderNo},</if>
  2369. <if test="orderID != null">orderID = #{orderID},</if>
  2370. <if test="organizeID != null">organizeID = #{organizeID},</if>
  2371. <if test="isColdChina != null">isColdChina = #{isColdChina},</if>
  2372. <if test="userID != null">userID = #{userID},</if>
  2373. <if test="shopID != null">shopID = #{shopID},</if>
  2374. <if test="orderPromotionsId != null">orderPromotionsId = #{orderPromotionsId},</if>
  2375. <if test="orderType != null">orderType = #{orderType},</if>
  2376. <if test="orderSubmitType != null">orderSubmitType = #{orderSubmitType},</if>
  2377. <if test="presentNum != null">presentNum = #{presentNum},</if>
  2378. <if test="itemCount != null">itemCount = #{itemCount},</if>
  2379. <if test="outStoreNum != null">outStoreNum = #{outStoreNum},</if>
  2380. <if test="outStoreTimes != null">outStoreTimes = #{outStoreTimes},</if>
  2381. <if test="townID != null">townID = #{townID},</if>
  2382. <if test="note != null and note != ''">note = #{note},</if>
  2383. <if test="eachDiscount != null">eachDiscount = #{eachDiscount},</if>
  2384. <if test="realPay != null">realPay = #{realPay},</if>
  2385. <if test="receiptAmount != null">receiptAmount = #{receiptAmount},</if>
  2386. <if test="accountAmount != null">accountAmount = #{accountAmount},</if>
  2387. <if test="productAmount != null">productAmount = #{productAmount},</if>
  2388. <if test="totalAmount != null">totalAmount = #{totalAmount},</if>
  2389. <if test="needPayAmount != null">needPayAmount = #{needPayAmount},</if>
  2390. <if test="discountAmount != null">discountAmount = #{discountAmount},</if>
  2391. <if test="preferential != null">preferential = #{preferential},</if>
  2392. <if test="promotionFullReduction != null">promotionFullReduction = #{promotionFullReduction},</if>
  2393. <if test="payFlag != null and payFlag != ''">payFlag = #{payFlag},</if>
  2394. <if test="orderTime != null and orderTime != ''">orderTime = #{orderTime},</if>
  2395. <if test="payTime != null and payTime != ''">payTime = #{payTime},</if>
  2396. <if test="finishTime != null and finishTime != ''">finishTime = #{finishTime},</if>
  2397. <if test="autoOverTimeMills != null">autoOverTimeMills = #{autoOverTimeMills},</if>
  2398. <if test="settleStatus != null and settleStatus != ''">settleStatus = #{settleStatus},</if>
  2399. <if test="payStatus != null and payStatus != ''">payStatus = #{payStatus},</if>
  2400. <if test="receiptStatus != null and receiptStatus != ''">receiptStatus = #{receiptStatus},</if>
  2401. <if test="sendOutStatus != null and sendOutStatus != ''">sendOutStatus = #{sendOutStatus},</if>
  2402. <if test="refundStatus != null">refundStatus = #{refundStatus},</if>
  2403. <if test="returnGoodsStatus != null">returnGoodsStatus = #{returnGoodsStatus},</if>
  2404. <if test="receiveGoodsTime != null and receiveGoodsTime != ''">receiveGoodsTime = #{receiveGoodsTime},</if>
  2405. <if test="autoReceiveTimeMills != null">autoReceiveTimeMills = #{autoReceiveTimeMills},</if>
  2406. <if test="totalAddedValueTax != null">totalAddedValueTax = #{totalAddedValueTax},</if>
  2407. <if test="canRefundAmount != null">canRefundAmount = #{canRefundAmount},</if>
  2408. <if test="refundAmount != null">refundAmount = #{refundAmount},</if>
  2409. <if test="clubID != null">clubID = #{clubID},</if>
  2410. <if test="spID != null">spID = #{spID},</if>
  2411. <if test="mainSpID != null">mainSpID = #{mainSpID},</if>
  2412. <if test="orderBeanAmount != null">orderBeanAmount = #{orderBeanAmount},</if>
  2413. <if test="useBeanAmount != null">useBeanAmount = #{useBeanAmount},</if>
  2414. <if test="useBeanFlag != null">useBeanFlag = #{useBeanFlag},</if>
  2415. <if test="canRefundFlag != null">canRefundFlag = #{canRefundFlag},</if>
  2416. <if test="useBalanceFlag != null">useBalanceFlag = #{useBalanceFlag},</if>
  2417. <if test="canRefundBeans != null">canRefundBeans = #{canRefundBeans},</if>
  2418. <if test="freePostageFee != null">freePostageFee = #{freePostageFee},</if>
  2419. <if test="freePostageTicketID != null">freePostageTicketID = #{freePostageTicketID},</if>
  2420. <if test="brokerage != null">brokerage = #{brokerage},</if>
  2421. <if test="delFlag != null and delFlag != ''">delFlag = #{delFlag},</if>
  2422. <if test="refundsAmount != null">refundsAmount = #{refundsAmount},</if>
  2423. <if test="orderStatusFlag != null and orderStatusFlag != ''">orderStatusFlag = #{orderStatusFlag},</if>
  2424. <if test="buyStatus != null and buyStatus != ''">buyStatus = #{buyStatus},</if>
  2425. <if test="deliveryTimeMills != null and deliveryTimeMills != ''">deliveryTimeMills = #{deliveryTimeMills},
  2426. </if>
  2427. <if test="orderDeliveryID != null">orderDeliveryID = #{orderDeliveryID},</if>
  2428. <if test="splitFlag != null and splitFlag != ''">splitFlag = #{splitFlag},</if>
  2429. <if test="paying != null and paying != ''">paying = #{paying},</if>
  2430. <if test="shopProductAmount != null">shopProductAmount = #{shopProductAmount},</if>
  2431. <if test="shopPostFee != null">shopPostFee = #{shopPostFee},</if>
  2432. <if test="shopPostFlag != null and shopPostFlag != ''">shopPostFlag = #{shopPostFlag},</if>
  2433. <if test="shopTaxFee != null">shopTaxFee = #{shopTaxFee},</if>
  2434. <if test="payCmAmount != null">payCmAmount = #{payCmAmount},</if>
  2435. <if test="shouldPayShopAmount != null">shouldPayShopAmount = #{shouldPayShopAmount},</if>
  2436. <if test="payedShopAmount != null">payedShopAmount = #{payedShopAmount},</if>
  2437. <if test="shopOtherFee != null">shopOtherFee = #{shopOtherFee},</if>
  2438. <if test="receiptedFlag != null and receiptedFlag != ''">receiptedFlag = #{receiptedFlag},</if>
  2439. <if test="receiptedType != null and receiptedType != ''">receiptedType = #{receiptedType},</if>
  2440. <if test="costType != null and costType != ''">costType = #{costType},</if>
  2441. <if test="proportional != null">proportional = #{proportional},</if>
  2442. <if test="modifyShouldPayNote != null and modifyShouldPayNote != ''">modifyShouldPayNote =
  2443. #{modifyShouldPayNote},
  2444. </if>
  2445. <if test="modifyShouldPayUserID != null">modifyShouldPayUserID = #{modifyShouldPayUserID},</if>
  2446. <if test="modifyShouldPayDate != null">modifyShouldPayDate = #{modifyShouldPayDate},</if>
  2447. <if test="zeroCostFlag != null">zeroCostFlag = #{zeroCostFlag},</if>
  2448. <if test="differenceType != null and differenceType != ''">differenceType = #{differenceType},</if>
  2449. <if test="differencePrice != null">differencePrice = #{differencePrice},</if>
  2450. <if test="svipShopReduction != null">svipShopReduction = #{svipShopReduction},</if>
  2451. <if test="splitCode != null and splitCode != ''">splitCode = #{splitCode},</if>
  2452. <if test="paySuccessCounter != null">paySuccessCounter = #{paySuccessCounter},</if>
  2453. <if test="onlinePayWays != null and onlinePayWays != ''">onlinePayWays = #{onlinePayWays},</if>
  2454. <if test="status != null and status != ''">shopStatus = #{status},</if>
  2455. </trim>
  2456. where shopOrderID = #{shopOrderID}
  2457. </update>
  2458. <update id="updateDelCmShopOrderByShopOrderIDs" parameterType="String">
  2459. update cm_shop_order set delFlag=#{delFlag} where shopOrderID in
  2460. <foreach item="shopOrderID" collection="shopOrderIDs" open="(" separator="," close=")">
  2461. #{shopOrderID}
  2462. </foreach>
  2463. </update>
  2464. <delete id="delCmShopOrderByShopOrderID" parameterType="String">
  2465. delete
  2466. from cm_shop_order
  2467. where shopOrderID = #{shopOrderID}
  2468. </delete>
  2469. <delete id="delCmShopOrderByShopOrderIDs" parameterType="String">
  2470. delete from cm_shop_order where shopOrderID in
  2471. <foreach item="shopOrderID" collection="shopOrderIDs" open="(" separator="," close=")">
  2472. #{shopOrderID}
  2473. </foreach>
  2474. </delete>
  2475. </mapper>