QzOrderMapper.xml 3.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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.schedule.dao.QzOrderMapper">
  4. <select id="queryrderUnEvaluateList" resultType="map">
  5. SELECT
  6. a.id AS order_id,
  7. a.order_sn,
  8. c.goods_name,
  9. a.form_id,
  10. u.weixin_openid AS open_id
  11. FROM
  12. mall_order a
  13. LEFT JOIN mall_comment b ON a.id = b.order_id
  14. LEFT JOIN mall_order_goods c ON c.order_id = a.id
  15. LEFT JOIN mall_user u ON a.user_id = u.id
  16. WHERE
  17. b.id IS NULL
  18. AND a.confirm_time > date_add(now(), INTERVAL - 1 DAY)
  19. AND a.confirm_time IS NOT NULL
  20. </select>
  21. <select id="queryPastOrderList" resultType="map">
  22. SELECT b.product_id,b.number,c.stock_num,c.id as storeRelaId
  23. FROM mall_order a
  24. LEFT JOIN mall_order_goods b ON a.id = b.order_id
  25. LEFT JOIN mall_product_store_rela c ON b.product_id = c.product_id
  26. AND c.store_id = a.store_id
  27. WHERE 1 = 1
  28. AND a.add_time <![CDATA[ < ]]> DATE_ADD(now(),INTERVAL -15 MINUTE)
  29. AND a.order_status in (0,100) and a.order_type = 1
  30. </select>
  31. <update id="unpayPastUpdate">
  32. UPDATE mall_order a
  33. SET order_status=101,shipping_status=0,pay_status=0
  34. WHERE 1 = 1
  35. AND a.add_time <![CDATA[ < ]]> DATE_ADD(now(),INTERVAL -10 MINUTE)
  36. AND a.order_status = 0 and a.order_type = 1
  37. </update>
  38. <update id="updateStockNum" parameterType="map">
  39. update mall_product_store_rela a
  40. <set>
  41. <if test="stock_num != null">a.`stock_num` = #{stock_num},</if>
  42. </set>
  43. where a.id = #{id}
  44. </update>
  45. <select id="queryRefundOrderList" resultType="map">
  46. select a.pay_transaction_id,a.merch_order_sn,a.order_sn,a.order_status,a.pay_status,f.out_refund_no,f.refund_id,f.order_id,f.id 'orderRefundId'
  47. from mall_order a
  48. inner join mall_order_refund f on a.id = f.order_id where (f.out_refund_no is null or f.refund_id is null) and a.order_status != '101' and f.refund_status
  49. not in (1,3,4)
  50. </select>
  51. <select id="queryPayingOrderList" resultType="map">
  52. select a.pay_transaction_id,a.order_sn,a.order_status,a.pay_status,a.id 'order_id',a.merch_order_sn
  53. from mall_order a where (a.order_status in ('100','201') and a.pay_status in (1,2))
  54. and (a.pay_transaction_id = '' or a.pay_transaction_id is null or a.pay_time is null or a.pay_time = '')
  55. </select>
  56. <update id="updateOrderInfo" parameterType="map">
  57. UPDATE mall_order a
  58. <set>
  59. <if test="orderStatus != null">a.order_status = #{orderStatus},</if>
  60. <if test="payStatus != null">a.pay_status = #{payStatus},</if>
  61. <if test="payTransactionId != null">a.pay_transaction_id = #{payTransactionId},</if>
  62. <if test="payTime != null">a.pay_time = #{payTime},</if>
  63. </set>
  64. WHERE 1 = 1
  65. AND a.id = #{orderId}
  66. </update>
  67. <update id="updateOrderRefund" parameterType="map">
  68. UPDATE mall_order_refund a
  69. <set>
  70. <if test="outRefundNo != null">a.out_refund_no = #{outRefundNo},</if>
  71. <if test="refundId != null">a.refund_id = #{refundId},</if>
  72. <if test="refundMoney != null">a.refund_money = #{refundMoney},</if>
  73. <if test="refundStatus != null">a.refund_status = #{refundStatus},</if>
  74. <if test="refundRecvAccout != null">a.refund_recv_accout = #{refundRecvAccout},</if>
  75. <if test="refundTime != null">a.refund_time = #{refundTime},</if>
  76. </set>
  77. WHERE 1 = 1
  78. AND a.id = #{orderRefundId}
  79. </update>
  80. </mapper>