UserMirrorShopMapper.xml 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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.cyksj.mapper.mirrorshop.UserMirrorShopMapper">
  4. <select id="selectSoldMaxGoods" resultType="java.lang.String">
  5. select title
  6. from goods_don
  7. where id = (select od.goods_id
  8. from (select id from user_mirror_shop where user_id = #{userId} limit 1) s
  9. inner join user_mirror_shop_order_relate omr on omr.mp_id = s.id
  10. inner join order_don od
  11. on od.id = omr.order_id and od.status not in ('close', 'noPayment', 'refund')
  12. group by od.goods_id
  13. order by max(od.money) desc limit 1)
  14. </select>
  15. <select id="selectUserMIrrorShopDetail" resultType="java.util.Map">
  16. select count(distinct ys.user_id) as numOfYhShop,
  17. count(distinct us.user_id) as numOfRegisterYhShopUser
  18. from (select user_id from `user_mirror_shop` ys
  19. where 1 = 1
  20. <if test="startDate != null">
  21. and created_time >= #{startDate}
  22. </if>
  23. <if test="endDate != null">
  24. and created_time &lt; #{endDate}
  25. </if>) ys left join user_mirror_shop_user_distribute_shared us on us.shop_user_id = ys.user_id
  26. </select>
  27. <select id="selectUserMirrorShopTakeMoney" resultType="java.math.BigDecimal">
  28. select ifnull(sum(money),0) from `user_mirror_shop_distribute_waiting_send_points` where send_status in
  29. ('waiting','success')
  30. <if test="startDate != null">
  31. and created_time >= #{startDate}
  32. </if>
  33. <if test="endDate != null">
  34. and created_time &lt; #{endDate}
  35. </if>
  36. </select>
  37. <select id="selectUserMirrorShopApplyMoney" resultType="java.util.Map">
  38. select ifnull(sum(if(verify_status = 'success',money,0)),0)s,
  39. ifnull(sum(if(verify_status = 'verifying',money,0)),0)vf
  40. from user_mirror_shop_distribute_money_apply where verify_status in ('verifying','success')
  41. <if test="startDate != null">
  42. and created_time >= #{startDate}
  43. </if>
  44. <if test="endDate != null">
  45. and created_time &lt; #{endDate}
  46. </if>
  47. </select>
  48. </mapper>