YhShopWaitingSendPointsMapper.xml 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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.shop.YhShopDistributeWaitingSendPointsMapper">
  4. <select id="getWMoneyStatisticsDataView"
  5. resultType="com.cyksj.model.views.YhShopBrokenLineCpsUserWMoneyView">
  6. select min(curdate) as firstDate,
  7. max(curdate) as lastDate from (select
  8. <if test="today">
  9. date_format(send_time, '%H') as `curdate`
  10. </if>
  11. <if test="!today">
  12. date_format(send_time, '%Y-%m-%d') `curdate`
  13. </if>
  14. from `yh_shop_distribute_waiting_send_points`
  15. where shop_user_id = #{yhShopUserId}
  16. and send_status = 'waiting'
  17. <choose>
  18. <when test="today">
  19. <if test="first != null">
  20. and send_time >= #{first}
  21. </if>
  22. <if test="end != null">
  23. and send_time &lt;= #{end}
  24. </if>
  25. group by date_format(send_time, '%H')
  26. </when>
  27. <otherwise>
  28. <if test="first != null">
  29. and date_format(send_time, '%Y-%m-%d') >= #{first}
  30. </if>
  31. <if test="end != null">
  32. and date_format(send_time, '%Y-%m-%d') &lt; #{end}
  33. </if>
  34. group by date_format(send_time, '%Y-%m-%d')
  35. </otherwise>
  36. </choose>
  37. )s
  38. </select>
  39. <select id="getWMoneyStatisticsDate" resultType="com.cyksj.model.views.YhShopUserWMoneyStatisticsDataView">
  40. select
  41. <if test="today">
  42. date_format(send_time, '%H') as `hour`,
  43. </if>
  44. <if test="!today">
  45. date_format(send_time, '%Y-%m-%d') `date`,
  46. </if>
  47. TRUNCATE(sum(money)/ 100,2) money
  48. from `yh_shop_distribute_waiting_send_points`
  49. where shop_user_id = #{yhShopUserId}
  50. and send_status = 'waiting'
  51. <choose>
  52. <when test="today">
  53. <if test="first != null">
  54. and send_time >= #{first}
  55. </if>
  56. <if test="end != null">
  57. and send_time &lt;= #{end}
  58. </if>
  59. group by date_format(send_time, '%H')
  60. order by date_format(send_time, '%H')
  61. </when>
  62. <otherwise>
  63. <if test="first != null">
  64. and date_format(send_time, '%Y-%m-%d') >= #{first}
  65. </if>
  66. <if test="end != null">
  67. and date_format(send_time, '%Y-%m-%d') &lt; #{end}
  68. </if>
  69. group by date_format(send_time, '%Y-%m-%d')
  70. order by date_format(send_time, '%Y-%m-%d')
  71. </otherwise>
  72. </choose>
  73. </select>
  74. </mapper>