BrokerageUserMapper.xml 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  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. toi.cost_price as costPrice,
  22. toi.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. toi.freeze_high_quota AS freezeHighQuota
  36. from trade_order tor
  37. LEFT JOIN member_user mu
  38. ON tor.user_id = mu.id
  39. LEFT JOIN trade_order_item toi
  40. on tor.id = toi.order_id
  41. LEFT JOIN product_sku ps
  42. on toi.sku_id = ps.id
  43. where tor.pay_status = 1
  44. and tor.deleted = 0 and toi.deleted = 0
  45. and toi.distribute_benefit = 0
  46. and (toi.after_sale_status = 0 or toi.after_sale_status = 61)
  47. and date(tor.pay_time) <![CDATA[ <= ]]> DATE_SUB(CURDATE(), INTERVAL 7 DAY)
  48. -- and date(tor.pay_time) <![CDATA[ <= ]]> DATE_SUB('2024-06-21', INTERVAL 7 DAY)
  49. -- and date(tor.pay_time) = '2024-06-20'
  50. -- and tor.receiving_time &lt; DATE_SUB(NOW(), INTERVAL 7 DAY)
  51. </select>
  52. <!-- 参与合赢奖的订单-->
  53. <select id="queryDailyOrder" resultMap="BaseResultMap">
  54. select tor.total_price as totalPrice,
  55. toi.cost_price as costPrice,
  56. toi.price as price,
  57. tor.product_count as productCount,
  58. tor.`no` as `no`,
  59. tor.id as orderId,
  60. tor.user_id as userId,
  61. ps.merchant_id as merchantId,
  62. ps.shop_id as shopId,
  63. mu.`name` as name,
  64. mu.nickname as nickname,
  65. toi.count as `count`,
  66. toi.id as orderItemId,
  67. toi.increase_integral AS increaseIntegral,
  68. toi.ancestor_increase_integral AS ancestorIncreaseIntegral
  69. from trade_order tor
  70. LEFT JOIN member_user mu
  71. ON tor.user_id = mu.id
  72. LEFT JOIN trade_order_item toi
  73. on tor.id = toi.order_id
  74. LEFT JOIN product_sku ps
  75. on toi.sku_id = ps.id
  76. where tor.pay_status = 1
  77. and tor.deleted = 0 and toi.deleted = 0
  78. and (toi.after_sale_status = 0 or toi.after_sale_status = 61)
  79. and toi.transition_time is null
  80. and DATE(tor.create_time) &lt; CURDATE()
  81. -- and DATE(tor.create_time) = '2024-06-20'
  82. </select>
  83. <select id="queryAllOrderByOrderIds"
  84. resultMap="BaseResultMap">
  85. select tor.total_price as totalPrice,
  86. ps.cost_price as costPrice,
  87. ps.price as price,
  88. tor.product_count as productCount,
  89. tor.`no` as `no`,
  90. tor.id as orderId,
  91. tor.user_id as userId,
  92. ps.merchant_id as merchantId,
  93. ps.shop_id as shopId,
  94. mu.`name` as name,
  95. mu.nickname as nickname,
  96. toi.count as `count`,
  97. toi.id as orderItemId,
  98. toi.increase_integral AS increaseIntegral,
  99. toi.ancestor_increase_integral AS ancestorIncreaseIntegral
  100. from trade_order tor
  101. LEFT JOIN member_user mu
  102. ON tor.user_id = mu.id
  103. LEFT JOIN trade_order_item toi
  104. on tor.id = toi.order_id
  105. LEFT JOIN product_sku ps
  106. on toi.sku_id = ps.id
  107. <where>
  108. tor.pay_status = 1
  109. and toi.distribute_benefit = 0
  110. and (toi.after_sale_status = 0 or toi.after_sale_status = 61)
  111. and tor.receiving_time &lt; DATE_SUB(NOW(), INTERVAL 7 DAY)
  112. <if test="orderIds!=null">
  113. and tor.id in (
  114. <foreach collection="orderIds" item="orderId" separator=",">
  115. #{orderId}
  116. </foreach>
  117. )
  118. </if>
  119. </where>
  120. </select>
  121. </mapper>