1
0

ApiOrderMapper.xml 23 KB

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