ShopOrderMapper.xml 145 KB

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