SunUser2Mapper.xml 1.5 KB

123456789101112131415161718192021222324252627
  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.book.dao.polardb.mapper.SunUser2Mapper">
  4. <select id="selectByDay" resultType="java.util.HashMap">
  5. <![CDATA[
  6. SELECT COUNT(DISTINCT(openid)) as new_recharge_user,IFNULL(sum(recharge_amount),0) as new_recharge_sum,count(recharge_num) as new_recharge_count FROM sun_user WHERE start_time>#{startDate} and end_time<=#{endDate} and recharge_num>0;
  7. ]]>
  8. </select>
  9. <select id="selectByDayChannel" resultType="java.util.HashMap">
  10. <![CDATA[
  11. SELECT t.*,t2.channel_name FROM
  12. (
  13. SELECT channel_id,COUNT(DISTINCT(openid)) as new_recharge_user,IFNULL(sum(recharge_amount),0) as new_recharge_sum,count(recharge_num) as new_recharge_count FROM sun_user WHERE start_time>#{startDate} and end_time<=#{endDate} and recharge_num>0 GROUP BY channel_id
  14. ) t LEFT JOIN sun_channel t2 on t.channel_id=t2.channel_id;
  15. ]]>
  16. </select>
  17. <select id="selectCountUserByDay" resultType="java.lang.Integer">
  18. <![CDATA[
  19. SELECT COUNT(1) FROM sun_user WHERE start_time > #{startDate} and end_time <= #{endDate};
  20. ]]>
  21. </select>
  22. <select id="selectCountByDayChannel" resultType="java.util.HashMap">
  23. <![CDATA[
  24. SELECT channel_id,COUNT(DISTINCT(openid)) as user_count FROM sun_user WHERE start_time>#{startDate} and end_time<=#{endDate} GROUP BY channel_id
  25. ]]>
  26. </select>
  27. </mapper>