ApiOrderMapper.xml 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604
  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. </resultMap>
  70. <select id="queryObject" resultMap="orderMap">
  71. select a.*,b.latitude,b.longitude
  72. from mall_order a
  73. left join mall_address b on a.address_id = b.id
  74. where a.id = #{value}
  75. </select>
  76. <select id="queryObjectByOrderSn" resultMap="orderMap">
  77. select a.*,b.latitude,b.longitude
  78. from mall_order a
  79. left join mall_address b on a.address_id = b.id
  80. where a.order_sn = #{order_sn}
  81. </select>
  82. <select id="queryList" resultMap="orderMap">
  83. select a.*,b.latitude,b.longitude,s.store_name,f.refund_status,f.approval_remark
  84. from mall_order a
  85. left join mall_address b on a.address_id = b.id
  86. left join mall_store s on a.store_id = s.id
  87. left join mall_order_refund f on a.id = f.order_id
  88. <where>
  89. <if test="user_id != null">
  90. and a.user_id = #{user_id}
  91. </if>
  92. <if test="pay_status != null">
  93. and a.pay_status = #{pay_status}
  94. </if>
  95. <if test="shipping_status != null">
  96. and a.shipping_status = #{shipping_status}
  97. </if>
  98. <if test="order_status != null and order_status != 0">
  99. and a.order_status = #{order_status}
  100. </if>
  101. <if test="order_status == 0 ">
  102. and a.order_status in (0,100)
  103. </if>
  104. <if test="evaluate_status != null and evaluate_status != 0 ">
  105. and a.comment_count <![CDATA[ >= ]]> 1
  106. </if>
  107. <if test="evaluate_status != null and evaluate_status == 0 ">
  108. and a.comment_count <![CDATA[ < ]]> 1
  109. </if>
  110. <if test="startDate!=null and startDate!=''">
  111. AND a.add_time >= #{startDate}
  112. </if>
  113. <if test="endDate!=null and endDate!=''">
  114. AND a.add_time <![CDATA[ < ]]> #{endDate}
  115. </if>
  116. <if test="shippingId!=null and shippingId!=''">
  117. AND a.shipping_id = #{shippingId}
  118. </if>
  119. </where>
  120. <if test="order_status != 401">
  121. <choose>
  122. <when test="sidx != null and sidx.trim() != ''">
  123. order by ${sidx} ${order}
  124. </when>
  125. <otherwise>
  126. order by a.id desc
  127. </otherwise>
  128. </choose>
  129. </if>
  130. <if test="order_status == 401">
  131. order by f.refund_time desc
  132. </if>
  133. <if test="offset != null and limit != null">
  134. limit #{offset}, #{limit}
  135. </if>
  136. </select>
  137. <select id="queryTotal" resultType="int">
  138. select count(id) from mall_order a
  139. <where>
  140. <if test="user_id != null">
  141. and a.user_id = #{user_id}
  142. </if>
  143. <if test="pay_status != null">
  144. and a.pay_status = #{pay_status}
  145. </if>
  146. <if test="shipping_status != null">
  147. and a.shipping_status = #{shipping_status}
  148. </if>
  149. <if test="evaluate_status != null and evaluate_status != 0 ">
  150. and a.comment_count <![CDATA[ >= ]]> 1
  151. </if>
  152. <if test="evaluate_status != null and evaluate_status == 0 ">
  153. and a.comment_count <![CDATA[ < ]]> 1
  154. </if>
  155. <if test="startDate!=null and startDate!=''">
  156. AND a.add_time >= #{startDate}
  157. </if>
  158. <if test="endDate!=null and endDate!=''">
  159. AND a.add_time <![CDATA[ < ]]> #{endDate}
  160. </if>
  161. <if test="shippingId!=null and shippingId!=''">
  162. AND a.shipping_id = #{shippingId}
  163. </if>
  164. <if test="order_status != null">
  165. and a.order_status = #{order_status}
  166. </if>
  167. </where>
  168. </select>
  169. <insert id="save" parameterType="com.kmall.api.entity.OrderVo" useGeneratedKeys="true" keyProperty="id">
  170. insert into mall_order
  171. (
  172. `order_sn`,
  173. `user_id`,
  174. `order_status`,
  175. `shipping_status`,
  176. `shipping_code`,
  177. `pay_status`,
  178. `consignee`,
  179. `country`,
  180. `province`,
  181. `city`,
  182. `district`,
  183. `address`,
  184. `address_id`,
  185. `mobile`,
  186. `postscript`,
  187. `pay_id`,
  188. `pay_name`,
  189. `shipping_fee`,
  190. `actual_price`,
  191. `integral`,
  192. `integral_money`,
  193. `order_price`,
  194. `goods_price`,
  195. `add_time`,
  196. `confirm_time`,
  197. `pay_time`,
  198. `freight_price`,
  199. `coupon_id`,
  200. `coupon_price`,
  201. `full_cut_price`,
  202. `order_type`,
  203. `activity_id`,
  204. `store_id`,
  205. `delivery_date`,
  206. `delivery_remark`,
  207. `predict_time`,
  208. `coupon_name`,
  209. `comment_count`,
  210. <if test="merchSn != null" >
  211. merch_sn,
  212. </if>
  213. <if test="merchOrderSn != null" >
  214. merch_order_sn,
  215. </if>
  216. <if test="isScan != null" >
  217. is_scan,
  218. </if>
  219. <if test="isMergePay != null" >
  220. is_merge_pay,
  221. </if>
  222. <if test="orderBizType != null" >
  223. order_biz_type,
  224. </if>
  225. <if test="payTransactionId != null" >
  226. pay_transaction_id,
  227. </if>
  228. <if test="payMobile != null" >
  229. pay_mobile,
  230. </if>
  231. <if test="buyerPayCheck != null" >
  232. buyer_pay_check,
  233. </if>
  234. <if test="payFlag != null" >
  235. pay_flag,
  236. </if>
  237. <if test="createrSn != null" >
  238. creater_sn,
  239. </if>
  240. <if test="createTime != null" >
  241. create_time,
  242. </if>
  243. <if test="moderSn != null" >
  244. moder_sn,
  245. </if>
  246. <if test="modTime != null" >
  247. mod_time
  248. </if>
  249. )
  250. values
  251. (
  252. #{order_sn},
  253. #{user_id},
  254. #{order_status},
  255. #{shipping_status},
  256. #{shipping_code},
  257. #{pay_status},
  258. #{consignee},
  259. #{country},
  260. #{province},
  261. #{city},
  262. #{district},
  263. #{address},
  264. #{address_id},
  265. #{mobile},
  266. #{postscript},
  267. #{pay_id},
  268. #{pay_name},
  269. #{shipping_fee},
  270. #{actual_price},
  271. #{integral},
  272. #{integral_money},
  273. #{order_price},
  274. #{goods_price},
  275. now(),
  276. #{confirm_time},
  277. #{pay_time},
  278. #{freight_price},
  279. #{coupon_id},
  280. #{coupon_price},
  281. #{full_cut_price},
  282. #{order_type},
  283. #{activity_id},
  284. #{store_id},
  285. #{delivery_date},
  286. #{delivery_remark},
  287. #{predict_time},
  288. #{coupon_name},
  289. #{comment_count},
  290. <if test="merchSn != null" >
  291. #{merchSn,jdbcType=VARCHAR},
  292. </if>
  293. <if test="merchOrderSn != null" >
  294. #{merchOrderSn,jdbcType=VARCHAR},
  295. </if>
  296. <if test="isScan != null" >
  297. #{isScan,jdbcType=VARCHAR},
  298. </if>
  299. <if test="isMergePay != null" >
  300. #{isMergePay},
  301. </if>
  302. <if test="orderBizType != null" >
  303. #{orderBizType,jdbcType=CHAR},
  304. </if>
  305. <if test="payTransactionId != null" >
  306. #{payTransactionId,jdbcType=VARCHAR},
  307. </if>
  308. <if test="payMobile != null" >
  309. #{payMobile,jdbcType=VARCHAR},
  310. </if>
  311. <if test="buyerPayCheck != null" >
  312. #{buyerPayCheck,jdbcType=VARCHAR},
  313. </if>
  314. <if test="payFlag != null" >
  315. #{payFlag,jdbcType=VARCHAR},
  316. </if>
  317. <if test="createrSn != null" >
  318. #{createrSn,jdbcType=VARCHAR},
  319. </if>
  320. <if test="createTime != null" >
  321. #{createTime,jdbcType=TIMESTAMP},
  322. </if>
  323. <if test="moderSn != null" >
  324. #{moderSn,jdbcType=VARCHAR},
  325. </if>
  326. <if test="modTime != null" >
  327. #{modTime,jdbcType=TIMESTAMP}
  328. </if>
  329. )
  330. </insert>
  331. <select id="queryObjectByIdList" resultMap="orderMap">
  332. select a.*
  333. from mall_order a
  334. where a.id in
  335. <foreach collection="orderIdList" item="orderId" open="(" close=")" separator=",">
  336. #{orderId}
  337. </foreach>
  338. </select>
  339. <insert id="saveBatch" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id">
  340. insert into mall_order
  341. (
  342. `order_sn`,
  343. `user_id`,
  344. `order_status`,
  345. `shipping_status`,
  346. `shipping_code`,
  347. `pay_status`,
  348. `consignee`,
  349. `country`,
  350. `province`,
  351. `city`,
  352. `district`,
  353. `address`,
  354. `address_id`,
  355. `mobile`,
  356. `postscript`,
  357. `pay_id`,
  358. `pay_name`,
  359. `shipping_fee`,
  360. `actual_price`,
  361. `integral`,
  362. `integral_money`,
  363. `order_price`,
  364. `goods_price`,
  365. `add_time`,
  366. `confirm_time`,
  367. `pay_time`,
  368. `freight_price`,
  369. `coupon_id`,
  370. `coupon_price`,
  371. `full_cut_price`,
  372. `order_type`,
  373. `activity_id`,
  374. `store_id`,
  375. `delivery_date`,
  376. `delivery_remark`,
  377. `predict_time`,
  378. `coupon_name`,
  379. `comment_count`,
  380. merch_sn,
  381. merch_order_sn,
  382. is_scan,
  383. is_merge_pay,
  384. order_biz_type,
  385. pay_transaction_id,
  386. pay_mobile,
  387. create_time,
  388. mod_time
  389. )
  390. values
  391. <foreach collection="list" index="index" item="orderInfo" separator=",">
  392. (
  393. #{orderInfo.order_sn},
  394. #{orderInfo.user_id},
  395. #{orderInfo.order_status},
  396. #{orderInfo.shipping_status},
  397. #{orderInfo.shipping_code},
  398. #{orderInfo.pay_status},
  399. #{orderInfo.consignee},
  400. #{orderInfo.country},
  401. #{orderInfo.province},
  402. #{orderInfo.city},
  403. #{orderInfo.district},
  404. #{orderInfo.address},
  405. #{orderInfo.address_id},
  406. #{orderInfo.mobile},
  407. #{orderInfo.postscript},
  408. #{orderInfo.pay_id},
  409. #{orderInfo.pay_name},
  410. #{orderInfo.shipping_fee},
  411. #{orderInfo.actual_price},
  412. #{orderInfo.integral},
  413. #{orderInfo.integral_money},
  414. #{orderInfo.order_price},
  415. #{orderInfo.goods_price},
  416. now(),
  417. #{orderInfo.confirm_time},
  418. #{orderInfo.pay_time},
  419. #{orderInfo.freight_price},
  420. #{orderInfo.coupon_id},
  421. #{orderInfo.coupon_price},
  422. #{orderInfo.full_cut_price},
  423. #{orderInfo.order_type},
  424. #{orderInfo.activity_id},
  425. #{orderInfo.store_id},
  426. #{orderInfo.delivery_date},
  427. #{orderInfo.delivery_remark},
  428. #{orderInfo.predict_time},
  429. #{orderInfo.coupon_name},
  430. #{orderInfo.comment_count},
  431. #{orderInfo.merchSn,jdbcType=VARCHAR},
  432. #{orderInfo.merchOrderSn,jdbcType=VARCHAR},
  433. #{orderInfo.isScan,jdbcType=VARCHAR},
  434. #{orderInfo.isMergePay},
  435. #{orderInfo.orderBizType,jdbcType=CHAR},
  436. #{orderInfo.payTransactionId,jdbcType=VARCHAR},
  437. #{orderInfo.payMobile,jdbcType=VARCHAR},
  438. #{orderInfo.createTime,jdbcType=TIMESTAMP},
  439. #{orderInfo.modTime,jdbcType=TIMESTAMP}
  440. )
  441. </foreach>
  442. </insert>
  443. <update id="update" parameterType="com.kmall.api.entity.OrderVo">
  444. update mall_order
  445. <set>
  446. <if test="order_sn != null">`order_sn` = #{order_sn},</if>
  447. <if test="user_id != null">`user_id` = #{user_id},</if>
  448. <if test="order_status != null">`order_status` = #{order_status},</if>
  449. <if test="shipping_status != null">`shipping_status` = #{shipping_status},</if>
  450. <if test="shipping_code != null">`shipping_code` = #{shipping_code},</if>
  451. <if test="pay_status != null">`pay_status` = #{pay_status},</if>
  452. <if test="consignee != null">`consignee` = #{consignee},</if>
  453. <if test="country != null">`country` = #{country},</if>
  454. <if test="province != null">`province` = #{province},</if>
  455. <if test="city != null">`city` = #{city},</if>
  456. <if test="district != null">`district` = #{district},</if>
  457. <if test="address != null">`address` = #{address},</if>
  458. <if test="address_id != null">`address_id` = #{address_id},</if>
  459. <if test="mobile != null">`mobile` = #{mobile},</if>
  460. <if test="postscript != null">`postscript` = #{postscript},</if>
  461. <if test="shipping_id != null">`shipping_id` = #{shipping_id},</if>
  462. <if test="shipping_name != null">`shipping_name` = #{shipping_name},</if>
  463. <if test="shipping_fee != null">`shipping_fee` = #{shipping_fee},</if>
  464. <if test="shipping_no != null">`shipping_no` = #{shipping_no},</if>
  465. <if test="pay_id != null">`pay_id` = #{pay_id},</if>
  466. <if test="pay_name != null">`pay_name` = #{pay_name},</if>
  467. <if test="pay_time != null">`pay_time` = #{pay_time},</if>
  468. <if test="actual_price != null">`actual_price` = #{actual_price},</if>
  469. <if test="integral != null">`integral` = #{integral},</if>
  470. <if test="integral_money != null">`integral_money` = #{integral_money},</if>
  471. <if test="order_price != null">`order_price` = #{order_price},</if>
  472. <if test="goods_price != null">`goods_price` = #{goods_price},</if>
  473. <if test="confirm_time != null">`confirm_time` = #{confirm_time},</if>
  474. <if test="freight_price != null">`freight_price` = #{freight_price},</if>
  475. <if test="coupon_id != null">`coupon_id` = #{coupon_id},</if>
  476. <if test="coupon_price != null">`coupon_price` = #{coupon_price},</if>
  477. <if test="full_cut_price != null">`full_cut_price` = #{full_cut_price},</if>
  478. <if test="order_type != null">`order_type` = #{order_type},</if>
  479. <if test="activity_id != null">`activity_id` = #{activity_id},</if>
  480. <if test="store_id != null">`store_id` = #{store_id},</if>
  481. <if test="shipping_mobile != null">`shipping_mobile` = #{shipping_mobile},</if>
  482. <if test="delivery_date != null">`delivery_date` = #{delivery_date},</if>
  483. <if test="delivery_remark != null">`delivery_remark` = #{delivery_remark},</if>
  484. <if test="predict_time != null">`predict_time` = #{predict_time},</if>
  485. <if test="coupon_name != null">`coupon_name` = #{coupon_name},</if>
  486. <if test="comment_count != null">`comment_count` = #{comment_count},</if>
  487. <if test="merchSn != null" >
  488. merch_sn = #{merchSn,jdbcType=VARCHAR},
  489. </if>
  490. <if test="merchOrderSn != null" >
  491. merch_order_sn = #{merchOrderSn,jdbcType=VARCHAR},
  492. </if>
  493. <if test="isScan != null" >
  494. is_scan = #{isScan,jdbcType=VARCHAR},
  495. </if>
  496. <if test="isMergePay != null" >
  497. is_merge_pay = #{isMergePay},
  498. </if>
  499. <if test="orderBizType != null" >
  500. order_biz_type = #{orderBizType,jdbcType=CHAR},
  501. </if>
  502. <if test="payTransactionId != null" >
  503. pay_transaction_id = #{payTransactionId,jdbcType=VARCHAR},
  504. </if>
  505. <if test="payMobile != null" >
  506. pay_mobile = #{payMobile,jdbcType=VARCHAR},
  507. </if>
  508. <if test="buyerPayCheck != null" >
  509. buyer_pay_check = #{buyerPayCheck,jdbcType=VARCHAR},
  510. </if>
  511. <if test="payFlag != null" >
  512. pay_flag = #{payFlag,jdbcType=VARCHAR},
  513. </if>
  514. <if test="createrSn != null" >
  515. creater_sn = #{createrSn,jdbcType=VARCHAR},
  516. </if>
  517. <if test="createTime != null" >
  518. create_time = #{createTime,jdbcType=TIMESTAMP},
  519. </if>
  520. <if test="moderSn != null" >
  521. moder_sn = #{moderSn,jdbcType=VARCHAR},
  522. </if>
  523. <if test="modTime != null" >
  524. mod_time = #{modTime,jdbcType=TIMESTAMP},
  525. </if>
  526. </set>
  527. where id = #{id}
  528. </update>
  529. <update id="riderOrderUpdate" parameterType="com.kmall.api.entity.OrderVo">
  530. update mall_order
  531. <set>
  532. `order_status` = #{order_status},
  533. `shipping_status` = #{shipping_status},
  534. `shipping_code` = #{shipping_code},
  535. `shipping_id` = #{shipping_id},
  536. `shipping_name` = #{shipping_name},
  537. `shipping_fee` = #{shipping_fee},
  538. `shipping_no` = #{shipping_no},
  539. `shipping_mobile` = #{shipping_mobile}
  540. </set>
  541. where id = #{id}
  542. </update>
  543. <select id="queryUcenterMap" resultType="map">
  544. 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
  545. ,sum(case a.order_status when 201 then 1 else 0 end ) as unPaymentNum,
  546. 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
  547. from mall_order a
  548. left join mall_comment b on a.id = b.order_id
  549. where 1 = 1
  550. <if test="user_id != null">
  551. and a.user_id = #{user_id}
  552. </if>
  553. <if test="pay_status != null">
  554. and a.pay_status = #{pay_status}
  555. </if>
  556. <if test="shipping_status != null">
  557. and a.shipping_status = #{shipping_status}
  558. </if>
  559. <if test="evaluate_status != null and evaluate_status == 0 ">
  560. and not exists (select 1 from mall_comment m where a.id = m.order_id )
  561. </if>
  562. <if test="startDate!=null and startDate!=''">
  563. AND a.add_time >= #{startDate}
  564. </if>
  565. <if test="endDate!=null and endDate!=''">
  566. AND a.add_time <![CDATA[ < ]]> #{endDate}
  567. </if>
  568. <if test="shippingId!=null and shippingId!=''">
  569. AND a.shipping_id <![CDATA[ < ]]> #{shippingId}
  570. </if>
  571. </select>
  572. <select id="queryObjectByMerchOrderSn" resultMap="orderMap">
  573. select a.*
  574. from mall_order a
  575. where a.merch_order_sn = #{merchOrderSn}
  576. </select>
  577. <select id="queryCountByMerchOrderSn" resultType="java.lang.Integer">
  578. select count(*)
  579. from mall_order a
  580. where a.merch_order_sn = #{merchOrderSn}
  581. </select>
  582. <select id="queryOrderByMerchOrderSnAndRefundStatus" resultMap="orderMap">
  583. select * from mall_order o inner join mall_order_refund r on r.order_id = o.id where o.merch_order_sn = #{merchOrderSn}
  584. and r.refund_status = 2
  585. </select>
  586. </mapper>