1
0

ApiOrderMapper.xml 33 KB

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