1
0

ApiOrderMapper.xml 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787
  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.api.dao.ApiOrderMapper">
  4. <!-- 可根据自己的需求,是否要使用 -->
  5. <resultMap type="com.kmall.api.entity.OrderVo" id="orderMap">
  6. <result property="id" column="id"/>
  7. <result property="order_sn" column="order_sn"/>
  8. <result property="user_id" column="user_id"/>
  9. <result property="order_status" column="order_status"/>
  10. <result property="shipping_status" column="shipping_status"/>
  11. <result property="pay_status" column="pay_status"/>
  12. <result property="consignee" column="consignee"/>
  13. <result property="country" column="country"/>
  14. <result property="province" column="province"/>
  15. <result property="city" column="city"/>
  16. <result property="district" column="district"/>
  17. <result property="address" column="address"/>
  18. <result property="address_id" column="address_id"/>
  19. <result property="mobile" column="mobile"/>
  20. <result property="postscript" column="postscript"/>
  21. <result property="shipping_id" column="shipping_id"/>
  22. <result property="shipping_name" column="shipping_name"/>
  23. <result property="shipping_mobile" column="shipping_mobile"/>
  24. <result property="shipping_fee" column="shipping_fee"/>
  25. <result property="shipping_no" column="shipping_no"/>
  26. <result property="shipping_code" column="shipping_code"/>
  27. <result property="pay_id" column="pay_id"/>
  28. <result property="pay_name" column="pay_name"/>
  29. <result property="actual_price" column="actual_price"/>
  30. <result property="integral" column="integral"/>
  31. <result property="integral_money" column="integral_money"/>
  32. <result property="order_price" column="order_price"/>
  33. <result property="goods_price" column="goods_price"/>
  34. <result property="add_time" column="add_time"/>
  35. <result property="confirm_time" column="confirm_time"/>
  36. <result property="pay_time" column="pay_time"/>
  37. <result property="freight_price" column="freight_price"/>
  38. <result property="coupon_id" column="coupon_id"/>
  39. <result property="coupon_name" column="coupon_name"/>
  40. <result property="coupon_price" column="coupon_price"/>
  41. <result property="order_type" column="order_type"/>
  42. <result property="activity_id" column="activity_id"/>
  43. <result property="store_id" column="store_id"/>
  44. <result property="delivery_date" column="delivery_date"/>
  45. <result property="delivery_remark" column="delivery_remark"/>
  46. <result property="predict_time" column="predict_time"/>
  47. <result property="latitude" column="latitude"/>
  48. <result property="longitude" column="longitude"/>
  49. <result property="comment_count" column="comment_count"/>
  50. <result property="full_cut_price" column="full_cut_price"/>
  51. <result property="campMinusId" column="camp_minus_id"/>
  52. <result property="campName" column="camp_name"/>
  53. <result column="merch_sn" property="merchSn" jdbcType="VARCHAR" />
  54. <result column="order_biz_type" property="orderBizType" jdbcType="CHAR" />
  55. <result column="pay_transaction_id" property="payTransactionId" jdbcType="VARCHAR" />
  56. <result column="pay_mobile" property="payMobile" jdbcType="VARCHAR" />
  57. <result column="buyer_pay_check" property="buyerPayCheck" jdbcType="VARCHAR" />
  58. <result column="pay_flag" property="payFlag" jdbcType="VARCHAR" />
  59. <result column="creater_sn" property="createrSn" jdbcType="VARCHAR" />
  60. <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
  61. <result column="moder_sn" property="moderSn" jdbcType="VARCHAR" />
  62. <result column="mod_time" property="modTime" jdbcType="TIMESTAMP" />
  63. <result column="tstm" property="tstm" jdbcType="TIMESTAMP" />
  64. <result column="merch_order_sn" property="merchOrderSn" jdbcType="VARCHAR" />
  65. <result column="is_scan" property="isScan" jdbcType="VARCHAR" />
  66. <result column="store_name" property="storeName" jdbcType="VARCHAR" />
  67. <result property="isRefundStatus" column="isRefundStatus"/>
  68. <result property="refundStatus" column="refund_status"/>
  69. <result property="approvalRemark" column="approval_remark"/>
  70. <result property="isMergePay" column="is_merge_pay"/>
  71. <result property="isOnfflineOrder" column="is_onffline_order"/>
  72. <result column="merch_name" property="merchName" jdbcType="VARCHAR" />
  73. <result property="cashFee" column="cash_fee"/>
  74. <result property="cashFeeType" column="cash_fee_type"/>
  75. <result property="totalFee" column="total_fee"/>
  76. <result property="feeType" column="fee_type"/>
  77. <result property="rate" column="rate"/>
  78. </resultMap>
  79. <select id="queryObject" resultMap="orderMap">
  80. select a.*,b.latitude,b.longitude
  81. from mall_order a
  82. left join mall_address b on a.address_id = b.id
  83. where a.id = #{value}
  84. </select>
  85. <select id="queryObjectByOrderSn" resultMap="orderMap">
  86. select a.*,b.latitude,b.longitude
  87. from mall_order a
  88. left join mall_address b on a.address_id = b.id
  89. where a.order_sn = #{order_sn}
  90. </select>
  91. <select id="queryList" resultMap="orderMap">
  92. select a.*,b.latitude,b.longitude,s.store_name,f.refund_status,f.approval_remark,m.merch_name
  93. from mall_order a
  94. left join mall_merch m on a.merch_sn = m.merch_sn
  95. left join mall_address b on a.address_id = b.id
  96. left join mall_store s on a.store_id = s.id
  97. left join mall_order_refund f on a.id = f.order_id
  98. <where>
  99. <if test="user_id != null">
  100. and a.user_id = #{user_id}
  101. </if>
  102. <if test="pay_status != null">
  103. and a.pay_status = #{pay_status}
  104. </if>
  105. <if test="shipping_status != null">
  106. and a.shipping_status = #{shipping_status}
  107. </if>
  108. <if test="order_status != null and order_status != 0">
  109. and a.order_status = #{order_status}
  110. </if>
  111. <if test="order_status == 0 ">
  112. and a.order_status in (0,100)
  113. </if>
  114. <if test="evaluate_status != null and evaluate_status != 0 ">
  115. and a.comment_count <![CDATA[ >= ]]> 1
  116. </if>
  117. <if test="evaluate_status != null and evaluate_status == 0 ">
  118. and a.comment_count <![CDATA[ < ]]> 1
  119. </if>
  120. <if test="startDate!=null and startDate!=''">
  121. AND a.add_time >= #{startDate}
  122. </if>
  123. <if test="endDate!=null and endDate!=''">
  124. AND a.add_time <![CDATA[ < ]]> #{endDate}
  125. </if>
  126. <if test="shippingId!=null and shippingId!=''">
  127. AND a.shipping_id = #{shippingId}
  128. </if>
  129. </where>
  130. <if test="order_status != 401">
  131. <choose>
  132. <when test="sidx != null and sidx.trim() != ''">
  133. order by ${sidx} ${order}
  134. </when>
  135. <otherwise>
  136. order by a.id desc
  137. </otherwise>
  138. </choose>
  139. </if>
  140. <if test="order_status == 401">
  141. order by f.refund_time desc
  142. </if>
  143. <if test="offset != null and limit != null">
  144. limit #{offset}, #{limit}
  145. </if>
  146. </select>
  147. <select id="queryTotal" resultType="int">
  148. select count(id) from mall_order a
  149. <where>
  150. <if test="user_id != null">
  151. and a.user_id = #{user_id}
  152. </if>
  153. <if test="pay_status != null">
  154. and a.pay_status = #{pay_status}
  155. </if>
  156. <if test="shipping_status != null">
  157. and a.shipping_status = #{shipping_status}
  158. </if>
  159. <if test="evaluate_status != null and evaluate_status != 0 ">
  160. and a.comment_count <![CDATA[ >= ]]> 1
  161. </if>
  162. <if test="evaluate_status != null and evaluate_status == 0 ">
  163. and a.comment_count <![CDATA[ < ]]> 1
  164. </if>
  165. <if test="startDate!=null and startDate!=''">
  166. AND a.add_time >= #{startDate}
  167. </if>
  168. <if test="endDate!=null and endDate!=''">
  169. AND a.add_time <![CDATA[ < ]]> #{endDate}
  170. </if>
  171. <if test="shippingId!=null and shippingId!=''">
  172. AND a.shipping_id = #{shippingId}
  173. </if>
  174. <if test="order_status != null">
  175. and a.order_status = #{order_status}
  176. </if>
  177. </where>
  178. </select>
  179. <insert id="save" parameterType="com.kmall.api.entity.OrderVo" useGeneratedKeys="true" keyProperty="id">
  180. insert into mall_order
  181. (
  182. `order_sn`,
  183. `user_id`,
  184. `order_status`,
  185. `shipping_status`,
  186. `shipping_code`,
  187. `pay_status`,
  188. `consignee`,
  189. `country`,
  190. `province`,
  191. `city`,
  192. `district`,
  193. `address`,
  194. `address_id`,
  195. `mobile`,
  196. `postscript`,
  197. `pay_id`,
  198. `pay_name`,
  199. `shipping_fee`,
  200. `actual_price`,
  201. `cash_fee`,
  202. `cash_fee_type`,
  203. `total_fee`,
  204. `fee_type`,
  205. `rate`,
  206. `integral`,
  207. `integral_money`,
  208. `order_price`,
  209. `goods_price`,
  210. `add_time`,
  211. `confirm_time`,
  212. `pay_time`,
  213. `freight_price`,
  214. `coupon_id`,
  215. `coupon_price`,
  216. `full_cut_price`,
  217. camp_minus_id,
  218. camp_name,
  219. `order_type`,
  220. `activity_id`,
  221. `store_id`,
  222. `delivery_date`,
  223. `delivery_remark`,
  224. `predict_time`,
  225. `coupon_name`,
  226. `comment_count`,
  227. <if test="merchSn != null" >
  228. merch_sn,
  229. </if>
  230. <if test="merchOrderSn != null" >
  231. merch_order_sn,
  232. </if>
  233. <if test="isScan != null" >
  234. is_scan,
  235. </if>
  236. <if test="isMergePay != null" >
  237. is_merge_pay,
  238. </if>
  239. <if test="orderBizType != null" >
  240. order_biz_type,
  241. </if>
  242. <if test="payTransactionId != null" >
  243. pay_transaction_id,
  244. </if>
  245. <if test="payMobile != null" >
  246. pay_mobile,
  247. </if>
  248. <if test="buyerPayCheck != null" >
  249. buyer_pay_check,
  250. </if>
  251. <if test="isOnfflineOrder != null" >
  252. `is_onffline_order`,
  253. </if>
  254. <if test="payFlag != null" >
  255. pay_flag,
  256. </if>
  257. <if test="createrSn != null" >
  258. creater_sn,
  259. </if>
  260. <if test="createTime != null" >
  261. create_time,
  262. </if>
  263. <if test="moderSn != null" >
  264. moder_sn,
  265. </if>
  266. <if test="modTime != null" >
  267. mod_time
  268. </if>
  269. )
  270. values
  271. (
  272. #{order_sn},
  273. #{user_id},
  274. #{order_status},
  275. #{shipping_status},
  276. #{shipping_code},
  277. #{pay_status},
  278. #{consignee},
  279. #{country},
  280. #{province},
  281. #{city},
  282. #{district},
  283. #{address},
  284. #{address_id},
  285. #{mobile},
  286. #{postscript},
  287. #{pay_id},
  288. #{pay_name},
  289. #{shipping_fee},
  290. #{actual_price},
  291. #{cashFee},
  292. #{cashFeeType},
  293. #{totalFee},
  294. #{feeType},
  295. #{rate},
  296. #{integral},
  297. #{integral_money},
  298. #{order_price},
  299. #{goods_price},
  300. now(),
  301. #{confirm_time},
  302. #{pay_time},
  303. #{freight_price},
  304. #{coupon_id},
  305. #{coupon_price},
  306. #{full_cut_price},
  307. #{campMinusId},
  308. #{campName},
  309. #{order_type},
  310. #{activity_id},
  311. #{store_id},
  312. #{delivery_date},
  313. #{delivery_remark},
  314. #{predict_time},
  315. #{coupon_name},
  316. #{comment_count},
  317. <if test="merchSn != null" >
  318. #{merchSn},
  319. </if>
  320. <if test="merchOrderSn != null" >
  321. #{merchOrderSn},
  322. </if>
  323. <if test="isScan != null" >
  324. #{isScan},
  325. </if>
  326. <if test="isMergePay != null" >
  327. #{isMergePay},
  328. </if>
  329. <if test="orderBizType != null" >
  330. #{orderBizType,jdbcType=CHAR},
  331. </if>
  332. <if test="payTransactionId != null" >
  333. #{payTransactionId},
  334. </if>
  335. <if test="payMobile != null" >
  336. #{payMobile},
  337. </if>
  338. <if test="buyerPayCheck != null" >
  339. #{buyerPayCheck},
  340. </if>
  341. <if test="isOnfflineOrder != null" >
  342. #{isOnfflineOrder},
  343. </if>
  344. <if test="payFlag != null" >
  345. #{payFlag},
  346. </if>
  347. <if test="createrSn != null" >
  348. #{createrSn},
  349. </if>
  350. <if test="createTime != null" >
  351. #{createTime},
  352. </if>
  353. <if test="moderSn != null" >
  354. #{moderSn},
  355. </if>
  356. <if test="modTime != null" >
  357. #{modTime}
  358. </if>
  359. )
  360. </insert>
  361. <select id="queryObjectByIdList" resultMap="orderMap">
  362. select a.*
  363. from mall_order a
  364. where a.id in
  365. <foreach collection="orderIdList" item="orderId" open="(" close=")" separator=",">
  366. #{orderId}
  367. </foreach>
  368. </select>
  369. <insert id="saveBatch" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id">
  370. insert into mall_order
  371. (
  372. `order_sn`,
  373. `user_id`,
  374. `order_status`,
  375. `shipping_status`,
  376. `shipping_code`,
  377. `pay_status`,
  378. `consignee`,
  379. `country`,
  380. `province`,
  381. `city`,
  382. `district`,
  383. `address`,
  384. `address_id`,
  385. `mobile`,
  386. `postscript`,
  387. `pay_id`,
  388. `pay_name`,
  389. `shipping_fee`,
  390. `actual_price`,
  391. `cash_fee`,
  392. `cash_fee_type`,
  393. `total_fee`,
  394. `fee_type`,
  395. `rate`,
  396. `integral`,
  397. `integral_money`,
  398. `order_price`,
  399. `goods_price`,
  400. `add_time`,
  401. `confirm_time`,
  402. `pay_time`,
  403. `freight_price`,
  404. `coupon_id`,
  405. `coupon_price`,
  406. `full_cut_price`,
  407. `camp_minus_id`,
  408. `camp_name`,
  409. `order_type`,
  410. `activity_id`,
  411. `store_id`,
  412. `delivery_date`,
  413. `delivery_remark`,
  414. `predict_time`,
  415. `coupon_name`,
  416. `comment_count`,
  417. merch_sn,
  418. merch_order_sn,
  419. is_scan,
  420. is_merge_pay,
  421. order_biz_type,
  422. `is_onffline_order`,
  423. pay_transaction_id,
  424. pay_mobile,
  425. create_time,
  426. mod_time
  427. )
  428. values
  429. <foreach collection="list" index="index" item="orderInfo" separator=",">
  430. (
  431. #{orderInfo.order_sn},
  432. #{orderInfo.user_id},
  433. #{orderInfo.order_status},
  434. #{orderInfo.shipping_status},
  435. #{orderInfo.shipping_code},
  436. #{orderInfo.pay_status},
  437. #{orderInfo.consignee},
  438. #{orderInfo.country},
  439. #{orderInfo.province},
  440. #{orderInfo.city},
  441. #{orderInfo.district},
  442. #{orderInfo.address},
  443. #{orderInfo.address_id},
  444. #{orderInfo.mobile},
  445. #{orderInfo.postscript},
  446. #{orderInfo.pay_id},
  447. #{orderInfo.pay_name},
  448. #{orderInfo.shipping_fee},
  449. #{orderInfo.actual_price},
  450. #{orderInfo.cashFee},
  451. #{orderInfo.cashFeeType},
  452. #{orderInfo.totalFee},
  453. #{orderInfo.feeType},
  454. #{orderInfo.rate},
  455. #{orderInfo.integral},
  456. #{orderInfo.integral_money},
  457. #{orderInfo.order_price},
  458. #{orderInfo.goods_price},
  459. now(),
  460. #{orderInfo.confirm_time},
  461. #{orderInfo.pay_time},
  462. #{orderInfo.freight_price},
  463. #{orderInfo.coupon_id},
  464. #{orderInfo.coupon_price},
  465. #{orderInfo.full_cut_price},
  466. #{orderInfo.campMinusId},
  467. #{orderInfo.campName},
  468. #{orderInfo.order_type},
  469. #{orderInfo.activity_id},
  470. #{orderInfo.store_id},
  471. #{orderInfo.delivery_date},
  472. #{orderInfo.delivery_remark},
  473. #{orderInfo.predict_time},
  474. #{orderInfo.coupon_name},
  475. #{orderInfo.comment_count},
  476. #{orderInfo.merchSn},
  477. #{orderInfo.merchOrderSn},
  478. #{orderInfo.isScan},
  479. #{orderInfo.isMergePay},
  480. #{orderInfo.orderBizType,jdbcType=CHAR},
  481. #{orderInfo.isOnfflineOrder},
  482. #{orderInfo.payTransactionId},
  483. #{orderInfo.payMobile},
  484. #{orderInfo.createTime},
  485. #{orderInfo.modTime}
  486. )
  487. </foreach>
  488. </insert>
  489. <update id="update" parameterType="com.kmall.api.entity.OrderVo">
  490. update mall_order
  491. <set>
  492. <if test="order_sn != null">`order_sn` = #{order_sn},</if>
  493. <if test="user_id != null">`user_id` = #{user_id},</if>
  494. <if test="order_status != null">`order_status` = #{order_status},</if>
  495. <if test="shipping_status != null">`shipping_status` = #{shipping_status},</if>
  496. <if test="shipping_code != null">`shipping_code` = #{shipping_code},</if>
  497. <if test="pay_status != null">`pay_status` = #{pay_status},</if>
  498. <if test="consignee != null">`consignee` = #{consignee},</if>
  499. <if test="country != null">`country` = #{country},</if>
  500. <if test="province != null">`province` = #{province},</if>
  501. <if test="city != null">`city` = #{city},</if>
  502. <if test="district != null">`district` = #{district},</if>
  503. <if test="address != null">`address` = #{address},</if>
  504. <if test="address_id != null">`address_id` = #{address_id},</if>
  505. <if test="mobile != null">`mobile` = #{mobile},</if>
  506. <if test="postscript != null">`postscript` = #{postscript},</if>
  507. <if test="shipping_id != null">`shipping_id` = #{shipping_id},</if>
  508. <if test="shipping_name != null">`shipping_name` = #{shipping_name},</if>
  509. <if test="shipping_fee != null">`shipping_fee` = #{shipping_fee},</if>
  510. <if test="shipping_no != null">`shipping_no` = #{shipping_no},</if>
  511. <if test="pay_id != null">`pay_id` = #{pay_id},</if>
  512. <if test="pay_name != null">`pay_name` = #{pay_name},</if>
  513. <if test="pay_time != null">`pay_time` = #{pay_time},</if>
  514. <if test="actual_price != null">`actual_price` = #{actual_price},</if>
  515. <if test="cashFee != null">`cash_fee` = #{cashFee}, </if>
  516. <if test="cashFeeType != null">`cash_fee_type` = #{cashFeeType}, </if>
  517. <if test="totalFee != null">`total_fee` = #{totalFee}, </if>
  518. <if test="feeType != null">`fee_type` = #{feeType}, </if>
  519. <if test="rate != null">`rate` = #{rate}, </if>
  520. <if test="integral != null">`integral` = #{integral},</if>
  521. <if test="integral_money != null">`integral_money` = #{integral_money},</if>
  522. <if test="order_price != null">`order_price` = #{order_price},</if>
  523. <if test="goods_price != null">`goods_price` = #{goods_price},</if>
  524. <if test="confirm_time != null">`confirm_time` = #{confirm_time},</if>
  525. <if test="freight_price != null">`freight_price` = #{freight_price},</if>
  526. <if test="coupon_id != null">`coupon_id` = #{coupon_id},</if>
  527. <if test="coupon_price != null">`coupon_price` = #{coupon_price},</if>
  528. <if test="full_cut_price != null">`full_cut_price` = #{full_cut_price},</if>
  529. <if test="campMinusId != null">`camp_minus_id` = #{campMinusId},</if>
  530. <if test="campName != null">`camp_name` = #{campName},</if>
  531. <if test="order_type != null">`order_type` = #{order_type},</if>
  532. <if test="activity_id != null">`activity_id` = #{activity_id},</if>
  533. <if test="store_id != null">`store_id` = #{store_id},</if>
  534. <if test="shipping_mobile != null">`shipping_mobile` = #{shipping_mobile},</if>
  535. <if test="delivery_date != null">`delivery_date` = #{delivery_date},</if>
  536. <if test="delivery_remark != null">`delivery_remark` = #{delivery_remark},</if>
  537. <if test="predict_time != null">`predict_time` = #{predict_time},</if>
  538. <if test="coupon_name != null">`coupon_name` = #{coupon_name},</if>
  539. <if test="comment_count != null">`comment_count` = #{comment_count},</if>
  540. <if test="merchSn != null" >merch_sn = #{merchSn},</if>
  541. <if test="merchOrderSn != null" >merch_order_sn = #{merchOrderSn},</if>
  542. <if test="isScan != null" >is_scan = #{isScan},</if>
  543. <if test="isMergePay != null" >is_merge_pay = #{isMergePay},</if>
  544. <if test="orderBizType != null" >order_biz_type = #{orderBizType,jdbcType=CHAR},</if>
  545. <if test="payTransactionId != null" >pay_transaction_id = #{payTransactionId},</if>
  546. <if test="payMobile != null" >pay_mobile = #{payMobile},</if>
  547. <if test="buyerPayCheck != null" >buyer_pay_check = #{buyerPayCheck},</if>
  548. <if test="payFlag != null" >pay_flag = #{payFlag},</if>
  549. <if test="createrSn != null" >creater_sn = #{createrSn},</if>
  550. <if test="createTime != null" >create_time = #{createTime},</if>
  551. <if test="moderSn != null" >moder_sn = #{moderSn},</if>
  552. <if test="modTime != null" >mod_time = #{modTime},</if>
  553. </set>
  554. where id = #{id}
  555. </update>
  556. <update id="updateBatch" parameterType="java.util.List">
  557. <foreach collection="list" item="oderInfo" index="index" open="" close="" separator=";">
  558. update mall_order
  559. <set>
  560. <if test="oderInfo.order_sn != null">`order_sn` = #{oderInfo.order_sn},</if>
  561. <if test="oderInfo.user_id != null">`user_id` = #{oderInfo.user_id},</if>
  562. <if test="oderInfo.order_status != null">`order_status` = #{oderInfo.order_status},</if>
  563. <if test="oderInfo.shipping_status != null">`shipping_status` = #{oderInfo.shipping_status},</if>
  564. <if test="oderInfo.shipping_code != null">`shipping_code` = #{oderInfo.shipping_code},</if>
  565. <if test="oderInfo.pay_status != null">`pay_status` = #{oderInfo.pay_status},</if>
  566. <if test="oderInfo.consignee != null">`consignee` = #{oderInfo.consignee},</if>
  567. <if test="oderInfo.country != null">`country` = #{oderInfo.country},</if>
  568. <if test="oderInfo.province != null">`province` = #{oderInfo.province},</if>
  569. <if test="oderInfo.city != null">`city` = #{oderInfo.city},</if>
  570. <if test="oderInfo.district != null">`district` = #{oderInfo.district},</if>
  571. <if test="oderInfo.address != null">`address` = #{oderInfo.address},</if>
  572. <if test="oderInfo.address_id != null">`address_id` = #{oderInfo.address_id},</if>
  573. <if test="oderInfo.mobile != null">`mobile` = #{oderInfo.mobile},</if>
  574. <if test="oderInfo.postscript != null">`postscript` = #{oderInfo.postscript},</if>
  575. <if test="oderInfo.shipping_id != null">`shipping_id` = #{oderInfo.shipping_id},</if>
  576. <if test="oderInfo.shipping_name != null">`shipping_name` = #{oderInfo.shipping_name},</if>
  577. <if test="oderInfo.shipping_fee != null">`shipping_fee` = #{oderInfo.shipping_fee},</if>
  578. <if test="oderInfo.shipping_no != null">`shipping_no` = #{oderInfo.shipping_no},</if>
  579. <if test="oderInfo.pay_id != null">`pay_id` = #{oderInfo.pay_id},</if>
  580. <if test="oderInfo.pay_name != null">`pay_name` = #{oderInfo.pay_name},</if>
  581. <if test="oderInfo.pay_time != null">`pay_time` = #{oderInfo.pay_time},</if>
  582. <if test="oderInfo.actual_price != null">`actual_price` = #{oderInfo.actual_price},</if>
  583. <if test="oderInfo.integral != null">`integral` = #{oderInfo.integral},</if>
  584. <if test="oderInfo.integral_money != null">`integral_money` = #{oderInfo.integral_money},</if>
  585. <if test="oderInfo.order_price != null">`order_price` = #{oderInfo.order_price},</if>
  586. <if test="oderInfo.goods_price != null">`goods_price` = #{oderInfo.goods_price},</if>
  587. <if test="oderInfo.confirm_time != null">`confirm_time` = #{oderInfo.confirm_time},</if>
  588. <if test="oderInfo.freight_price != null">`freight_price` = #{oderInfo.freight_price},</if>
  589. <if test="oderInfo.coupon_id != null">`coupon_id` = #{oderInfo.coupon_id},</if>
  590. <if test="oderInfo.coupon_price != null">`coupon_price` = #{oderInfo.coupon_price},</if>
  591. <if test="oderInfo.full_cut_price != null">`full_cut_price` = #{oderInfo.full_cut_price},</if>
  592. <if test="oderInfo.campMinusId != null">`camp_minus_id` = #{oderInfo.campMinusId},</if>
  593. <if test="oderInfo.campName != null">`camp_name` = #{oderInfo.campName},</if>
  594. <if test="oderInfo.order_type != null">`order_type` = #{oderInfo.order_type},</if>
  595. <if test="oderInfo.activity_id != null">`activity_id` = #{oderInfo.activity_id},</if>
  596. <if test="oderInfo.store_id != null">`store_id` = #{oderInfo.store_id},</if>
  597. <if test="oderInfo.shipping_mobile != null">`shipping_mobile` = #{oderInfo.shipping_mobile},</if>
  598. <if test="oderInfo.delivery_date != null">`delivery_date` = #{oderInfo.delivery_date},</if>
  599. <if test="oderInfo.delivery_remark != null">`delivery_remark` = #{oderInfo.delivery_remark},</if>
  600. <if test="oderInfo.predict_time != null">`predict_time` = #{oderInfo.predict_time},</if>
  601. <if test="oderInfo.coupon_name != null">`coupon_name` = #{oderInfo.coupon_name},</if>
  602. <if test="oderInfo.comment_count != null">`comment_count` = #{oderInfo.comment_count},</if>
  603. <if test="oderInfo.merchSn != null" >merch_sn = #{oderInfo.merchSn},</if>
  604. <if test="oderInfo.merchOrderSn != null" >merch_order_sn = #{oderInfo.merchOrderSn},</if>
  605. <if test="oderInfo.isScan != null" >is_scan = #{oderInfo.isScan},</if>
  606. <if test="oderInfo.isMergePay != null" >is_merge_pay = #{oderInfo.isMergePay},</if>
  607. <if test="oderInfo.orderBizType != null" >order_biz_type = #{oderInfo.orderBizType},</if>
  608. <if test="oderInfo.payTransactionId != null" >pay_transaction_id = #{oderInfo.payTransactionId},</if>
  609. <if test="oderInfo.payMobile != null" >pay_mobile = #{oderInfo.payMobile},</if>
  610. <if test="oderInfo.buyerPayCheck != null" >buyer_pay_check = #{oderInfo.buyerPayCheck},</if>
  611. <if test="oderInfo.payFlag != null" >pay_flag = #{oderInfo.payFlag},</if>
  612. <if test="oderInfo.createrSn != null" >creater_sn = #{oderInfo.createrSn},</if>
  613. <if test="oderInfo.createTime != null" >create_time = #{oderInfo.createTime},</if>
  614. <if test="oderInfo.moderSn != null" >moder_sn = #{oderInfo.moderSn},</if>
  615. <if test="oderInfo.modTime != null" >mod_time = #{oderInfo.modTime},</if>
  616. </set>
  617. where id = #{oderInfo.id}
  618. </foreach>
  619. </update>
  620. <update id="riderOrderUpdate" parameterType="com.kmall.api.entity.OrderVo">
  621. update mall_order
  622. <set>
  623. `order_status` = #{order_status},
  624. `shipping_status` = #{shipping_status},
  625. `shipping_code` = #{shipping_code},
  626. `shipping_id` = #{shipping_id},
  627. `shipping_name` = #{shipping_name},
  628. `shipping_fee` = #{shipping_fee},
  629. `shipping_no` = #{shipping_no},
  630. `shipping_mobile` = #{shipping_mobile}
  631. </set>
  632. where id = #{id}
  633. </update>
  634. <update id="updateOrderByMerchOrderSn" parameterType="com.kmall.api.entity.OrderVo">
  635. update mall_order
  636. <set>
  637. <if test="order_sn != null">`order_sn` = #{order_sn},</if>
  638. <if test="user_id != null">`user_id` = #{user_id},</if>
  639. <if test="order_status != null">`order_status` = #{order_status},</if>
  640. <if test="shipping_status != null">`shipping_status` = #{shipping_status},</if>
  641. <if test="shipping_code != null">`shipping_code` = #{shipping_code},</if>
  642. <if test="pay_status != null">`pay_status` = #{pay_status},</if>
  643. <if test="consignee != null">`consignee` = #{consignee},</if>
  644. <if test="country != null">`country` = #{country},</if>
  645. <if test="province != null">`province` = #{province},</if>
  646. <if test="city != null">`city` = #{city},</if>
  647. <if test="district != null">`district` = #{district},</if>
  648. <if test="address != null">`address` = #{address},</if>
  649. <if test="address_id != null">`address_id` = #{address_id},</if>
  650. <if test="mobile != null">`mobile` = #{mobile},</if>
  651. <if test="postscript != null">`postscript` = #{postscript},</if>
  652. <if test="shipping_id != null">`shipping_id` = #{shipping_id},</if>
  653. <if test="shipping_name != null">`shipping_name` = #{shipping_name},</if>
  654. <if test="shipping_fee != null">`shipping_fee` = #{shipping_fee},</if>
  655. <if test="shipping_no != null">`shipping_no` = #{shipping_no},</if>
  656. <if test="pay_id != null">`pay_id` = #{pay_id},</if>
  657. <if test="pay_name != null">`pay_name` = #{pay_name},</if>
  658. <if test="pay_time != null">`pay_time` = #{pay_time},</if>
  659. <if test="actual_price != null">`actual_price` = #{actual_price},</if>
  660. <if test="integral != null">`integral` = #{integral},</if>
  661. <if test="integral_money != null">`integral_money` = #{integral_money},</if>
  662. <if test="order_price != null">`order_price` = #{order_price},</if>
  663. <if test="goods_price != null">`goods_price` = #{goods_price},</if>
  664. <if test="confirm_time != null">`confirm_time` = #{confirm_time},</if>
  665. <if test="freight_price != null">`freight_price` = #{freight_price},</if>
  666. <if test="coupon_id != null">`coupon_id` = #{coupon_id},</if>
  667. <if test="coupon_price != null">`coupon_price` = #{coupon_price},</if>
  668. <if test="full_cut_price != null">`full_cut_price` = #{full_cut_price},</if>
  669. <if test="campMinusId != null">`camp_minus_id` = #{campMinusId},</if>
  670. <if test="campName != null">`camp_name` = #{campName},</if>
  671. <if test="order_type != null">`order_type` = #{order_type},</if>
  672. <if test="activity_id != null">`activity_id` = #{activity_id},</if>
  673. <if test="store_id != null">`store_id` = #{store_id},</if>
  674. <if test="shipping_mobile != null">`shipping_mobile` = #{shipping_mobile},</if>
  675. <if test="delivery_date != null">`delivery_date` = #{delivery_date},</if>
  676. <if test="delivery_remark != null">`delivery_remark` = #{delivery_remark},</if>
  677. <if test="predict_time != null">`predict_time` = #{predict_time},</if>
  678. <if test="coupon_name != null">`coupon_name` = #{coupon_name},</if>
  679. <if test="comment_count != null">`comment_count` = #{comment_count},</if>
  680. <if test="merchSn != null" >merch_sn = #{merchSn},</if>
  681. <if test="isScan != null" >is_scan = #{isScan},</if>
  682. <if test="isMergePay != null" >is_merge_pay = #{isMergePay},</if>
  683. <if test="orderBizType != null" >order_biz_type = #{orderBizType,jdbcType=CHAR},</if>
  684. <if test="payTransactionId != null" >pay_transaction_id = #{payTransactionId},</if>
  685. <if test="payMobile != null" >pay_mobile = #{payMobile},</if>
  686. <if test="buyerPayCheck != null" >buyer_pay_check = #{buyerPayCheck},</if>
  687. <if test="payFlag != null" >pay_flag = #{payFlag},</if>
  688. <if test="createrSn != null" >creater_sn = #{createrSn},</if>
  689. <if test="createTime != null" >create_time = #{createTime},</if>
  690. <if test="moderSn != null" >moder_sn = #{moderSn},</if>
  691. <if test="modTime != null" >mod_time = #{modTime},</if>
  692. </set>
  693. where merch_order_sn = #{merchOrderSn}
  694. </update>
  695. <select id="queryUcenterMap" resultType="map">
  696. select count(a.id) as orders, sum(case a.order_status when 0 then 1 else 0 end ) as unPayNum, sum(case a.order_status when 300 then 1 else 0 end ) as unTakeNum
  697. ,sum(case a.order_status when 201 then 1 else 0 end ) as unPaymentNum,
  698. sum(case a.order_status when 301 then 1 else 0 end and case a.comment_count when 0 then 1 else 0 end ) as unEvalNum
  699. from mall_order a
  700. left join mall_comment b on a.id = b.order_id
  701. where 1 = 1
  702. <if test="user_id != null">
  703. and a.user_id = #{user_id}
  704. </if>
  705. <if test="pay_status != null">
  706. and a.pay_status = #{pay_status}
  707. </if>
  708. <if test="shipping_status != null">
  709. and a.shipping_status = #{shipping_status}
  710. </if>
  711. <if test="evaluate_status != null and evaluate_status == 0 ">
  712. and not exists (select 1 from mall_comment m where a.id = m.order_id )
  713. </if>
  714. <if test="startDate!=null and startDate!=''">
  715. AND a.add_time >= #{startDate}
  716. </if>
  717. <if test="endDate!=null and endDate!=''">
  718. AND a.add_time <![CDATA[ < ]]> #{endDate}
  719. </if>
  720. <if test="shippingId!=null and shippingId!=''">
  721. AND a.shipping_id <![CDATA[ < ]]> #{shippingId}
  722. </if>
  723. </select>
  724. <select id="queryObjectByMerchOrderSn" resultMap="orderMap">
  725. select a.*
  726. from mall_order a
  727. where a.merch_order_sn = #{merchOrderSn}
  728. </select>
  729. <select id="queryCountByMerchOrderSn" resultType="java.lang.Integer">
  730. select count(*)
  731. from mall_order a
  732. where a.merch_order_sn = #{merchOrderSn}
  733. </select>
  734. <select id="queryOrderByMerchOrderSnAndRefundStatus" resultMap="orderMap">
  735. select * from mall_order o inner join mall_order_refund r on r.order_id = o.id where o.merch_order_sn = #{merchOrderSn}
  736. and r.refund_status = 2
  737. </select>
  738. <select id="querySubmitNumByStoreTopicId" resultType="com.kmall.api.entity.OrderVo">
  739. SELECT
  740. cc.user_id
  741. FROM
  742. mall_user_coupon cc
  743. LEFT JOIN mall_store_topic s ON cc.store_topic_id = s.id
  744. LEFT JOIN mall_order a ON a.coupon_id = cc.id
  745. where s.id = #{storeTopicId}
  746. GROUP BY cc.user_id
  747. </select>
  748. <select id="querySubmitOrderNumByStoreTopicId" resultType="java.lang.Integer">
  749. SELECT COUNT(*)
  750. FROM
  751. mall_order
  752. WHERE
  753. activity_id = #{storeTopicId}
  754. </select>
  755. <select id="queryTopicNumByTopicIdAndUserId" resultType="java.lang.Integer">
  756. SELECT COUNT(*)
  757. FROM
  758. mall_order
  759. WHERE
  760. activity_id = #{storeTopicId} and user_id = #{userId}
  761. AND order_status != '101'
  762. </select>
  763. </mapper>