BrokerageUserMapper.xml 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  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="cn.newfeifan.mall.module.trade.dal.mysql.order.TradeOrderMapper">
  4. <resultMap id="BaseResultMap" type="cn.newfeifan.mall.module.distri.mq.message.order.DistriOrderMessage">
  5. <id column="totalPrice" property="totalPrice"/>
  6. <result column="price" property="price"/>
  7. <result column="productCount" property="productCount"/>
  8. <result column="costPrice" property="costPrice"/>
  9. <result column="no" property="no"/>
  10. <result column="userId" property="userId"/>
  11. <result column="shopId" property="shopId"/>
  12. <result column="merchantId" property="merchantId"/>
  13. <result column="orderId" property="orderId"/>
  14. <result column="name" property="name"/>
  15. <result column="nickName" property="nickName"/>
  16. <result column="count" property="count"/>
  17. </resultMap>
  18. <!-- 参与 冻结转可用的订单计算-->
  19. <select id="queryAllOrder" resultMap="BaseResultMap">
  20. select tor.total_price as totalPrice,
  21. ps.cost_price as costPrice,
  22. ps.price as price,
  23. tor.product_count as productCount,
  24. tor.`no` as `no`,
  25. tor.id as orderId,
  26. tor.user_id as userId,
  27. ps.merchant_id as merchantId,
  28. ps.shop_id as shopId,
  29. mu.`name` as name,
  30. mu.nickname as nickname,
  31. toi.count as `count`,
  32. toi.id as orderItemId,
  33. toi.increase_integral AS increaseIntegral,
  34. toi.ancestor_increase_integral AS ancestorIncreaseIntegral
  35. from trade_order tor
  36. LEFT JOIN member_user mu
  37. ON tor.user_id = mu.id
  38. LEFT JOIN trade_order_item toi
  39. on tor.id = toi.order_id
  40. LEFT JOIN product_sku ps
  41. on toi.sku_id = ps.id
  42. where tor.pay_status = 1
  43. and toi.distribute_benefit = 0
  44. and (toi.after_sale_status = 0 or toi.after_sale_status = 61)
  45. and tor.pay_time &lt; DATE_SUB(NOW(), INTERVAL 7 DAY)
  46. -- and tor.receiving_time &lt; DATE_SUB(NOW(), INTERVAL 7 DAY)
  47. </select>
  48. <!-- 参与合赢奖的订单-->
  49. <select id="queryDailyOrder" resultMap="BaseResultMap">
  50. select tor.total_price as totalPrice,
  51. ps.cost_price as costPrice,
  52. ps.price as price,
  53. tor.product_count as productCount,
  54. tor.`no` as `no`,
  55. tor.id as orderId,
  56. tor.user_id as userId,
  57. ps.merchant_id as merchantId,
  58. ps.shop_id as shopId,
  59. mu.`name` as name,
  60. mu.nickname as nickname,
  61. toi.count as `count`,
  62. toi.id as orderItemId,
  63. toi.increase_integral AS increaseIntegral,
  64. toi.ancestor_increase_integral AS ancestorIncreaseIntegral
  65. from trade_order tor
  66. LEFT JOIN member_user mu
  67. ON tor.user_id = mu.id
  68. LEFT JOIN trade_order_item toi
  69. on tor.id = toi.order_id
  70. LEFT JOIN product_sku ps
  71. on toi.sku_id = ps.id
  72. where tor.pay_status = 1
  73. and (toi.after_sale_status = 0 or toi.after_sale_status = 61)
  74. and toi.transition_time is null
  75. and DATE(tor.create_time) &lt; CURDATE()
  76. </select>
  77. <select id="queryAllOrderByOrderIds"
  78. resultMap="BaseResultMap">
  79. select tor.total_price as totalPrice,
  80. ps.cost_price as costPrice,
  81. ps.price as price,
  82. tor.product_count as productCount,
  83. tor.`no` as `no`,
  84. tor.id as orderId,
  85. tor.user_id as userId,
  86. ps.merchant_id as merchantId,
  87. ps.shop_id as shopId,
  88. mu.`name` as name,
  89. mu.nickname as nickname,
  90. toi.count as `count`,
  91. toi.id as orderItemId,
  92. toi.increase_integral AS increaseIntegral,
  93. toi.ancestor_increase_integral AS ancestorIncreaseIntegral
  94. from trade_order tor
  95. LEFT JOIN member_user mu
  96. ON tor.user_id = mu.id
  97. LEFT JOIN trade_order_item toi
  98. on tor.id = toi.order_id
  99. LEFT JOIN product_sku ps
  100. on toi.sku_id = ps.id
  101. <where>
  102. tor.pay_status = 1
  103. and toi.distribute_benefit = 0
  104. and (toi.after_sale_status = 0 or toi.after_sale_status = 61)
  105. and tor.receiving_time &lt; DATE_SUB(NOW(), INTERVAL 7 DAY)
  106. <if test="orderIds!=null">
  107. and tor.id in (
  108. <foreach collection="orderIds" item="orderId" separator=",">
  109. #{orderId}
  110. </foreach>
  111. )
  112. </if>
  113. </where>
  114. </select>
  115. </mapper>