QzOrderMapper.xml 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  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 AND a.is_onffline_order = 0
  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 -15 MINUTE)
  36. AND a.order_status = 0 and a.order_type = 1 AND a.is_onffline_order = 0
  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
  49. or f.refund_time is null or f.wechat_refund_status_des is null) and a.order_status = '401' and f.refund_status
  50. in (2,5) AND a.is_onffline_order = 0
  51. </select>
  52. <select id="queryPayingOrderList" resultType="map">
  53. select a.pay_transaction_id,a.order_sn,a.order_status,a.pay_status,a.id 'order_id',a.merch_order_sn,date_format(a.add_time,'%Y-%m-%d %H:%i:%s') as add_time,
  54. b.product_id,b.number,c.stock_num,c.id as storeRelaId
  55. from mall_order a
  56. LEFT JOIN mall_order_goods b ON a.id = b.order_id
  57. LEFT JOIN mall_product_store_rela c ON b.product_id = c.product_id
  58. AND c.store_id = a.store_id where (a.order_status in ('100','201') and a.pay_status in (1,2))
  59. and (a.pay_transaction_id = '' or a.pay_transaction_id is null or a.pay_time is null or a.pay_time = '')
  60. AND a.is_onffline_order = 0
  61. </select>
  62. <update id="updateOrderInfo" parameterType="map">
  63. UPDATE mall_order a
  64. <set>
  65. <if test="orderStatus != null">a.order_status = #{orderStatus},</if>
  66. <if test="payStatus != null">a.pay_status = #{payStatus},</if>
  67. <if test="payTransactionId != null">a.pay_transaction_id = #{payTransactionId},</if>
  68. <if test="payTime != null">a.pay_time = #{payTime},</if>
  69. </set>
  70. WHERE 1 = 1
  71. AND a.id = #{orderId}
  72. </update>
  73. <update id="updateOrderRefund" parameterType="map">
  74. UPDATE mall_order_refund a
  75. <set>
  76. <if test="refundId != null">a.refund_id = #{refundId},</if>
  77. <if test="refundMoney != null">a.refund_money = #{refundMoney},</if>
  78. <if test="refundStatus != null">a.refund_status = #{refundStatus},</if>
  79. <if test="refundRecvAccout != null">a.refund_recv_accout = #{refundRecvAccout},</if>
  80. <if test="refundTime != null">a.refund_time = #{refundTime},</if>
  81. <if test="wechat_refund_status_des != null">a.wechat_refund_status_des = #{wechat_refund_status_des},</if>
  82. </set>
  83. WHERE 1 = 1
  84. AND a.out_refund_no = #{orderRefundId}
  85. </update>
  86. <select id="queryShipmentOrderList" resultType="map">
  87. SELECT a.order_sn,a.order_status,a.pay_status,a.id 'orderId',a.merch_order_sn,date_format(r.customs_succ_time,'%Y-%m-%d %H:%i:%s') as customs_succ_time
  88. FROM `mall_order` a inner join mall_order_process_record r on a.order_sn=r.order_sn where order_status='300'
  89. and shipping_status ='1' and a.order_biz_type in(10,02) AND r.customs_succ_time <![CDATA[ < ]]> DATE_ADD(now(),INTERVAL -7 DAY) AND a.is_onffline_order = 0
  90. </select>
  91. <select id="queryShipmentBondedOrderList" resultType="map">
  92. SELECT a.order_sn,a.order_status,a.pay_status,a.id 'orderId',a.merch_order_sn,date_format(r.shipment_succ_time,'%Y-%m-%d %H:%i:%s') as shipment_succ_time
  93. FROM `mall_order` a inner join mall_order_process_record r on a.order_sn=r.order_sn where order_status='300' and shipping_status ='1'
  94. and a.order_biz_type in(00,11) AND r.shipment_succ_time <![CDATA[ < ]]> DATE_ADD(now(),INTERVAL -7 DAY) AND a.is_onffline_order = 0
  95. </select>
  96. <update id="updateShipmentOrder" parameterType="map">
  97. update mall_order set order_status ='301', shipping_status='2',confirm_time=now() where id=#{orderId}
  98. </update>
  99. <select id="queryReceiptOrderList" resultType="map">
  100. select o.user_id 'userId',o.id 'orderId',g.product_id'productId',g.goods_specification_name_value 'goodsSpecificationNameValue', g.goods_id 'goodsId',
  101. g.goods_name 'goodsName',confirm_time FROM `mall_order` o inner join mall_order_goods g on o.id = g.order_id
  102. where order_status='301' and shipping_status ='2' and comment_count=0 AND confirm_time <![CDATA[ < ]]> DATE_ADD(now(),INTERVAL -30 DAY) AND o.is_onffline_order = 0
  103. </select>
  104. <update id="updateReceiptOrderByCommentCount">
  105. update mall_order set comment_count = 1 where
  106. order_status='301' and shipping_status ='2' and comment_count=0 AND confirm_time <![CDATA[ < ]]> DATE_ADD(now(),INTERVAL -30 DAY)
  107. </update>
  108. <update id="insertComment" parameterType="map">
  109. insert into mall_comment(
  110. `type_id`,
  111. `value_id`,
  112. `user_id`,
  113. `order_id`,
  114. `product_id`,
  115. `goods_specification_name_value`,
  116. `status`,
  117. `content`,
  118. `eval_level`,
  119. `value_name`,
  120. `goods_level`,
  121. `create_time`,
  122. `mod_time`)
  123. values(
  124. #{typeId},
  125. #{valueId},
  126. #{userId},
  127. #{orderId},
  128. #{productId},
  129. #{goodsSpecificationNameValue},
  130. #{status},
  131. #{content},
  132. #{evalLevel},
  133. #{valueName},
  134. #{goodsLevel},
  135. #{createTime},
  136. #{modTime})
  137. </update>
  138. </mapper>