ShopOrderMapper.xml 136 KB

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