OrderDao.xml 81 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120
  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.kmall.admin.dao.OrderDao">
  4. <!-- 可根据自己的需求,是否要使用 -->
  5. <resultMap type="com.kmall.admin.entity.OrderEntity" id="orderMap">
  6. <result property="id" column="id"/>
  7. <result property="merchOrderSn" column="merch_order_sn"/>
  8. <result property="orderSn" column="order_sn"/>
  9. <result property="userId" column="user_id"/>
  10. <result property="orderStatus" column="order_status"/>
  11. <result property="shippingStatus" column="shipping_status"/>
  12. <result property="payStatus" column="pay_status"/>
  13. <result property="consignee" column="consignee"/>
  14. <result property="country" column="country"/>
  15. <result property="province" column="province"/>
  16. <result property="city" column="city"/>
  17. <result property="district" column="district"/>
  18. <result property="address" column="address"/>
  19. <result property="mobile" column="mobile"/>
  20. <result property="postscript" column="postscript"/>
  21. <result property="shippingId" column="shipping_id"/>
  22. <result property="shippingName" column="shipping_name"/>
  23. <result property="shippingCode" column="shipping_code"/>
  24. <result property="shippingNo" column="shipping_no"/>
  25. <result property="payId" column="pay_id"/>
  26. <result property="payName" column="pay_name"/>
  27. <result property="payMobile" column="pay_mobile"/>
  28. <result property="shippingFee" column="shipping_fee"/>
  29. <result property="actualPrice" column="actual_price"/>
  30. <result property="integral" column="integral"/>
  31. <result property="integralMoney" column="integral_money"/>
  32. <result property="orderPrice" column="order_price"/>
  33. <result property="goodsPrice" column="goods_price"/>
  34. <result property="addTime" column="add_time"/>
  35. <result property="confirmTime" column="confirm_time"/>
  36. <result property="payTime" column="pay_time"/>
  37. <result property="freightPrice" column="freight_price"/>
  38. <result property="couponId" column="coupon_id"/>
  39. <result property="couponPrice" column="coupon_price"/>
  40. <result property="callbackStatus" column="callback_status"/>
  41. <result property="orderType" column="order_type"/>
  42. <result property="storeId" column="store_id"/>
  43. <result property="userName" column="username"/>
  44. <result property="orderType" column="order_type"/>
  45. <result property="activityId" column="activity_id"/>
  46. <result property="deliveryDate" column="delivery_date"/>
  47. <result property="deliveryRemark" column="delivery_remark"/>
  48. <result property="predictTime" column="predict_time"/>
  49. <result property="orderBizType" column="order_biz_type"/>
  50. <result property="isPaymentSend" column="is_payment_send"/>
  51. <result property="isEleOrderSend" column="is_ele_order_send"/>
  52. <result property="isCustomsSend" column="is_customs_send"/>
  53. <result property="payFlag" column="pay_flag"/>
  54. <result column="buyer_pay_check" property="buyerPayCheck"/>
  55. <result property="merchSn" column="merch_sn"/>
  56. <result property="sku" column="sku"/>
  57. <result property="createTime" column="create_time"/>
  58. <result property="modTime" column="mod_time"/>
  59. <result property="isOnfflineOrder" column="is_onffline_order"/>
  60. <result property="orderSnWx" column="order_sn_wx"/>
  61. <result property="isMergePay" column="is_merge_pay"/>
  62. <result property="payTransactionId" column="pay_transaction_id"/>
  63. <result property="storeName" column="store_name"/>
  64. <result property="moderSn" column="moder_sn"/>
  65. <result property="unitCode" column="unit_code"/>
  66. <result property="ciqProdModel" column="ciq_prod_model"/>
  67. <result property="oriCntCode" column="ori_cnt_code"/>
  68. <result property="brand" column="brand"/>
  69. <result column="gross_weight" property="grossWeight" />
  70. <result column="net_weight" property="netWeight" />
  71. <result property="fullCutPrice" column="full_cut_price"/>
  72. <result property="campMinusId" column="camp_minus_id"/>
  73. <result property="campName" column="camp_name"/>
  74. <result property="pickUpCodeSn" column="pick_up_code_sn"/>
  75. <result property="pickUpCodeStatus" column="pick_up_code_status"/>
  76. <result property="pickUpCodeSn" column="pick_up_code_sn"/>
  77. </resultMap>
  78. <select id="queryObject" resultType="com.kmall.admin.entity.OrderEntity">
  79. select o.*,u.username as username
  80. from mall_order o
  81. left join mall_user u on o.user_id = u.id
  82. where o.id = #{value}
  83. </select>
  84. <select id="queryObjectBySysUser" resultType="com.kmall.admin.entity.OrderEntity">
  85. select o.*,u.username as username
  86. from mall_order o
  87. left join sys_user u on o.user_id = u.user_id
  88. where o.id = #{value}
  89. </select>
  90. <select id="queryObjectByActivityId" resultType="com.kmall.admin.entity.OrderEntity">
  91. select o.*,u.username as username
  92. from mall_order o
  93. left join mall_user u on o.user_id = u.id
  94. where o.activity_id = #{activityId}
  95. </select>
  96. <select id="getTotalActualPrice" resultType="java.lang.Double">
  97. select sum(a.actual_price) 'totalActualPrice' from mall_order a where merch_order_sn = #{merchOrderSn}
  98. </select>
  99. <select id="queryObjectByMerchOrderSn" resultType="com.kmall.admin.entity.OrderEntity">
  100. select * from mall_order a where merch_order_sn = #{merchOrderSn}
  101. </select>
  102. <select id="queryObjectByOrderSn" resultType="com.kmall.admin.entity.OrderEntity">
  103. select o.*,c.pick_up_code_sn
  104. from mall_order o
  105. left join mall_pick_up_code c
  106. on c.order_sn = o.order_sn where o.order_sn = #{orderSn}
  107. </select>
  108. <select id="queryList" resultType="com.kmall.admin.entity.OrderEntity">
  109. SELECT DISTINCT
  110. o.order_sn,
  111. o.merch_order_sn,
  112. o.order_status,
  113. o.actual_price,
  114. o.order_biz_type,
  115. o.shipping_no,
  116. o.shipping_name,
  117. o.shipping_code,
  118. o.consignee,
  119. o.mobile,
  120. o.province,
  121. o.city,
  122. o.district,
  123. o.address,
  124. o.add_time,
  125. o.pay_id,
  126. o.pay_status,
  127. o.shipping_status,
  128. o.is_merge_pay,
  129. o.buyer_pay_check,
  130. o.order_price,
  131. o.moder_sn,
  132. o.id,
  133. u.username AS username,
  134. p.is_payment_send,
  135. p.is_ele_order_send,
  136. p.is_customs_send,
  137. s.store_name,
  138. o.full_cut_price,
  139. o.camp_minus_id,
  140. o.camp_name
  141. FROM
  142. mall_order o
  143. LEFT JOIN mall_user u ON o.user_id = u.id
  144. LEFT JOIN mall_order_process_record p ON o.order_sn = p.order_sn
  145. left join mall_store s on o.store_id = s.id
  146. LEFT JOIN third_merchant_biz t ON t.third_party_merch_code = s.third_party_merch_code
  147. LEFT JOIN mall_order_goods g ON o.id = g.order_id
  148. LEFT JOIN mall_product_store_rela r ON o.store_id = r.store_id
  149. AND r.goods_id = g.goods_id
  150. LEFT JOIN mall_goods gs ON g.goods_id = gs.id
  151. WHERE 1=1
  152. <if test="startTime != null and startTime != ''">
  153. AND o.add_time <![CDATA[ > ]]> #{startTime}
  154. </if>
  155. <if test="endTime != null and endTime != ''">
  156. AND o.add_time <![CDATA[ < ]]> #{endTime}
  157. </if>
  158. <if test="storeId != null and storeId != ''">
  159. AND o.store_id = #{storeId}
  160. </if>
  161. <if test="sku != null and sku.trim() != ''">
  162. AND gs.sku = #{sku}
  163. </if>
  164. <if test="prodBarcode != null and prodBarcode.trim() != ''">
  165. AND gs.prod_barcode = #{prodBarcode}
  166. </if>
  167. <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
  168. AND s.third_party_merch_code = #{thirdPartyMerchCode}
  169. </if>
  170. <if test="thirdMerchSn != null and thirdMerchSn != ''">
  171. AND t.third_merch_sn = #{thirdMerchSn}
  172. </if>
  173. <if test="supplierThirdId != null and supplierThirdId != ''">
  174. AND r.supplier_third_id = #{supplierThirdId}
  175. </if>
  176. <if test="orderBizType != null and orderBizType != ''">
  177. AND o.order_biz_type = #{orderBizType}
  178. </if>
  179. <if test="merchOrderSn != null and merchOrderSn.trim() != ''">
  180. AND o.merch_order_sn = #{merchOrderSn}
  181. </if>
  182. <if test="merchSn != null and merchSn.trim() != ''">
  183. AND o.merch_sn = #{merchSn}
  184. </if>
  185. <if test="orderSn != null and orderSn.trim() != ''">
  186. AND o.order_sn LIKE concat('%',#{orderSn},'%')
  187. </if>
  188. <if test="shippingStatus != null and shippingStatus.trim() != ''">
  189. AND o.shipping_status = #{shippingStatus}
  190. </if>
  191. <if test="payStatus != null and payStatus.trim() != ''">
  192. AND o.pay_status = #{payStatus}
  193. </if>
  194. <if test="orderStatus != null and orderStatus.trim() != ''">
  195. AND o.order_status = #{orderStatus}
  196. </if>
  197. <if test="shippingId != null and shippingId != 0">
  198. AND o.shipping_id = #{shippingId}
  199. </if>
  200. <if test="orderType != null and orderType.trim() != ''">
  201. AND o.order_type = #{orderType}
  202. </if>
  203. <if test="isOnfiilineOrder != null">
  204. AND o.is_onffline_order = #{isOnfiilineOrder}
  205. </if>
  206. <if test="ids != null and ids.trim() != ''">
  207. AND o.id in (${ids})
  208. </if>
  209. <choose>
  210. <when test="sidx != null and sidx.trim() != ''">
  211. order by ${sidx} ${order}
  212. </when>
  213. <otherwise>
  214. order by o.id desc
  215. </otherwise>
  216. </choose>
  217. <if test="offset != null and limit != null">
  218. limit #{offset}, #{limit}
  219. </if>
  220. </select>
  221. <select id="queryExportList" resultType="com.kmall.admin.entity.OrderEntity">
  222. SELECT
  223. o.order_sn,
  224. o.merch_order_sn,
  225. o.order_status,
  226. o.actual_price,
  227. o.order_biz_type,
  228. o.shipping_no,
  229. o.shipping_name,
  230. o.shipping_code,
  231. o.consignee,
  232. o.mobile,
  233. o.province,
  234. o.city,
  235. o.district,
  236. o.address,
  237. o.add_time,
  238. o.pay_id,
  239. o.shipping_status,
  240. o.shipping_fee,
  241. o.moder_sn,
  242. o.pay_transaction_id,
  243. u.id_no 'idNo',
  244. u.username AS username,
  245. p.is_payment_send,
  246. p.is_ele_order_send,
  247. p.is_customs_send,
  248. g.sku,
  249. g.goods_name,
  250. g.number,
  251. g.retail_price,
  252. s.store_name,
  253. nc.NAME ori_cnt_code,
  254. good.ciq_prod_model,
  255. good.brand,
  256. uc.NAME unit_code,
  257. good.gross_weight * g.number gross_weight,
  258. good.net_weight * g.number net_weight,
  259. t2.third_party_merch_name 'supplierThirdPartyMerchName',
  260. t2.third_party_merch_code 'supplierThirdPartyMerchCode'
  261. FROM
  262. mall_order o
  263. LEFT JOIN mall_user u ON o.user_id = u.id
  264. LEFT JOIN mall_order_process_record p ON o.order_sn = p.order_sn
  265. LEFT JOIN mall_order_goods g ON o.id = g.order_id
  266. LEFT JOIN mall_store s ON o.store_id = s.id
  267. LEFT JOIN mall_goods good ON good.id = g.goods_id
  268. LEFT JOIN sys_cus_nation_code nc ON nc.CODE = good.ori_cnt_code
  269. LEFT JOIN sys_cus_unit_code uc ON uc.CODE = good.unit_code
  270. LEFT JOIN third_merchant_biz t ON t.third_party_merch_code = s.third_party_merch_code
  271. LEFT JOIN mall_product_store_rela r ON o.store_id = r.store_id
  272. AND r.goods_id = g.goods_id
  273. LEFT JOIN third_merchant_biz t2 ON t2.third_merch_sn = r.supplier_third_id
  274. WHERE
  275. 1 =1
  276. <if test="storeId != null and storeId != ''">
  277. AND o.store_id = #{storeId}
  278. </if>
  279. <if test="orderStatus != null and orderStatus.trim() != ''">
  280. AND o.order_status = #{orderStatus}
  281. </if>
  282. <if test="sku != null and sku.trim() != ''">
  283. AND g.sku = #{sku}
  284. </if>
  285. <if test="startTime != null and startTime != ''">
  286. AND o.add_time <![CDATA[ > ]]> #{startTime}
  287. </if>
  288. <if test="endTime != null and endTime != ''">
  289. AND o.add_time <![CDATA[ < ]]> #{endTime}
  290. </if>
  291. <if test="storeId != null and storeId != ''">
  292. AND o.store_id = #{storeId}
  293. </if>
  294. <if test="orderBizType != null and orderBizType != ''">
  295. AND o.order_biz_type = #{orderBizType}
  296. </if>
  297. <if test="merchOrderSn != null and merchOrderSn.trim() != ''">
  298. AND o.merch_order_sn = #{merchOrderSn}
  299. </if>
  300. <if test="thirdMerchSn != null and thirdMerchSn != ''">
  301. AND t.third_merch_sn = #{thirdMerchSn}
  302. </if>
  303. <if test="supplierThirdId != null and supplierThirdId != ''">
  304. AND r.supplier_third_id = #{supplierThirdId}
  305. </if>
  306. <if test="orderSn != null and orderSn.trim() != ''">
  307. AND o.order_sn LIKE concat('%',#{orderSn},'%')
  308. </if>
  309. <if test="payStatus != null and payStatus.trim() != ''">
  310. AND o.pay_status = #{payStatus}
  311. </if>
  312. <if test="isOnfiilineOrder != null">
  313. AND o.is_onffline_order = #{isOnfiilineOrder}
  314. </if>
  315. </select>
  316. <select id="queryTotal" resultType="int">
  317. select count(DISTINCT o.id) FROM
  318. mall_order o
  319. LEFT JOIN mall_user u ON o.user_id = u.id
  320. LEFT JOIN mall_order_process_record p ON o.order_sn = p.order_sn
  321. left join mall_store s on o.store_id = s.id
  322. LEFT JOIN third_merchant_biz t ON t.third_party_merch_code = s.third_party_merch_code
  323. LEFT JOIN mall_order_goods g ON o.id = g.order_id
  324. LEFT JOIN mall_product_store_rela r ON o.store_id = r.store_id
  325. AND r.goods_id = g.goods_id
  326. LEFT JOIN mall_goods gs ON g.goods_id = gs.id
  327. WHERE 1=1
  328. <if test="startTime != null and startTime != ''">
  329. AND o.add_time <![CDATA[ > ]]> #{startTime}
  330. </if>
  331. <if test="endTime != null and endTime != ''">
  332. AND o.add_time <![CDATA[ < ]]> #{endTime}
  333. </if>
  334. <if test="storeId != null and storeId != ''">
  335. AND o.store_id = #{storeId}
  336. </if>
  337. <if test="sku != null and sku.trim() != ''">
  338. AND gs.sku = #{sku}
  339. </if>
  340. <if test="prodBarcode != null and prodBarcode.trim() != ''">
  341. AND gs.prod_barcode = #{prodBarcode}
  342. </if>
  343. <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
  344. AND s.third_party_merch_code = #{thirdPartyMerchCode}
  345. </if>
  346. <if test="thirdMerchSn != null and thirdMerchSn != ''">
  347. AND t.third_merch_sn = #{thirdMerchSn}
  348. </if>
  349. <if test="supplierThirdId != null and supplierThirdId != ''">
  350. AND r.supplier_third_id = #{supplierThirdId}
  351. </if>
  352. <if test="orderBizType != null and orderBizType != ''">
  353. AND o.order_biz_type = #{orderBizType}
  354. </if>
  355. <if test="merchOrderSn != null and merchOrderSn.trim() != ''">
  356. AND o.merch_order_sn = #{merchOrderSn}
  357. </if>
  358. <if test="merchSn != null and merchSn.trim() != ''">
  359. AND o.merch_sn = #{merchSn}
  360. </if>
  361. <if test="orderSn != null and orderSn.trim() != ''">
  362. AND o.order_sn LIKE concat('%',#{orderSn},'%')
  363. </if>
  364. <if test="shippingStatus != null and shippingStatus.trim() != ''">
  365. AND o.shipping_status = #{shippingStatus}
  366. </if>
  367. <if test="payStatus != null and payStatus.trim() != ''">
  368. AND o.pay_status = #{payStatus}
  369. </if>
  370. <if test="orderStatus != null and orderStatus.trim() != ''">
  371. AND o.order_status = #{orderStatus}
  372. </if>
  373. <if test="shippingId != null and shippingId != 0">
  374. AND o.shipping_id = #{shippingId}
  375. </if>
  376. <if test="orderType != null and orderType.trim() != ''">
  377. AND o.order_type = #{orderType}
  378. </if>
  379. <if test="isOnfiilineOrder != null">
  380. AND o.is_onffline_order = #{isOnfiilineOrder}
  381. </if>
  382. <if test="ids != null and ids.trim() != ''">
  383. AND o.id in (${ids})
  384. </if>
  385. </select>
  386. <select id="queryOffilineOrderList" resultType="com.kmall.admin.entity.OrderEntity">
  387. SELECT distinct
  388. o.id,
  389. o.order_sn,
  390. u.username as userName,
  391. c.pick_up_code_sn,
  392. o.pay_name,
  393. o.mobile,
  394. o.is_onffline_order,
  395. o.order_biz_type,
  396. o.order_status,
  397. o.pay_status,
  398. o.coupon_name,
  399. o.coupon_price,
  400. o.actual_price,
  401. o.order_price,
  402. o.pay_time,
  403. o.pay_flag
  404. from mall_order o
  405. LEFT JOIN mall_order_goods g ON o.id = g.order_id
  406. LEFT JOIN mall_sale_record record ON record.order_sn = o.order_sn
  407. LEFT JOIN sys_user u ON record.saller_id = u.user_id
  408. LEFT JOIN mall_pick_up_code c ON o.order_sn = c.order_sn
  409. WHERE 1=1
  410. <if test="storeId != null and storeId != ''">
  411. AND o.store_id = #{storeId}
  412. </if>
  413. <if test="merchSn != null and merchSn.trim() != ''">
  414. AND o.merch_sn = #{merchSn}
  415. </if>
  416. <if test="goodsSn != null and goodsSn.trim() != ''">
  417. AND gs.goods_sn = #{goodsSn}
  418. </if>
  419. <if test="sku != null and sku.trim() != ''">
  420. AND gs.sku = #{sku}
  421. </if>
  422. <if test="prodBarcode != null and prodBarcode.trim() != ''">
  423. AND gs.prod_barcode = #{prodBarcode}
  424. </if>
  425. <if test="startTime != null and startTime != ''">
  426. AND o.add_time <![CDATA[ > ]]> #{startTime}
  427. </if>
  428. <if test="endTime != null and endTime != ''">
  429. AND o.add_time <![CDATA[ < ]]> #{endTime}
  430. </if>
  431. <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
  432. AND s.third_party_merch_code = #{thirdPartyMerchCode}
  433. </if>
  434. <if test="orderSn != null and orderSn.trim() != ''">
  435. AND o.order_sn LIKE concat('%',#{orderSn},'%')
  436. </if>
  437. <if test="shippingStatus != null and shippingStatus.trim() != ''">
  438. AND o.shipping_status = #{shippingStatus}
  439. </if>
  440. <if test="payStatus != null and payStatus.trim() != ''">
  441. AND o.pay_status = #{payStatus}
  442. </if>
  443. <if test="orderStatus != null and orderStatus.trim() != ''">
  444. AND o.order_status = #{orderStatus}
  445. </if>
  446. <if test="shippingId != null and shippingId != 0">
  447. AND o.shipping_id = #{shippingId}
  448. </if>
  449. <if test="orderType != null and orderType.trim() != ''">
  450. AND o.order_type = #{orderType}
  451. </if>
  452. <if test="isOnfiilineOrder != null">
  453. AND o.is_onffline_order = #{isOnfiilineOrder}
  454. </if>
  455. <if test="ids != null and ids.trim() != ''">
  456. AND o.id in (${ids})
  457. </if>
  458. <choose>
  459. <when test="sidx != null and sidx.trim() != ''">
  460. order by ${sidx} ${order}
  461. </when>
  462. <otherwise>
  463. order by id desc
  464. </otherwise>
  465. </choose>
  466. <if test="offset != null and limit != null">
  467. limit #{offset}, #{limit}
  468. </if>
  469. </select>
  470. <select id="queryOffilineOrderTotal" resultType="int">
  471. select count(DISTINCT o.id) FROM
  472. mall_order o
  473. LEFT JOIN mall_order_goods g ON o.id = g.order_id
  474. LEFT JOIN mall_sale_record record ON record.order_sn = o.order_sn
  475. LEFT JOIN sys_user u ON record.saller_id = u.user_id
  476. LEFT JOIN mall_pick_up_code c ON o.order_sn = c.order_sn
  477. WHERE 1=1
  478. <if test="storeId != null and storeId != ''">
  479. AND o.store_id = #{storeId}
  480. </if>
  481. <if test="merchSn != null and merchSn.trim() != ''">
  482. AND o.merch_sn = #{merchSn}
  483. </if>
  484. <if test="goodsSn != null and goodsSn.trim() != ''">
  485. AND gs.goods_sn = #{goodsSn}
  486. </if>
  487. <if test="sku != null and sku.trim() != ''">
  488. AND gs.sku = #{sku}
  489. </if>
  490. <if test="prodBarcode != null and prodBarcode.trim() != ''">
  491. AND gs.prod_barcode = #{prodBarcode}
  492. </if>
  493. <if test="startTime != null and startTime != ''">
  494. AND o.add_time <![CDATA[ > ]]> #{startTime}
  495. </if>
  496. <if test="endTime != null and endTime != ''">
  497. AND o.add_time <![CDATA[ < ]]> #{endTime}
  498. </if>
  499. <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
  500. AND s.third_party_merch_code = #{thirdPartyMerchCode}
  501. </if>
  502. <if test="orderSn != null and orderSn.trim() != ''">
  503. AND o.order_sn LIKE concat('%',#{orderSn},'%')
  504. </if>
  505. <if test="shippingStatus != null and shippingStatus.trim() != ''">
  506. AND o.shipping_status = #{shippingStatus}
  507. </if>
  508. <if test="payStatus != null and payStatus.trim() != ''">
  509. AND o.pay_status = #{payStatus}
  510. </if>
  511. <if test="orderStatus != null and orderStatus.trim() != ''">
  512. AND o.order_status = #{orderStatus}
  513. </if>
  514. <if test="shippingId != null and shippingId != 0">
  515. AND o.shipping_id = #{shippingId}
  516. </if>
  517. <if test="orderType != null and orderType.trim() != ''">
  518. AND o.order_type = #{orderType}
  519. </if>
  520. <if test="isOnfiilineOrder != null">
  521. AND o.is_onffline_order = #{isOnfiilineOrder}
  522. </if>
  523. <if test="ids != null and ids.trim() != ''">
  524. AND o.id in (${ids})
  525. </if>
  526. </select>
  527. <insert id="save" parameterType="com.kmall.api.entity.OrderVo" useGeneratedKeys="true" keyProperty="id">
  528. insert into mall_order
  529. (
  530. `order_sn`,
  531. `user_id`,
  532. `order_status`,
  533. `shipping_status`,
  534. `pay_status`,
  535. `consignee`,
  536. `country`,
  537. `province`,
  538. `city`,
  539. `district`,
  540. `address`,
  541. `mobile`,
  542. `postscript`,
  543. `shipping_id`,
  544. `shipping_name`,
  545. `shipping_code`,
  546. `shipping_no`,
  547. `pay_id`,
  548. `pay_name`,
  549. `shipping_fee`,
  550. `actual_price`,
  551. `integral`,
  552. `integral_money`,
  553. `order_price`,
  554. `goods_price`,
  555. `add_time`,
  556. `confirm_time`,
  557. `pay_time`,
  558. `freight_price`,
  559. `coupon_id`,
  560. `coupon_price`,
  561. full_cut_price,
  562. camp_minus_id,
  563. camp_name,
  564. `callback_status`,
  565. `order_type`,
  566. `store_id`,
  567. `order_biz_type`,
  568. `is_onffline_order`,
  569. `order_sn_wx`,
  570. `pay_flag`,
  571. `merch_sn`,
  572. `create_time`,
  573. `mod_time`
  574. )
  575. values
  576. (
  577. #{orderSn},
  578. #{userId},
  579. #{orderStatus},
  580. #{shippingStatus},
  581. #{payStatus},
  582. #{consignee},
  583. #{country},
  584. #{province},
  585. #{city},
  586. #{district},
  587. #{address},
  588. #{mobile},
  589. #{postscript},
  590. #{shippingId},
  591. #{shippingName},
  592. #{shippingCode},
  593. #{shippingNo},
  594. #{payId},
  595. #{payName},
  596. #{shippingFee},
  597. #{actualPrice},
  598. #{integral},
  599. #{integralMoney},
  600. #{orderPrice},
  601. #{goodsPrice},
  602. #{addTime},
  603. #{confirmTime},
  604. #{payTime},
  605. #{freightPrice},
  606. #{couponId},
  607. #{couponPrice},
  608. #{fullCutPrice},
  609. #{campMinusId},
  610. #{campName},
  611. #{callbackStatus},
  612. #{orderType},
  613. #{storeId},
  614. #{orderBizType},
  615. #{isOnfflineOrder},
  616. #{orderSnWx},
  617. #{payFlag},
  618. #{merchSn},
  619. #{createTime},
  620. #{modTime}
  621. )
  622. </insert>
  623. <insert id="saveOrderVo" parameterType="com.kmall.api.entity.OrderVo" useGeneratedKeys="true" keyProperty="id">
  624. insert into mall_order
  625. (
  626. `order_sn`,
  627. `user_id`,
  628. `order_status`,
  629. `shipping_status`,
  630. `shipping_code`,
  631. `pay_status`,
  632. `consignee`,
  633. `country`,
  634. `province`,
  635. `city`,
  636. `district`,
  637. `address`,
  638. `address_id`,
  639. `mobile`,
  640. `postscript`,
  641. `pay_id`,
  642. `pay_name`,
  643. `shipping_fee`,
  644. `actual_price`,
  645. `cash_fee`,
  646. `cash_fee_type`,
  647. `total_fee`,
  648. `fee_type`,
  649. `rate`,
  650. `integral`,
  651. `integral_money`,
  652. `order_price`,
  653. `goods_price`,
  654. `add_time`,
  655. `confirm_time`,
  656. `pay_time`,
  657. `freight_price`,
  658. `coupon_id`,
  659. `coupon_price`,
  660. `full_cut_price`,
  661. camp_minus_id,
  662. camp_name,
  663. `order_type`,
  664. `activity_id`,
  665. `store_id`,
  666. `delivery_date`,
  667. `delivery_remark`,
  668. `predict_time`,
  669. `coupon_name`,
  670. `comment_count`,
  671. <if test="merchSn != null" >
  672. merch_sn,
  673. </if>
  674. <if test="merchOrderSn != null" >
  675. merch_order_sn,
  676. </if>
  677. <if test="isScan != null" >
  678. is_scan,
  679. </if>
  680. <if test="isMergePay != null" >
  681. is_merge_pay,
  682. </if>
  683. <if test="orderBizType != null" >
  684. order_biz_type,
  685. </if>
  686. <if test="payTransactionId != null" >
  687. pay_transaction_id,
  688. </if>
  689. <if test="payMobile != null" >
  690. pay_mobile,
  691. </if>
  692. <if test="buyerPayCheck != null" >
  693. buyer_pay_check,
  694. </if>
  695. <if test="isOnfflineOrder != null" >
  696. `is_onffline_order`,
  697. </if>
  698. <if test="payFlag != null" >
  699. pay_flag,
  700. </if>
  701. <if test="createrSn != null" >
  702. creater_sn,
  703. </if>
  704. <if test="createTime != null" >
  705. create_time,
  706. </if>
  707. <if test="moderSn != null" >
  708. moder_sn,
  709. </if>
  710. <if test="modTime != null" >
  711. mod_time
  712. </if>
  713. )
  714. values
  715. (
  716. #{order_sn},
  717. #{user_id},
  718. #{order_status},
  719. #{shipping_status},
  720. #{shipping_code},
  721. #{pay_status},
  722. #{consignee},
  723. #{country},
  724. #{province},
  725. #{city},
  726. #{district},
  727. #{address},
  728. #{address_id},
  729. #{mobile},
  730. #{postscript},
  731. #{pay_id},
  732. #{pay_name},
  733. #{shipping_fee},
  734. #{actual_price},
  735. #{cashFee},
  736. #{cashFeeType},
  737. #{totalFee},
  738. #{feeType},
  739. #{rate},
  740. #{integral},
  741. #{integral_money},
  742. #{order_price},
  743. #{goods_price},
  744. now(),
  745. #{confirm_time},
  746. #{pay_time},
  747. #{freight_price},
  748. #{coupon_id},
  749. #{coupon_price},
  750. #{full_cut_price},
  751. #{campMinusId},
  752. #{campName},
  753. #{order_type},
  754. #{activity_id},
  755. #{store_id},
  756. #{delivery_date},
  757. #{delivery_remark},
  758. #{predict_time},
  759. #{coupon_name},
  760. #{comment_count},
  761. <if test="merchSn != null" >
  762. #{merchSn},
  763. </if>
  764. <if test="merchOrderSn != null" >
  765. #{merchOrderSn},
  766. </if>
  767. <if test="isScan != null" >
  768. #{isScan},
  769. </if>
  770. <if test="isMergePay != null" >
  771. #{isMergePay},
  772. </if>
  773. <if test="orderBizType != null" >
  774. #{orderBizType,jdbcType=CHAR},
  775. </if>
  776. <if test="payTransactionId != null" >
  777. #{payTransactionId},
  778. </if>
  779. <if test="payMobile != null" >
  780. #{payMobile},
  781. </if>
  782. <if test="buyerPayCheck != null" >
  783. #{buyerPayCheck},
  784. </if>
  785. <if test="isOnfflineOrder != null" >
  786. #{isOnfflineOrder},
  787. </if>
  788. <if test="payFlag != null" >
  789. #{payFlag},
  790. </if>
  791. <if test="createrSn != null" >
  792. #{createrSn},
  793. </if>
  794. <if test="createTime != null" >
  795. #{createTime},
  796. </if>
  797. <if test="moderSn != null" >
  798. #{moderSn},
  799. </if>
  800. <if test="modTime != null" >
  801. #{modTime}
  802. </if>
  803. )
  804. </insert>
  805. <update id="update" parameterType="com.kmall.admin.entity.OrderEntity">
  806. update mall_order
  807. <set>
  808. <if test="orderSn != null">`order_sn` = #{orderSn},</if>
  809. <if test="userId != null">`user_id` = #{userId},</if>
  810. <if test="orderStatus != null">`order_status` = #{orderStatus},</if>
  811. <if test="shippingStatus != null">`shipping_status` = #{shippingStatus},</if>
  812. <if test="payStatus != null">`pay_status` = #{payStatus},</if>
  813. <if test="consignee != null">`consignee` = #{consignee},</if>
  814. <if test="country != null">`country` = #{country},</if>
  815. <if test="province != null">`province` = #{province},</if>
  816. <if test="city != null">`city` = #{city},</if>
  817. <if test="district != null">`district` = #{district},</if>
  818. <if test="address != null">`address` = #{address},</if>
  819. <if test="mobile != null">`mobile` = #{mobile},</if>
  820. <if test="postscript != null">`postscript` = #{postscript},</if>
  821. <if test="shippingId != null">`shipping_id` = #{shippingId},</if>
  822. <if test="shippingName != null">`shipping_name` = #{shippingName},</if>
  823. <if test="shippingCode != null">`shipping_code` = #{shippingCode},</if>
  824. <if test="shippingNo != null">`shipping_no` = #{shippingNo},</if>
  825. <if test="payId != null">`pay_id` = #{payId},</if>
  826. <if test="payName != null">`pay_name` = #{payName},</if>
  827. <if test="shippingFee != null">`shipping_fee` = #{shippingFee},</if>
  828. <if test="actualPrice != null">`actual_price` = #{actualPrice},</if>
  829. <if test="integral != null">`integral` = #{integral},</if>
  830. <if test="integralMoney != null">`integral_money` = #{integralMoney},</if>
  831. <if test="orderPrice != null">`order_price` = #{orderPrice},</if>
  832. <if test="goodsPrice != null">`goods_price` = #{goodsPrice},</if>
  833. <if test="addTime != null">`add_time` = #{addTime},</if>
  834. <if test="confirmTime != null">`confirm_time` = #{confirmTime},</if>
  835. <if test="payTime != null">`pay_time` = #{payTime},</if>
  836. <if test="freightPrice != null">`freight_price` = #{freightPrice},</if>
  837. <if test="couponId != null">`coupon_id` = #{couponId},</if>
  838. <if test="couponPrice != null">`coupon_price` = #{couponPrice},</if>
  839. <if test="fullCutPrice != null">`full_cut_price` = #{fullCutPrice},</if>
  840. <if test="campMinusId != null">`camp_minus_id` = #{campMinusId},</if>
  841. <if test="campName != null">`camp_name` = #{campName},</if>
  842. <if test="callbackStatus != null">`callback_status` = #{callbackStatus},</if>
  843. <if test="AliTradeNo != null">`ali_trade_no` = #{AliTradeNo},</if>
  844. <if test="orderType != null">`order_type` = #{orderType},</if>
  845. <if test="storeId != null">`store_id` = #{storeId},</if>
  846. <if test="payFlag != null">`pay_flag` = #{payFlag},</if>
  847. <if test="orderSnWx != null">`order_sn_wx` = #{orderSnWx},</if>
  848. <if test="orderBizType != null">`order_biz_type` = #{orderBizType},</if>
  849. <if test="merchSn != null">`merch_sn` = #{merchSn},</if>
  850. <if test="createTime != null">`create_time` = #{createTime},</if>
  851. <if test="modTime != null">`mod_time` = #{modTime},</if>
  852. <if test="createrSn != null">`creater_sn` = #{createrSn},</if>
  853. <if test="moderSn != null">`moder_sn` = #{moderSn},</if>
  854. </set>
  855. where id = #{id}
  856. </update>
  857. <delete id="delete">
  858. delete from mall_order where id = #{value}
  859. </delete>
  860. <delete id="deleteBatch">
  861. delete from mall_order where id in
  862. <foreach item="id" collection="array" open="(" separator="," close=")">
  863. #{id}
  864. </foreach>
  865. </delete>
  866. <update id="riderOrderUpdate" parameterType="com.kmall.admin.entity.OrderEntity">
  867. update mall_order
  868. <set>
  869. `order_status` = #{orderStatus},
  870. `shipping_status` = #{shippingStatus},
  871. `shipping_id` = #{shippingId},
  872. `shipping_name` = #{shippingName},
  873. `shipping_fee` = #{shippingFee},
  874. `shipping_no` = #{shippingNo},
  875. `shipping_mobile` = #{shippingMobile}
  876. </set>
  877. where id = #{id}
  878. </update>
  879. <select id="getYfkOrderUserSum" resultType="int">
  880. select count(1) from (select o.user_id,count(o.user_id) as counts from mall_order o
  881. inner join mall_merch_user mu on o.user_id=mu.user_id and o.merch_sn=mu.merch_sn and o.store_id=mu.store_id
  882. left join mall_store s on o.store_id = s.id
  883. where pay_status = 2
  884. <if test="storeId != null and storeId != ''">
  885. AND o.store_id = #{storeId}
  886. </if>
  887. <if test="merchSn != null and merchSn.trim() != ''">
  888. AND o.merch_sn = #{merchSn}
  889. </if>
  890. <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
  891. AND s.third_party_merch_code = #{thirdPartyMerchCode}
  892. </if>
  893. group by o.user_id) u
  894. </select>
  895. <select id="getOderUserSum" resultType="int">
  896. select count(1) from (select o.user_id,count(o.user_id) as counts from mall_order o
  897. inner join mall_merch_user mu on o.user_id=mu.user_id and o.merch_sn=mu.merch_sn and o.store_id=mu.store_id
  898. left join mall_store s on o.store_id = s.id
  899. where 1=1
  900. <if test="storeId != null and storeId != ''">
  901. AND o.store_id = #{storeId}
  902. </if>
  903. <if test="merchSn != null and merchSn.trim() != ''">
  904. AND o.merch_sn = #{merchSn}
  905. </if>
  906. <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
  907. AND s.third_party_merch_code = #{thirdPartyMerchCode}
  908. </if>
  909. group by o.user_id) u
  910. </select>
  911. <select id="getTodayUserOrder" resultType="int">
  912. select count(1) from mall_order o
  913. left join mall_store s on o.store_id = s.id
  914. where pay_status = 2 and pay_time > date_format(sysdate(), '%Y-%m-%d')
  915. <if test="storeId != null and storeId != ''">
  916. AND o.store_id = #{storeId}
  917. </if>
  918. <if test="merchSn != null and merchSn.trim() != ''">
  919. AND o.merch_sn = #{merchSn}
  920. </if>
  921. <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
  922. AND s.third_party_merch_code = #{thirdPartyMerchCode}
  923. </if>
  924. </select>
  925. <select id="getTodayUserSales" resultType="int">
  926. select ifnull(sum(o.actual_price),0) from mall_order o
  927. left join mall_store s on o.store_id = s.id where o.pay_status = 2 and o.pay_time > date_format(sysdate(), '%Y-%m-%d')
  928. <if test="storeId != null and storeId != ''">
  929. AND o.store_id = #{storeId}
  930. </if>
  931. <if test="merchSn != null and merchSn.trim() != ''">
  932. AND o.merch_sn = #{merchSn}
  933. </if>
  934. <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
  935. AND s.third_party_merch_code = #{thirdPartyMerchCode}
  936. </if>
  937. </select>
  938. <select id="getIncomeSum" resultType="int">
  939. select ifnull(sum(actual_price),0) from mall_order o
  940. left join mall_store s on o.store_id = s.id where o.pay_status = 2
  941. <if test="storeId != null and storeId != ''">
  942. AND o.store_id = #{storeId}
  943. </if>
  944. <if test="merchSn != null and merchSn.trim() != ''">
  945. AND o.merch_sn = #{merchSn}
  946. </if>
  947. <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
  948. AND s.third_party_merch_code = #{thirdPartyMerchCode}
  949. </if>
  950. </select>
  951. <select id="getPayedOrderCount" resultType="int">
  952. select count(1) from mall_order o
  953. left join mall_store s on o.store_id = s.id where o.pay_status = 2 and o.is_onffline_order = 0
  954. <if test="storeId != null and storeId != ''">
  955. AND o.store_id = #{storeId}
  956. </if>
  957. <if test="merchSn != null and merchSn.trim() != ''">
  958. AND o.merch_sn = #{merchSn}
  959. </if>
  960. <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
  961. AND s.third_party_merch_code = #{thirdPartyMerchCode}
  962. </if>
  963. </select>
  964. <select id="promOrderList" resultType="com.kmall.admin.entity.OrderEntity">
  965. SELECT
  966. s.prom_id,
  967. o.id,
  968. o.order_sn,
  969. o.merch_order_sn,
  970. o.actual_price,
  971. o.freight_price,
  972. o.activity_id,
  973. o.order_status,
  974. o.pay_status,
  975. store.store_name storeName,
  976. u.userName userName,
  977. o.buyer_pay_check,
  978. o.order_price,
  979. o.coupon_name couponName,
  980. o.add_time,
  981. o.shipping_status,
  982. (select count(1) from mall_order_goods where order_id = o.id) orderDetailCount,
  983. g.goods_id goodsId
  984. FROM
  985. mk_store_prom_stat s
  986. LEFT JOIN mk_store_prom_order_real r ON s.prom_id = r.prom_id
  987. LEFT JOIN mall_order o ON r.order_id = o.id
  988. LEFT JOIN mall_order_goods g ON o.id = g.order_id
  989. AND g.id = r.order_goods_id
  990. LEFT JOIN mall_store store ON o.store_id = store.id
  991. LEFT JOIN mall_user u ON o.user_id = u.id
  992. WHERE
  993. r.order_id IS NOT NULL
  994. <if test="promId != null and promId != ''">
  995. AND s.prom_id = #{promId}
  996. </if>
  997. <if test="startTime != null and startTime != ''">
  998. AND o.add_time <![CDATA[ > ]]> #{startTime}
  999. </if>
  1000. <if test="endTime != null and endTime != ''">
  1001. AND o.add_time <![CDATA[ < ]]> #{endTime}
  1002. </if>
  1003. <if test="storeId != null and storeId != ''">
  1004. AND o.store_id = #{storeId}
  1005. </if>
  1006. <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
  1007. AND store.third_party_merch_code = #{thirdPartyMerchCode}
  1008. </if>
  1009. <if test="orderBizType != null and orderBizType != ''">
  1010. AND o.order_biz_type = #{orderBizType}
  1011. </if>
  1012. <if test="merchOrderSn != null and merchOrderSn.trim() != ''">
  1013. AND o.merch_order_sn = #{merchOrderSn}
  1014. </if>
  1015. <if test="merchSn != null and merchSn.trim() != ''">
  1016. AND o.merch_sn = #{merchSn}
  1017. </if>
  1018. <if test="orderSn != null and orderSn.trim() != ''">
  1019. AND o.order_sn LIKE concat('%',#{orderSn},'%')
  1020. </if>
  1021. <if test="shippingStatus != null and shippingStatus.trim() != ''">
  1022. AND o.shipping_status = #{shippingStatus}
  1023. </if>
  1024. <if test="payStatus != null and payStatus.trim() != ''">
  1025. AND o.pay_status = #{payStatus}
  1026. </if>
  1027. <if test="orderStatus != null and orderStatus.trim() != ''">
  1028. AND o.order_status = #{orderStatus}
  1029. </if>
  1030. <if test="shippingId != null and shippingId != 0">
  1031. AND o.shipping_id = #{shippingId}
  1032. </if>
  1033. <if test="orderType != null and orderType.trim() != ''">
  1034. AND o.order_type = #{orderType}
  1035. </if>
  1036. <if test="isOnfiilineOrder != null">
  1037. AND o.is_onffline_order = #{isOnfiilineOrder}
  1038. </if>
  1039. <choose>
  1040. <when test="sidx != null and sidx.trim() != ''">
  1041. order by ${sidx} ${order}
  1042. </when>
  1043. <otherwise>
  1044. order by o.id desc
  1045. </otherwise>
  1046. </choose>
  1047. <if test="offset != null and limit != null">
  1048. limit #{offset}, #{limit}
  1049. </if>
  1050. </select>
  1051. <select id="queryPromOrderTotal" resultType="int">
  1052. SELECT
  1053. count(*)
  1054. FROM
  1055. mk_store_prom_stat s
  1056. LEFT JOIN mk_store_prom_order_real r ON s.prom_id = r.prom_id
  1057. LEFT JOIN mall_order o ON r.order_id = o.id
  1058. LEFT JOIN mall_order_goods g ON o.id = g.order_id
  1059. AND g.id = r.order_goods_id
  1060. LEFT JOIN mall_store store ON o.store_id = store.id
  1061. LEFT JOIN mall_user u ON o.user_id = u.id
  1062. WHERE
  1063. r.order_id IS NOT NULL
  1064. <if test="promId != null and promId != ''">
  1065. AND s.prom_id = #{promId}
  1066. </if>
  1067. <if test="startTime != null and startTime != ''">
  1068. AND o.add_time <![CDATA[ > ]]> #{startTime}
  1069. </if>
  1070. <if test="endTime != null and endTime != ''">
  1071. AND o.add_time <![CDATA[ < ]]> #{endTime}
  1072. </if>
  1073. <if test="storeId != null and storeId != ''">
  1074. AND o.store_id = #{storeId}
  1075. </if>
  1076. <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
  1077. AND store.third_party_merch_code = #{thirdPartyMerchCode}
  1078. </if>
  1079. <if test="orderBizType != null and orderBizType != ''">
  1080. AND o.order_biz_type = #{orderBizType}
  1081. </if>
  1082. <if test="merchOrderSn != null and merchOrderSn.trim() != ''">
  1083. AND o.merch_order_sn = #{merchOrderSn}
  1084. </if>
  1085. <if test="merchSn != null and merchSn.trim() != ''">
  1086. AND o.merch_sn = #{merchSn}
  1087. </if>
  1088. <if test="orderSn != null and orderSn.trim() != ''">
  1089. AND o.order_sn LIKE concat('%',#{orderSn},'%')
  1090. </if>
  1091. <if test="shippingStatus != null and shippingStatus.trim() != ''">
  1092. AND o.shipping_status = #{shippingStatus}
  1093. </if>
  1094. <if test="payStatus != null and payStatus.trim() != ''">
  1095. AND o.pay_status = #{payStatus}
  1096. </if>
  1097. <if test="orderStatus != null and orderStatus.trim() != ''">
  1098. AND o.order_status = #{orderStatus}
  1099. </if>
  1100. <if test="shippingId != null and shippingId != 0">
  1101. AND o.shipping_id = #{shippingId}
  1102. </if>
  1103. <if test="orderType != null and orderType.trim() != ''">
  1104. AND o.order_type = #{orderType}
  1105. </if>
  1106. <if test="isOnfiilineOrder != null">
  1107. AND o.is_onffline_order = #{isOnfiilineOrder}
  1108. </if>
  1109. </select>
  1110. <select id="promOrderListExport" resultType="com.kmall.admin.entity.OrderEntity">
  1111. SELECT
  1112. s.prom_id,
  1113. o.id,
  1114. o.order_sn,
  1115. o.merch_order_sn,
  1116. o.actual_price,
  1117. g.goods_name,
  1118. g.number,
  1119. g.retail_price,
  1120. o.freight_price,
  1121. o.activity_id,
  1122. o.order_status,
  1123. o.pay_status,
  1124. store.store_name storeName,
  1125. u.userName userName,
  1126. o.buyer_pay_check,
  1127. o.order_price,
  1128. o.add_time,
  1129. o.shipping_status,
  1130. g.goods_id goodsId
  1131. FROM
  1132. mk_store_prom_stat s
  1133. LEFT JOIN mk_store_prom_order_real r ON s.prom_id = r.prom_id
  1134. LEFT JOIN mall_order o ON r.order_id = o.id
  1135. LEFT JOIN mall_order_goods g ON o.id = g.order_id
  1136. AND g.id = r.order_goods_id
  1137. LEFT JOIN mall_store store ON o.store_id = store.id
  1138. LEFT JOIN mall_user u ON o.user_id = u.id
  1139. WHERE
  1140. r.order_id IS NOT NULL
  1141. <if test="promId != null and promId != ''">
  1142. AND s.prom_id = #{promId}
  1143. </if>
  1144. <if test="startTime != null and startTime != ''">
  1145. AND o.add_time <![CDATA[ > ]]> #{startTime}
  1146. </if>
  1147. <if test="endTime != null and endTime != ''">
  1148. AND o.add_time <![CDATA[ < ]]> #{endTime}
  1149. </if>
  1150. <if test="storeId != null and storeId != ''">
  1151. AND o.store_id = #{storeId}
  1152. </if>
  1153. <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
  1154. AND store.third_party_merch_code = #{thirdPartyMerchCode}
  1155. </if>
  1156. <if test="orderBizType != null and orderBizType != ''">
  1157. AND o.order_biz_type = #{orderBizType}
  1158. </if>
  1159. <if test="merchOrderSn != null and merchOrderSn.trim() != ''">
  1160. AND o.merch_order_sn = #{merchOrderSn}
  1161. </if>
  1162. <if test="merchSn != null and merchSn.trim() != ''">
  1163. AND o.merch_sn = #{merchSn}
  1164. </if>
  1165. <if test="orderSn != null and orderSn.trim() != ''">
  1166. AND o.order_sn LIKE concat('%',#{orderSn},'%')
  1167. </if>
  1168. <if test="shippingStatus != null and shippingStatus.trim() != ''">
  1169. AND o.shipping_status = #{shippingStatus}
  1170. </if>
  1171. <if test="payStatus != null and payStatus.trim() != ''">
  1172. AND o.pay_status = #{payStatus}
  1173. </if>
  1174. <if test="orderStatus != null and orderStatus.trim() != ''">
  1175. AND o.order_status = #{orderStatus}
  1176. </if>
  1177. <if test="shippingId != null and shippingId != 0">
  1178. AND o.shipping_id = #{shippingId}
  1179. </if>
  1180. <if test="orderType != null and orderType.trim() != ''">
  1181. AND o.order_type = #{orderType}
  1182. </if>
  1183. <if test="isOnfiilineOrder != null">
  1184. AND o.is_onffline_order = #{isOnfiilineOrder}
  1185. </if>
  1186. </select>
  1187. <select id="getActualPriceByOutProm" parameterType="map" resultType="java.lang.Double">
  1188. SELECT
  1189. o.actual_price - ( o.actual_price - g.retail_price * g.number ) promActualPrice
  1190. FROM
  1191. mk_store_prom_order_real r
  1192. LEFT JOIN mall_order o ON r.order_id = o.id
  1193. LEFT JOIN mall_order_goods g ON o.id = g.order_id
  1194. AND g.id = r.order_goods_id
  1195. WHERE 1=1
  1196. AND g.goods_id = #{goodsId}
  1197. AND r.order_id = #{orderId}
  1198. <if test="statusList != null">
  1199. AND o.order_status IN
  1200. <foreach item="statusList" collection="statusList" open="(" separator="," close=")">
  1201. #{statusList}
  1202. </foreach>
  1203. </if>
  1204. </select>
  1205. <select id="storeTopicOrderList" resultType="com.kmall.admin.entity.OrderEntity">
  1206. SELECT
  1207. s.title 'storeTopicName',
  1208. pt.prom_type_name 'storeTopicType',
  1209. ss.store_name 'storeName',
  1210. s.id 'storeTopicId',
  1211. o.id,
  1212. o.order_sn,
  1213. o.merch_order_sn,
  1214. o.actual_price,
  1215. o.freight_price,
  1216. o.activity_id,
  1217. o.coupon_id,
  1218. o.coupon_name,
  1219. o.camp_minus_id,
  1220. o.camp_name,
  1221. o.order_status,
  1222. o.pay_status,
  1223. u.userName userName,
  1224. o.order_price,
  1225. o.add_time,
  1226. o.shipping_status
  1227. FROM
  1228. mall_order o
  1229. INNER JOIN mall_store_topic s ON o.activity_id = s.id
  1230. LEFT JOIN mk_store_prom_type pt ON s.prom_type_id = pt.prom_type_id
  1231. LEFT JOIN mall_store ss ON o.store_id = ss.id
  1232. LEFT JOIN mall_user u ON o.user_id = u.id
  1233. WHERE
  1234. 1=1
  1235. <if test="storeTopicId != null and storeTopicId != ''">
  1236. AND s.id = #{storeTopicId}
  1237. </if>
  1238. <if test="startTime != null and startTime != ''">
  1239. AND o.add_time <![CDATA[ > ]]> #{startTime}
  1240. </if>
  1241. <if test="endTime != null and endTime != ''">
  1242. AND o.add_time <![CDATA[ < ]]> #{endTime}
  1243. </if>
  1244. <if test="storeId != null and storeId != ''">
  1245. AND o.store_id = #{storeId}
  1246. </if>
  1247. <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
  1248. AND ss.third_party_merch_code = #{thirdPartyMerchCode}
  1249. </if>
  1250. <if test="orderBizType != null and orderBizType != ''">
  1251. AND o.order_biz_type = #{orderBizType}
  1252. </if>
  1253. <if test="merchOrderSn != null and merchOrderSn.trim() != ''">
  1254. AND o.merch_order_sn = #{merchOrderSn}
  1255. </if>
  1256. <if test="merchSn != null and merchSn.trim() != ''">
  1257. AND o.merch_sn = #{merchSn}
  1258. </if>
  1259. <if test="orderSn != null and orderSn.trim() != ''">
  1260. AND o.order_sn LIKE concat('%',#{orderSn},'%')
  1261. </if>
  1262. <if test="shippingStatus != null and shippingStatus.trim() != ''">
  1263. AND o.shipping_status = #{shippingStatus}
  1264. </if>
  1265. <if test="payStatus != null and payStatus.trim() != ''">
  1266. AND o.pay_status = #{payStatus}
  1267. </if>
  1268. <if test="orderStatus != null and orderStatus.trim() != ''">
  1269. AND o.order_status = #{orderStatus}
  1270. </if>
  1271. <if test="shippingId != null and shippingId != 0">
  1272. AND o.shipping_id = #{shippingId}
  1273. </if>
  1274. <if test="orderType != null and orderType.trim() != ''">
  1275. AND o.order_type = #{orderType}
  1276. </if>
  1277. <if test="isOnfiilineOrder != null">
  1278. AND o.is_onffline_order = #{isOnfiilineOrder}
  1279. </if>
  1280. order by o.id DESC
  1281. <if test="offset != null and limit != null">
  1282. limit #{offset}, #{limit}
  1283. </if>
  1284. </select>
  1285. <select id="queryStoreTopicOrderTotal" resultType="int">
  1286. SELECT
  1287. count(*)
  1288. FROM
  1289. mall_order o
  1290. INNER JOIN mall_store_topic s ON o.activity_id = s.id
  1291. LEFT JOIN mk_store_prom_type pt ON s.prom_type_id = pt.prom_type_id
  1292. LEFT JOIN mall_store ss ON o.store_id = ss.id
  1293. LEFT JOIN mall_user u ON o.user_id = u.id
  1294. WHERE 1=1
  1295. <if test="storeTopicId != null and storeTopicId != ''">
  1296. AND s.id = #{storeTopicId}
  1297. </if>
  1298. <if test="startTime != null and startTime != ''">
  1299. AND o.add_time <![CDATA[ > ]]> #{startTime}
  1300. </if>
  1301. <if test="endTime != null and endTime != ''">
  1302. AND o.add_time <![CDATA[ < ]]> #{endTime}
  1303. </if>
  1304. <if test="storeId != null and storeId != ''">
  1305. AND o.store_id = #{storeId}
  1306. </if>
  1307. <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
  1308. AND ss.third_party_merch_code = #{thirdPartyMerchCode}
  1309. </if>
  1310. <if test="orderBizType != null and orderBizType != ''">
  1311. AND o.order_biz_type = #{orderBizType}
  1312. </if>
  1313. <if test="merchOrderSn != null and merchOrderSn.trim() != ''">
  1314. AND o.merch_order_sn = #{merchOrderSn}
  1315. </if>
  1316. <if test="merchSn != null and merchSn.trim() != ''">
  1317. AND o.merch_sn = #{merchSn}
  1318. </if>
  1319. <if test="orderSn != null and orderSn.trim() != ''">
  1320. AND o.order_sn LIKE concat('%',#{orderSn},'%')
  1321. </if>
  1322. <if test="shippingStatus != null and shippingStatus.trim() != ''">
  1323. AND o.shipping_status = #{shippingStatus}
  1324. </if>
  1325. <if test="payStatus != null and payStatus.trim() != ''">
  1326. AND o.pay_status = #{payStatus}
  1327. </if>
  1328. <if test="orderStatus != null and orderStatus.trim() != ''">
  1329. AND o.order_status = #{orderStatus}
  1330. </if>
  1331. <if test="shippingId != null and shippingId != 0">
  1332. AND o.shipping_id = #{shippingId}
  1333. </if>
  1334. <if test="orderType != null and orderType.trim() != ''">
  1335. AND o.order_type = #{orderType}
  1336. </if>
  1337. <if test="isOnfiilineOrder != null">
  1338. AND o.is_onffline_order = #{isOnfiilineOrder}
  1339. </if>
  1340. </select>
  1341. <!-- 可根据自己的需求,是否要使用 -->
  1342. <resultMap type="com.kmall.admin.dto.OrderRecognitionDto" id="orderRecognitionMap">
  1343. <result property="id" column="id"/>
  1344. <result property="merchOrderSn" column="merch_order_sn"/>
  1345. <result property="orderSn" column="order_sn"/>
  1346. <result property="userId" column="user_id"/>
  1347. <result property="orderStatus" column="order_status"/>
  1348. <result property="shippingStatus" column="shipping_status"/>
  1349. <result property="payStatus" column="pay_status"/>
  1350. <result property="consignee" column="consignee"/>
  1351. <result property="country" column="country"/>
  1352. <result property="province" column="province"/>
  1353. <result property="city" column="city"/>
  1354. <result property="district" column="district"/>
  1355. <result property="address" column="address"/>
  1356. <result property="mobile" column="mobile"/>
  1357. <result property="postscript" column="postscript"/>
  1358. <result property="shippingId" column="shipping_id"/>
  1359. <result property="shippingName" column="shipping_name"/>
  1360. <result property="shippingCode" column="shipping_code"/>
  1361. <result property="shippingNo" column="shipping_no"/>
  1362. <result property="payId" column="pay_id"/>
  1363. <result property="payName" column="pay_name"/>
  1364. <result property="shippingFee" column="shipping_fee"/>
  1365. <result property="actualPrice" column="actual_price"/>
  1366. <result property="integral" column="integral"/>
  1367. <result property="integralMoney" column="integral_money"/>
  1368. <result property="orderPrice" column="order_price"/>
  1369. <result property="goodsPrice" column="goods_price"/>
  1370. <result property="addTime" column="add_time"/>
  1371. <result property="confirmTime" column="confirm_time"/>
  1372. <result property="payTime" column="pay_time"/>
  1373. <result property="freightPrice" column="freight_price"/>
  1374. <result property="couponId" column="coupon_id"/>
  1375. <result property="couponPrice" column="coupon_price"/>
  1376. <result property="callbackStatus" column="callback_status"/>
  1377. <result property="orderType" column="order_type"/>
  1378. <result property="storeId" column="store_id"/>
  1379. <result property="userName" column="username"/>
  1380. <result property="orderType" column="order_type"/>
  1381. <result property="activityId" column="activity_id"/>
  1382. <result property="deliveryDate" column="delivery_date"/>
  1383. <result property="deliveryRemark" column="delivery_remark"/>
  1384. <result property="predictTime" column="predict_time"/>
  1385. <result property="orderBizType" column="order_biz_type"/>
  1386. <result property="isPaymentSend" column="is_payment_send"/>
  1387. <result property="isEleOrderSend" column="is_ele_order_send"/>
  1388. <result property="isCustomsSend" column="is_customs_send"/>
  1389. <result property="payFlag" column="pay_flag"/>
  1390. <result column="buyer_pay_check" property="buyerPayCheck"/>
  1391. <result property="merchSn" column="merch_sn"/>
  1392. <result property="sku" column="sku"/>
  1393. <result property="createTime" column="create_time"/>
  1394. <result property="modTime" column="mod_time"/>
  1395. <result property="isOnfflineOrder" column="is_onffline_order"/>
  1396. <result property="orderSnWx" column="order_sn_wx"/>
  1397. <result property="isMergePay" column="is_merge_pay"/>
  1398. <result property="payTransactionId" column="pay_transaction_id"/>
  1399. <result property="storeName" column="store_name"/>
  1400. <result property="moderSn" column="moder_sn"/>
  1401. <result property="unitCode" column="unit_code"/>
  1402. <result property="ciqProdModel" column="ciq_prod_model"/>
  1403. <result property="oriCntCode" column="ori_cnt_code"/>
  1404. <result property="brand" column="brand"/>
  1405. <result column="gross_weight" property="grossWeight" />
  1406. <result column="net_weight" property="netWeight" />
  1407. <result property="fullCutPrice" column="full_cut_price"/>
  1408. <result property="campMinusId" column="camp_minus_id"/>
  1409. <result property="campName" column="camp_name"/>
  1410. <result property="isTempNoti" column="is_temp_noti"/>
  1411. <result property="isFaceCheck" column="is_face_check"/>
  1412. <result property="tempNotiMsg" column="temp_noti_msg"/>
  1413. <result property="recognitionReturnMsg" column="recognition_return_msg"/>
  1414. <result property="lastFaceTime" column="last_face_time"/>
  1415. <result property="failCount" column="fail_count"/>
  1416. <result property="checkOperatorType" column="check_operator_type"/>
  1417. <result property="faceLivenessId" column="faceLivenessId"/>
  1418. </resultMap>
  1419. <select id="queryOrderListByRecognition" resultMap="orderRecognitionMap">
  1420. SELECT DISTINCT
  1421. o.order_sn,
  1422. o.merch_order_sn,
  1423. o.order_status,
  1424. o.actual_price,
  1425. o.order_biz_type,
  1426. o.shipping_no,
  1427. o.shipping_name,
  1428. o.shipping_code,
  1429. o.consignee,
  1430. o.mobile,
  1431. o.province,
  1432. o.city,
  1433. o.district,
  1434. o.address,
  1435. o.add_time,
  1436. o.pay_id,
  1437. o.pay_status,
  1438. o.shipping_status,
  1439. o.is_merge_pay,
  1440. o.buyer_pay_check,
  1441. o.order_price,
  1442. o.moder_sn,
  1443. o.id,
  1444. u.username AS username,
  1445. o.user_id,
  1446. p.is_payment_send,
  1447. p.is_ele_order_send,
  1448. p.is_customs_send,
  1449. s.store_name,
  1450. o.full_cut_price,
  1451. o.camp_minus_id,
  1452. o.camp_name,
  1453. fd.is_temp_noti,
  1454. fd.is_face_check,
  1455. fd.temp_noti_msg,
  1456. fd.recognition_return_msg,
  1457. fd.fail_count,
  1458. fd.id 'faceLivenessId',
  1459. fd.check_operator_type,
  1460. u.last_face_time,
  1461. t.is_face_check 'thirdIsFaceCheck'
  1462. FROM
  1463. mall_order o
  1464. LEFT JOIN mall_user u ON o.user_id = u.id
  1465. LEFT JOIN mall_order_process_record p ON o.order_sn = p.order_sn
  1466. left join mall_store s on o.store_id = s.id
  1467. LEFT JOIN third_merchant_biz t ON t.third_party_merch_code = s.third_party_merch_code
  1468. LEFT JOIN mall_order_goods g ON o.id = g.order_id
  1469. LEFT JOIN mall_product_store_rela r ON o.store_id = r.store_id
  1470. AND r.goods_id = g.goods_id
  1471. LEFT JOIN mall_goods gs ON g.goods_id = gs.id
  1472. INNER JOIN face_liveness_recognition_return_data fd on fd.order_sn = o.order_sn and fd.user_id = o.user_id
  1473. WHERE 1=1
  1474. <if test="startTime != null and startTime != ''">
  1475. AND o.add_time <![CDATA[ > ]]> #{startTime}
  1476. </if>
  1477. <if test="endTime != null and endTime != ''">
  1478. AND o.add_time <![CDATA[ < ]]> #{endTime}
  1479. </if>
  1480. <if test="storeId != null and storeId != ''">
  1481. AND o.store_id = #{storeId}
  1482. </if>
  1483. <if test="sku != null and sku.trim() != ''">
  1484. AND gs.sku = #{sku}
  1485. </if>
  1486. <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
  1487. AND s.third_party_merch_code = #{thirdPartyMerchCode}
  1488. </if>
  1489. <if test="thirdMerchSn != null and thirdMerchSn != ''">
  1490. AND t.third_merch_sn = #{thirdMerchSn}
  1491. </if>
  1492. <if test="supplierThirdId != null and supplierThirdId != ''">
  1493. AND r.supplier_third_id = #{supplierThirdId}
  1494. </if>
  1495. <if test="orderBizType != null and orderBizType != ''">
  1496. AND o.order_biz_type = #{orderBizType}
  1497. </if>
  1498. <if test="merchOrderSn != null and merchOrderSn.trim() != ''">
  1499. AND o.merch_order_sn = #{merchOrderSn}
  1500. </if>
  1501. <if test="merchSn != null and merchSn.trim() != ''">
  1502. AND o.merch_sn = #{merchSn}
  1503. </if>
  1504. <if test="orderSn != null and orderSn.trim() != ''">
  1505. AND o.order_sn LIKE concat('%',#{orderSn},'%')
  1506. </if>
  1507. <if test="shippingStatus != null and shippingStatus.trim() != ''">
  1508. AND o.shipping_status = #{shippingStatus}
  1509. </if>
  1510. <if test="payStatus != null and payStatus.trim() != ''">
  1511. AND o.pay_status = #{payStatus}
  1512. </if>
  1513. <if test="orderStatus != null and orderStatus.trim() != ''">
  1514. AND o.order_status = #{orderStatus}
  1515. </if>
  1516. <if test="shippingId != null and shippingId != 0">
  1517. AND o.shipping_id = #{shippingId}
  1518. </if>
  1519. <if test="orderType != null and orderType.trim() != ''">
  1520. AND o.order_type = #{orderType}
  1521. </if>
  1522. <if test="isOnfiilineOrder != null">
  1523. AND o.is_onffline_order = #{isOnfiilineOrder}
  1524. </if>
  1525. <if test="ids != null and ids.trim() != ''">
  1526. AND o.id in (${ids})
  1527. </if>
  1528. <choose>
  1529. <when test="sidx != null and sidx.trim() != ''">
  1530. order by ${sidx} ${order}
  1531. </when>
  1532. <otherwise>
  1533. order by o.id desc
  1534. </otherwise>
  1535. </choose>
  1536. <if test="offset != null and limit != null">
  1537. limit #{offset}, #{limit}
  1538. </if>
  1539. </select>
  1540. <select id="queryOrderListByRecognitionTotal" resultType="int">
  1541. SELECT count(1)
  1542. FROM
  1543. mall_order o
  1544. LEFT JOIN mall_user u ON o.user_id = u.id
  1545. LEFT JOIN mall_order_process_record p ON o.order_sn = p.order_sn
  1546. left join mall_store s on o.store_id = s.id
  1547. LEFT JOIN third_merchant_biz t ON t.third_party_merch_code = s.third_party_merch_code
  1548. LEFT JOIN mall_order_goods g ON o.id = g.order_id
  1549. LEFT JOIN mall_product_store_rela r ON o.store_id = r.store_id
  1550. AND r.goods_id = g.goods_id
  1551. LEFT JOIN mall_goods gs ON g.goods_id = gs.id
  1552. INNER JOIN face_liveness_recognition_return_data fd on fd.order_sn = o.order_sn and fd.user_id = o.user_id
  1553. WHERE 1=1
  1554. <if test="startTime != null and startTime != ''">
  1555. AND o.add_time <![CDATA[ > ]]> #{startTime}
  1556. </if>
  1557. <if test="endTime != null and endTime != ''">
  1558. AND o.add_time <![CDATA[ < ]]> #{endTime}
  1559. </if>
  1560. <if test="storeId != null and storeId != ''">
  1561. AND o.store_id = #{storeId}
  1562. </if>
  1563. <if test="sku != null and sku.trim() != ''">
  1564. AND gs.sku = #{sku}
  1565. </if>
  1566. <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
  1567. AND s.third_party_merch_code = #{thirdPartyMerchCode}
  1568. </if>
  1569. <if test="thirdMerchSn != null and thirdMerchSn != ''">
  1570. AND t.third_merch_sn = #{thirdMerchSn}
  1571. </if>
  1572. <if test="supplierThirdId != null and supplierThirdId != ''">
  1573. AND r.supplier_third_id = #{supplierThirdId}
  1574. </if>
  1575. <if test="orderBizType != null and orderBizType != ''">
  1576. AND o.order_biz_type = #{orderBizType}
  1577. </if>
  1578. <if test="merchOrderSn != null and merchOrderSn.trim() != ''">
  1579. AND o.merch_order_sn = #{merchOrderSn}
  1580. </if>
  1581. <if test="merchSn != null and merchSn.trim() != ''">
  1582. AND o.merch_sn = #{merchSn}
  1583. </if>
  1584. <if test="orderSn != null and orderSn.trim() != ''">
  1585. AND o.order_sn LIKE concat('%',#{orderSn},'%')
  1586. </if>
  1587. <if test="shippingStatus != null and shippingStatus.trim() != ''">
  1588. AND o.shipping_status = #{shippingStatus}
  1589. </if>
  1590. <if test="payStatus != null and payStatus.trim() != ''">
  1591. AND o.pay_status = #{payStatus}
  1592. </if>
  1593. <if test="orderStatus != null and orderStatus.trim() != ''">
  1594. AND o.order_status = #{orderStatus}
  1595. </if>
  1596. <if test="shippingId != null and shippingId != 0">
  1597. AND o.shipping_id = #{shippingId}
  1598. </if>
  1599. <if test="orderType != null and orderType.trim() != ''">
  1600. AND o.order_type = #{orderType}
  1601. </if>
  1602. <if test="isOnfiilineOrder != null">
  1603. AND o.is_onffline_order = #{isOnfiilineOrder}
  1604. </if>
  1605. <if test="ids != null and ids.trim() != ''">
  1606. AND o.id in (${ids})
  1607. </if>
  1608. </select>
  1609. <select id="queryOrderByRecogTemp" resultType="com.kmall.admin.dto.SendTempDto">
  1610. SELECT
  1611. o.add_time 'addTime',
  1612. u.weixin_openid 'openId',
  1613. o.merch_order_sn 'merchOrderSn',
  1614. o.id 'orderId',
  1615. o.order_sn 'orderSn'
  1616. FROM
  1617. mall_order o
  1618. INNER JOIN mall_user u ON o.user_id = u.id
  1619. where o.id = #{value}
  1620. </select>
  1621. <select id="queryRealtimeSales" resultType="com.kmall.admin.entity.RealtimeSalesDetection">
  1622. SELECT
  1623. s.id AS storeId,
  1624. o.merch_sn AS merchSn,
  1625. m.merch_name AS merchName,
  1626. count( distinct o.order_sn ) AS guestNumber,
  1627. sum( og.actual_payment_amount/ (1+og.goods_rate) ) + sum(og.discounted_price)AS totalSales,
  1628. sum( og.actual_payment_amount/ (1+og.goods_rate) ) + sum(og.discounted_price) AS actualSales,
  1629. s.store_name AS storeName,
  1630. max( o.add_time ) AS lastSalesTime ,
  1631. sum( g.cost_price) AS totalCost
  1632. FROM
  1633. mall_order o
  1634. LEFT JOIN mall_store s ON o.store_id = s.id
  1635. LEFT JOIN mall_merch m ON o.merch_sn = m.merch_sn
  1636. LEFT JOIN mall_order_goods og ON o.id = og.order_id
  1637. LEFT JOIN mall_goods g ON og.goods_id = g.id
  1638. LEFT JOIN mall_product_store_rela sr ON sr.goods_id = g.id
  1639. LEFT JOIN mall_category c ON sr.category_id = c.id
  1640. WHERE
  1641. 1 = 1
  1642. and (o.order_status = '300' or o.order_status = '201')
  1643. <if test="storeId != null and storeId.trim() != ''">
  1644. and o.store_id=#{storeId}
  1645. </if>
  1646. <if test="merchSn != null and merchSn.trim() != ''">
  1647. and o.merch_sn=#{merchSn}
  1648. </if>
  1649. <choose>
  1650. <when test="compareDate != null and compareDate != ''">
  1651. and ( datediff ( o.add_time , #{compareDate} ) = 0 )
  1652. </when>
  1653. <when test="salesDate != null and salesDate != ''">
  1654. and ( datediff ( o.add_time , #{salesDate} ) = 0 )
  1655. </when >
  1656. <otherwise></otherwise>
  1657. </choose>
  1658. <if test="categoryId != null and categoryId != ''">
  1659. AND (c.parent_id = #{categoryId} or c.id = #{categoryId})
  1660. </if>
  1661. </select>
  1662. <select id="purchaseSalesInStockDetailList" resultType="com.kmall.admin.entity.PurchaseSalesInStockDetail">
  1663. select
  1664. substr(msmc.create_time,1,10) as time,
  1665. if(msmc.change_type = 1 ,'销售','期初') as type,
  1666. sum(if((msmc.change_type = 2 or msmc.change_type = 3 ),msmc.store_change_num,0)) as addNum,
  1667. sum(if(msmc.change_type = 1 ,msmc.store_change_num,0)) as lessNum,
  1668. rela.stock_num as endingInventory,
  1669. rela.stock_num as inventory,
  1670. 0 as costPrice,
  1671. rela.retail_price as retailPrice,
  1672. 0 as addAmount,
  1673. sum(if(msmc.change_type = 1 ,msmc.store_change_num,0)*rela.retail_price) as lessAmount,
  1674. 0 as price
  1675. from mall_product_store_rela rela
  1676. left join mall_store_mng_change msmc on msmc.goods_id = rela.goods_id
  1677. left join mall_goods g on g.id = msmc.goods_id
  1678. WHERE 1=1 and msmc.creater_sn <![CDATA[ <> ]]> '定时任务'
  1679. <if test="storeId != null and storeId != ''">
  1680. AND rela.store_id = #{storeId}
  1681. </if>
  1682. <if test="goodsSn != null and goodsSn.trim() != ''">
  1683. AND g.goods_sn = #{goodsSn}
  1684. </if>
  1685. <if test="prodBarcode != null and prodBarcode.trim() != ''">
  1686. AND g.prod_barcode = #{prodBarcode}
  1687. </if>
  1688. <if test="startTime != null and startTime.trim() != ''">
  1689. AND substr(msmc.create_time,1,10) <![CDATA[ >= ]]> #{startTime}
  1690. </if>
  1691. <if test="endTime != null and endTime.trim() != ''">
  1692. AND substr(msmc.create_time,1,10) <![CDATA[ <= ]]> #{endTime}
  1693. </if>
  1694. group by substr(msmc.create_time,1,10)
  1695. <if test="offset != null and limit != null">
  1696. limit #{offset}, #{limit}
  1697. </if>
  1698. </select>
  1699. <select id="purchaseSalesInStockDetailTotal" resultType="int">
  1700. select count(1) from ( select count(DISTINCT rela.id)
  1701. from mall_product_store_rela rela
  1702. left join mall_store_mng_change msmc on msmc.goods_id = rela.goods_id
  1703. left join mall_goods g on g.id = msmc.goods_id
  1704. WHERE 1=1 and msmc.creater_sn <![CDATA[ <> ]]> '定时任务'
  1705. <if test="storeId != null and storeId != ''">
  1706. AND rela.store_id = #{storeId}
  1707. </if>
  1708. <if test="goodsSn != null and goodsSn.trim() != ''">
  1709. AND g.goods_sn = #{goodsSn}
  1710. </if>
  1711. <if test="sku != null and sku.trim() != ''">
  1712. AND g.sku = #{sku}
  1713. </if>
  1714. <if test="prodBarcode != null and prodBarcode.trim() != ''">
  1715. AND g.prod_barcode = #{prodBarcode}
  1716. </if>
  1717. <if test="startTime != null and startTime.trim() != ''">
  1718. AND substr(msmc.create_time,1,10) <![CDATA[ >= ]]> #{startTime}
  1719. </if>
  1720. <if test="endTime != null and endTime.trim() != ''">
  1721. AND substr(msmc.create_time,1,10) <![CDATA[ <= ]]> #{endTime}
  1722. </if>
  1723. group by substr(msmc.create_time,1,10)
  1724. ) b
  1725. </select>
  1726. <select id="queryTopicPriceByOrderSnAndSku" resultType="java.math.BigDecimal">
  1727. SELECT mst.topic_price FROM mall_order mo
  1728. inner JOIN mall_order_goods mog ON mo.id = mog.order_id
  1729. inner JOIN mall_store_topic mst ON mog.store_topic_id=mst.id
  1730. WHERE mo.order_sn=#{orderSn} AND mog.sku=#{sku};
  1731. </select>
  1732. <select id="queryExportOffilineOrderList" resultType="com.kmall.admin.entity.OrderEntity">
  1733. SELECT distinct
  1734. o.id,
  1735. o.order_sn,
  1736. u.username as userName,
  1737. o.pay_name,
  1738. o.mobile,
  1739. o.is_onffline_order,
  1740. o.order_biz_type,
  1741. o.order_status,
  1742. o.pay_status,
  1743. o.coupon_name,
  1744. o.coupon_price,
  1745. g.actual_payment_amount as actualPrice,
  1746. o.order_price,
  1747. o.pay_time,
  1748. o.pay_flag,
  1749. u.username AS userName,
  1750. g.discounted_price as couponPrice ,
  1751. s.store_name storeName,
  1752. g.sku,
  1753. g.goods_name as goodsName,
  1754. g.retail_price,
  1755. g.number
  1756. FROM
  1757. mall_order o
  1758. LEFT JOIN mall_order_goods g ON o.id = g.order_id
  1759. left join mall_store s on o.store_id = s.id
  1760. LEFT JOIN mall_goods gs ON g.goods_id = gs.id
  1761. left join mall_sale_record record on record.order_sn = o.order_sn
  1762. LEFT JOIN sys_user u ON record.saller_id = u.user_id
  1763. WHERE 1=1
  1764. <if test="orderSn != null and orderSn.trim() != ''">
  1765. AND o.order_sn LIKE concat('%',#{orderSn},'%')
  1766. </if>
  1767. <if test="orderStatus != null and orderStatus.trim() != ''">
  1768. AND o.order_status = #{orderStatus}
  1769. </if>
  1770. <if test="isOnfiilineOrder != null">
  1771. AND o.is_onffline_order = #{isOnfiilineOrder}
  1772. </if>
  1773. <if test="startTime != null and startTime != ''">
  1774. AND o.add_time <![CDATA[ > ]]> #{startTime}
  1775. </if>
  1776. <if test="endTime != null and endTime != ''">
  1777. AND o.add_time <![CDATA[ < ]]> #{endTime}
  1778. </if>
  1779. </select>
  1780. <select id="queryMasterExportOffilineOrderList" resultType="com.kmall.admin.entity.OrderEntity">
  1781. SELECT distinct
  1782. o.id,
  1783. o.order_sn,
  1784. u.username as userName,
  1785. o.pay_name,
  1786. o.mobile,
  1787. o.is_onffline_order,
  1788. o.order_biz_type,
  1789. o.order_status,
  1790. o.pay_status,
  1791. o.coupon_name,
  1792. o.coupon_price,
  1793. o.actual_price,
  1794. o.order_price,
  1795. o.pay_time,
  1796. o.pay_flag,
  1797. u.username AS userName,
  1798. s.store_name storeName
  1799. FROM
  1800. mall_order o
  1801. LEFT JOIN mall_order_goods g ON o.id = g.order_id
  1802. left join mall_store s on o.store_id = s.id
  1803. LEFT JOIN mall_goods gs ON g.goods_id = gs.id
  1804. left join mall_sale_record record on record.order_sn = o.order_sn
  1805. LEFT JOIN sys_user u ON record.saller_id = u.user_id
  1806. WHERE 1=1
  1807. <if test="storeId != null and storeId != ''">
  1808. AND o.store_id = #{storeId}
  1809. </if>
  1810. <if test="merchSn != null and merchSn.trim() != ''">
  1811. AND o.merch_sn = #{merchSn}
  1812. </if>
  1813. <if test="goodsSn != null and goodsSn.trim() != ''">
  1814. AND gs.goods_sn = #{goodsSn}
  1815. </if>
  1816. <if test="sku != null and sku.trim() != ''">
  1817. AND gs.sku = #{sku}
  1818. </if>
  1819. <if test="prodBarcode != null and prodBarcode.trim() != ''">
  1820. AND gs.prod_barcode = #{prodBarcode}
  1821. </if>
  1822. <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
  1823. AND s.third_party_merch_code = #{thirdPartyMerchCode}
  1824. </if>
  1825. <if test="orderSn != null and orderSn.trim() != ''">
  1826. AND o.order_sn LIKE concat('%',#{orderSn},'%')
  1827. </if>
  1828. <if test="shippingStatus != null and shippingStatus.trim() != ''">
  1829. AND o.shipping_status = #{shippingStatus}
  1830. </if>
  1831. <if test="payStatus != null and payStatus.trim() != ''">
  1832. AND o.pay_status = #{payStatus}
  1833. </if>
  1834. <if test="orderStatus != null and orderStatus.trim() != ''">
  1835. AND o.order_status = #{orderStatus}
  1836. </if>
  1837. <if test="shippingId != null and shippingId != 0">
  1838. AND o.shipping_id = #{shippingId}
  1839. </if>
  1840. <if test="orderType != null and orderType.trim() != ''">
  1841. AND o.order_type = #{orderType}
  1842. </if>
  1843. <if test="isOnfiilineOrder != null">
  1844. AND o.is_onffline_order = #{isOnfiilineOrder}
  1845. </if>
  1846. <if test="ids != null and ids.trim() != ''">
  1847. AND o.id in (${ids})
  1848. </if>
  1849. <if test="startTime != null and startTime != ''">
  1850. AND o.add_time <![CDATA[ > ]]> #{startTime}
  1851. </if>
  1852. <if test="endTime != null and endTime != ''">
  1853. AND o.add_time <![CDATA[ < ]]> #{endTime}
  1854. </if>
  1855. </select>
  1856. <select id="queryMasterExportList" resultType="com.kmall.admin.entity.OrderEntity">
  1857. SELECT DISTINCT
  1858. o.order_sn,
  1859. o.merch_order_sn,
  1860. o.order_status,
  1861. o.actual_price,
  1862. o.order_biz_type,
  1863. o.shipping_no,
  1864. o.shipping_name,
  1865. o.shipping_code,
  1866. o.consignee,
  1867. o.mobile,
  1868. o.province,
  1869. o.city,
  1870. o.district,
  1871. o.address,
  1872. o.add_time,
  1873. o.pay_id,
  1874. o.pay_status,
  1875. o.shipping_status,
  1876. o.is_merge_pay,
  1877. o.buyer_pay_check,
  1878. o.order_price,
  1879. o.moder_sn,
  1880. o.id,
  1881. u.username AS username,
  1882. p.is_payment_send,
  1883. p.is_ele_order_send,
  1884. p.is_customs_send,
  1885. s.store_name,
  1886. o.full_cut_price,
  1887. o.camp_minus_id,
  1888. o.camp_name
  1889. FROM
  1890. mall_order o
  1891. LEFT JOIN mall_user u ON o.user_id = u.id
  1892. LEFT JOIN mall_order_process_record p ON o.order_sn = p.order_sn
  1893. left join mall_store s on o.store_id = s.id
  1894. LEFT JOIN third_merchant_biz t ON t.third_party_merch_code = s.third_party_merch_code
  1895. LEFT JOIN mall_order_goods g ON o.id = g.order_id
  1896. LEFT JOIN mall_product_store_rela r ON o.store_id = r.store_id
  1897. AND r.goods_id = g.goods_id
  1898. LEFT JOIN mall_goods gs ON g.goods_id = gs.id
  1899. WHERE 1=1
  1900. <if test="startTime != null and startTime != ''">
  1901. AND o.add_time <![CDATA[ > ]]> #{startTime}
  1902. </if>
  1903. <if test="endTime != null and endTime != ''">
  1904. AND o.add_time <![CDATA[ < ]]> #{endTime}
  1905. </if>
  1906. <if test="storeId != null and storeId != ''">
  1907. AND o.store_id = #{storeId}
  1908. </if>
  1909. <if test="sku != null and sku.trim() != ''">
  1910. AND gs.sku = #{sku}
  1911. </if>
  1912. <if test="prodBarcode != null and prodBarcode.trim() != ''">
  1913. AND gs.prod_barcode = #{prodBarcode}
  1914. </if>
  1915. <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
  1916. AND s.third_party_merch_code = #{thirdPartyMerchCode}
  1917. </if>
  1918. <if test="thirdMerchSn != null and thirdMerchSn != ''">
  1919. AND t.third_merch_sn = #{thirdMerchSn}
  1920. </if>
  1921. <if test="supplierThirdId != null and supplierThirdId != ''">
  1922. AND r.supplier_third_id = #{supplierThirdId}
  1923. </if>
  1924. <if test="orderBizType != null and orderBizType != ''">
  1925. AND o.order_biz_type = #{orderBizType}
  1926. </if>
  1927. <if test="merchOrderSn != null and merchOrderSn.trim() != ''">
  1928. AND o.merch_order_sn = #{merchOrderSn}
  1929. </if>
  1930. <if test="merchSn != null and merchSn.trim() != ''">
  1931. AND o.merch_sn = #{merchSn}
  1932. </if>
  1933. <if test="orderSn != null and orderSn.trim() != ''">
  1934. AND o.order_sn LIKE concat('%',#{orderSn},'%')
  1935. </if>
  1936. <if test="shippingStatus != null and shippingStatus.trim() != ''">
  1937. AND o.shipping_status = #{shippingStatus}
  1938. </if>
  1939. <if test="payStatus != null and payStatus.trim() != ''">
  1940. AND o.pay_status = #{payStatus}
  1941. </if>
  1942. <if test="orderStatus != null and orderStatus.trim() != ''">
  1943. AND o.order_status = #{orderStatus}
  1944. </if>
  1945. <if test="shippingId != null and shippingId != 0">
  1946. AND o.shipping_id = #{shippingId}
  1947. </if>
  1948. <if test="orderType != null and orderType.trim() != ''">
  1949. AND o.order_type = #{orderType}
  1950. </if>
  1951. <if test="isOnfiilineOrder != null">
  1952. AND o.is_onffline_order = #{isOnfiilineOrder}
  1953. </if>
  1954. <if test="ids != null and ids.trim() != ''">
  1955. AND o.id in (${ids})
  1956. </if>
  1957. </select>
  1958. <select id="queryPickUpCodeList" resultType="com.kmall.admin.entity.OrderEntity">
  1959. SELECT distinct
  1960. o.*,
  1961. c.pick_up_code_sn,
  1962. c.pick_up_code_status
  1963. FROM mall_order o
  1964. LEFT JOIN mall_pick_up_code c ON c.order_sn = o.order_sn
  1965. WHERE 1=1
  1966. <if test="storeId != null and storeId != ''">
  1967. AND o.store_id = #{storeId}
  1968. </if>
  1969. <if test="isOnfiilineOrder != null">
  1970. AND o.is_onffline_order = #{isOnfiilineOrder}
  1971. </if>
  1972. <if test="orderSn != null and orderSn.trim() != ''">
  1973. AND o.order_sn LIKE concat('%',#{orderSn},'%')
  1974. </if>
  1975. <if test="payName != null and payName.trim() != ''">
  1976. AND o.pay_name LIKE concat('%',#{payName},'%')
  1977. </if>
  1978. <if test="payMobile != null and payMobile.trim() != ''">
  1979. AND o.pay_mobile LIKE concat('%',#{payMobile},'%')
  1980. </if>
  1981. <if test="startTime != null and startTime.trim() != ''">
  1982. AND c.pick_up_code_createtime &gt;= #{startTime}
  1983. </if>
  1984. <if test="endTime != null and endTime.trim() != ''">
  1985. AND c.pick_up_code_createtime &lt;= #{endTime}
  1986. </if>
  1987. order by o.id desc
  1988. </select>
  1989. <select id="queryExportSystemFormatList" resultType="com.kmall.admin.dto.SystemFormatDto">
  1990. SELECT distinct
  1991. o.id,
  1992. o.order_sn as receiptNo,
  1993. u.username as cashRegisterNo,
  1994. o.pay_time as timeStampDetails,
  1995. u.username as staffID,
  1996. u.username as staffName,
  1997. gs.hs_code as hsCode,
  1998. gs.hs_code_name as hsCodeName,
  1999. gs.goods_sn as ematouCode,
  2000. gs.plu as plu,
  2001. gs.mychem_id as mychemID,
  2002. gs.english_name as productNameEN,
  2003. gs.name as productNameCN,
  2004. gs.prod_barcode as barcode,
  2005. gs.ciq_prod_model as packSize,
  2006. uc.name as productSpecification,
  2007. b.name as brand,
  2008. gs.daily_price as edlp,
  2009. sr.bottom_line_price as costPrice,
  2010. g.number as unitSold,
  2011. g.actual_payment_amount as totalSalesInclTax,
  2012. gs.goods_rate as taxRate,
  2013. '专柜单品' as productCategory,
  2014. sup.child_supplier_name as supplierName,
  2015. o.order_status as orderStatus
  2016. FROM
  2017. mall_order o
  2018. LEFT JOIN mall_order_goods g ON o.id = g.order_id
  2019. left join mall_store s on o.store_id = s.id
  2020. LEFT JOIN mall_goods gs ON g.goods_id = gs.id
  2021. left join mall_sale_record record on record.order_sn = o.order_sn
  2022. LEFT JOIN sys_user u ON record.saller_id = u.user_id
  2023. left join sys_cus_unit_code uc on uc.code = gs.unit_code
  2024. left join mall_product_store_rela sr on sr.goods_id=gs.id
  2025. left join mall_brand b on b.id=sr.brand_id
  2026. left join mall_supplier sup on gs.supplier_id = sup.id
  2027. WHERE 1=1
  2028. <if test="orderSn != null and orderSn.trim() != ''">
  2029. AND o.order_sn LIKE concat('%',#{orderSn},'%')
  2030. </if>
  2031. <if test="orderStatus != null and orderStatus.trim() != ''">
  2032. AND o.order_status = #{orderStatus}
  2033. </if>
  2034. <if test="isOnfiilineOrder != null">
  2035. AND o.is_onffline_order = #{isOnfiilineOrder}
  2036. </if>
  2037. <if test="startTime != null and startTime != ''">
  2038. AND o.add_time <![CDATA[ > ]]> #{startTime}
  2039. </if>
  2040. <if test="endTime != null and endTime != ''">
  2041. AND o.add_time <![CDATA[ < ]]> #{endTime}
  2042. </if>
  2043. </select>
  2044. <update id="updateOrderInfo" parameterType="map">
  2045. UPDATE mall_order a
  2046. <set>
  2047. <if test="orderStatus != null">a.order_status = #{orderStatus},</if>
  2048. <if test="payStatus != null">a.pay_status = #{payStatus},</if>
  2049. <if test="payFlag != null">a.pay_flag = #{payFlag},</if>
  2050. <if test="orderSnWx != null">a.order_sn_wx = #{orderSnWx},</if>
  2051. <if test="payTransactionId != null">a.pay_transaction_id = #{payTransactionId},</if>
  2052. <if test="payTime != null">a.pay_time = #{payTime},</if>
  2053. <if test="totalFee != null">a.total_fee = #{totalFee},</if>
  2054. <if test="feeType != null">a.fee_type = #{feeType},</if>
  2055. <if test="cashFee != null">a.cash_fee = #{cashFee},</if>
  2056. <if test="cashFeeType != null">a.cash_fee_type = #{cashFeeType},</if>
  2057. <if test="rate != null">a.rate = #{rate},</if>
  2058. </set>
  2059. WHERE 1 = 1
  2060. AND a.id = #{orderId}
  2061. </update>
  2062. <update id="updateOrderProcessRecord" parameterType="map">
  2063. UPDATE mall_order_process_record a
  2064. <set>
  2065. <if test="payTime != null">a.pay_succ_time = #{payTime}</if>
  2066. </set>
  2067. WHERE 1 = 1
  2068. AND a.order_sn = #{orderSn}
  2069. </update>
  2070. </mapper>