OutPutValueMapper.xml 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.juxiao.xchat.module.xbd.mapper.report.OutputValueMapper">
  6. <resultMap id="BaseResultMap" type="com.juxiao.xchat.module.xbd.vo.OutputValueVO" >
  7. <id column="sign_date" property="signDate" jdbcType="VARCHAR" />
  8. <result column="sign_num" property="signNum" jdbcType="INTEGER" />
  9. <result column="first_num" property="firstNum" jdbcType="DECIMAL" />
  10. <result column="second_num" property="secondNum" jdbcType="DECIMAL" />
  11. <result column="third_num" property="thirdNum" jdbcType="DECIMAL" />
  12. <result column="fourth_num" property="fourthNum" jdbcType="DECIMAL" />
  13. <result column="fifth_num" property="fifthNum" jdbcType="DECIMAL" />
  14. <result column="sixth_num" property="sixthNum" jdbcType="DECIMAL" />
  15. <result column="seventh_num" property="seventhNum" jdbcType="DECIMAL" />
  16. <result column="eighth_num" property="eighthNum" jdbcType="DECIMAL" />
  17. <result column="ninth_num" property="ninthNum" jdbcType="DECIMAL" />
  18. <result column="tenth_num" property="tenthNum" jdbcType="DECIMAL" />
  19. <result column="eleventh_num" property="eleventhNum" jdbcType="DECIMAL" />
  20. <result column="twelfth_num" property="twelfthNum" jdbcType="DECIMAL" />
  21. <result column="thirteenth_num" property="thirteenthNum" jdbcType="DECIMAL" />
  22. <result column="fourteenth_num" property="fourteenthNum" jdbcType="DECIMAL" />
  23. <result column="sum_num" property="sumNum" jdbcType="DECIMAL" />
  24. <result column="uid_list" property="uidList" jdbcType="VARCHAR" />
  25. </resultMap>
  26. <select id="selectOutputValueByList" resultType="com.juxiao.xchat.module.xbd.vo.OutputValueVO">
  27. select DATE_FORMAT(a.sign_time, '%Y-%m-%d') as signDate, COUNT(1) as signNum, GROUP_CONCAT(u.uid) as uidList, 0 as firstNum, 0 as secondNum, 0 as thirdNum, 0 as fourthNum,
  28. 0 as fifthNum, 0 as sixthNum, 0 as seventhNum, 0 as eighthNum, 0 as ninthNum, 0 as tenthNum, 0 as eleventhNum, 0 as twelfthNum, 0 as thirteenthNum, 0 as fourteenthNum, 0 as sumNum
  29. from users u
  30. INNER JOIN account a on u.uid = a.uid
  31. <where>
  32. u.def_user != 3
  33. <if test="app !=null and app != ''">
  34. AND a.app = #{app}
  35. </if>
  36. <if test="beginTime != null and beginTime != ''">
  37. AND a.sign_time &gt;= #{beginTime}
  38. </if>
  39. <if test="endTime != null and endTime != ''">
  40. AND a.sign_time &lt;= #{endTime}
  41. </if>
  42. <if test="osType !=null and osType !=''">
  43. AND u.os = #{osType}
  44. </if>
  45. <if test="channel != null and channel != ''">
  46. <choose>
  47. <when test="channel == 'other'">
  48. AND u.channel is null
  49. </when>
  50. <otherwise>
  51. AND u.channel= #{channel}
  52. </otherwise>
  53. </choose>
  54. </if>
  55. <if test="gender != null">
  56. AND u.gender=#{gender}
  57. </if>
  58. </where>
  59. GROUP BY signDate
  60. ORDER BY signDate DESC
  61. </select>
  62. <select id="selectLoginRechargeNum" resultType="com.juxiao.xchat.module.xbd.dto.ChargeRecordDTO">
  63. SELECT DATE_FORMAT(a.create_time, '%Y-%m-%d') as chargeDate,COUNT(DISTINCT a.uid) as num,TIMESTAMPDIFF(DAY,#{beginDate},a.create_time) as differenceDate
  64. FROM account_login_record a force index(uid)
  65. WHERE a.uid in
  66. <foreach item="item" index="index" collection="list" open="(" separator="," close=")">
  67. #{item}
  68. </foreach>
  69. AND a.create_time BETWEEN #{beginDate} and #{endDate}
  70. GROUP BY chargeDate
  71. </select>
  72. <select id="selectLoginRechargeSun" resultType="java.math.BigDecimal">
  73. SELECT COUNT(DISTINCT c.uid) FROM account_login_record c force index(uid) WHERE c.uid in
  74. <foreach item="item" index="index" collection="list" open="(" separator="," close=")">
  75. #{item}
  76. </foreach>
  77. </select>
  78. <select id="selectRechargeAmountSun" resultType="java.math.BigDecimal">
  79. SELECT ifnull(sum(c.amount) / 100,0) FROM charge_record c force index(uid) WHERE c.uid in
  80. <foreach item="item" index="index" collection="list" open="(" separator="," close=")">
  81. #{item}
  82. </foreach>
  83. and c.charge_status='2' AND c.pingxx_charge_id IS NOT NULL
  84. </select>
  85. <select id="selectRechargeAmount" resultType="com.juxiao.xchat.module.xbd.dto.ChargeRecordDTO">
  86. SELECT DATE_FORMAT(c.create_time, '%Y-%m-%d') as chargeDate, ifnull(sum(c.amount)/100,0) as num, TIMESTAMPDIFF(DAY,#{beginDate},c.create_time) as differenceDate
  87. FROM charge_record c force index(uid)
  88. WHERE c.uid in
  89. <foreach item="item" index="index" collection="list" open="(" separator="," close=")">
  90. #{item}
  91. </foreach>
  92. and c.charge_status='2' AND c.pingxx_charge_id IS NOT NULL AND c.create_time BETWEEN #{beginDate} and #{endDate} GROUP BY chargeDate
  93. </select>
  94. <select id="selectRechargeSun" resultType="java.math.BigDecimal">
  95. SELECT COUNT(DISTINCT c.uid) FROM charge_record c force index(uid) WHERE c.uid in
  96. <foreach item="item" index="index" collection="list" open="(" separator="," close=")">
  97. #{item}
  98. </foreach>
  99. and c.charge_status='2' AND c.pingxx_charge_id IS NOT NULL
  100. </select>
  101. <select id="selectRechargeSunByUidListOrTime" resultType="java.math.BigDecimal">
  102. SELECT COUNT(DISTINCT c.uid)
  103. FROM charge_record c force index(uid)
  104. WHERE c.uid in
  105. <foreach item="item" index="index" collection="list" open="(" separator="," close=")">
  106. #{item}
  107. </foreach>
  108. and c.charge_status='2' AND c.pingxx_charge_id IS NOT NULL AND c.create_time BETWEEN #{beginDate} and #{endDate}
  109. </select>
  110. <select id="selectRechargeNum" resultType="com.juxiao.xchat.module.xbd.dto.ChargeRecordDTO">
  111. SELECT DATE_FORMAT(c.create_time, '%Y-%m-%d') as chargeDate, COUNT(DISTINCT c.uid) as num, TIMESTAMPDIFF(DAY,#{beginDate},c.create_time) as differenceDate
  112. FROM charge_record c force index(uid)
  113. WHERE c.uid in
  114. <foreach item="item" index="index" collection="list" open="(" separator="," close=")">
  115. #{item}
  116. </foreach>
  117. and c.charge_status='2' AND c.pingxx_charge_id IS NOT NULL AND c.create_time BETWEEN #{beginDate} and #{endDate} GROUP BY chargeDate
  118. </select>
  119. </mapper>