QzOrderMapper.xml 6.6 KB

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