123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128 |
- <?xml version="1.0" encoding="UTF-8" ?>
- <!DOCTYPE mapper
- PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
- "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="com.juxiao.xchat.module.xbd.mapper.report.OutputValueMapper">
- <resultMap id="BaseResultMap" type="com.juxiao.xchat.module.xbd.vo.OutputValueVO" >
- <id column="sign_date" property="signDate" jdbcType="VARCHAR" />
- <result column="sign_num" property="signNum" jdbcType="INTEGER" />
- <result column="first_num" property="firstNum" jdbcType="DECIMAL" />
- <result column="second_num" property="secondNum" jdbcType="DECIMAL" />
- <result column="third_num" property="thirdNum" jdbcType="DECIMAL" />
- <result column="fourth_num" property="fourthNum" jdbcType="DECIMAL" />
- <result column="fifth_num" property="fifthNum" jdbcType="DECIMAL" />
- <result column="sixth_num" property="sixthNum" jdbcType="DECIMAL" />
- <result column="seventh_num" property="seventhNum" jdbcType="DECIMAL" />
- <result column="eighth_num" property="eighthNum" jdbcType="DECIMAL" />
- <result column="ninth_num" property="ninthNum" jdbcType="DECIMAL" />
- <result column="tenth_num" property="tenthNum" jdbcType="DECIMAL" />
- <result column="eleventh_num" property="eleventhNum" jdbcType="DECIMAL" />
- <result column="twelfth_num" property="twelfthNum" jdbcType="DECIMAL" />
- <result column="thirteenth_num" property="thirteenthNum" jdbcType="DECIMAL" />
- <result column="fourteenth_num" property="fourteenthNum" jdbcType="DECIMAL" />
- <result column="sum_num" property="sumNum" jdbcType="DECIMAL" />
- <result column="uid_list" property="uidList" jdbcType="VARCHAR" />
- </resultMap>
- <select id="selectOutputValueByList" resultType="com.juxiao.xchat.module.xbd.vo.OutputValueVO">
- 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,
- 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
- from users u
- INNER JOIN account a on u.uid = a.uid
- <where>
- u.def_user != 3
- <if test="app !=null and app != ''">
- AND a.app = #{app}
- </if>
- <if test="beginTime != null and beginTime != ''">
- AND a.sign_time >= #{beginTime}
- </if>
- <if test="endTime != null and endTime != ''">
- AND a.sign_time <= #{endTime}
- </if>
- <if test="osType !=null and osType !=''">
- AND u.os = #{osType}
- </if>
- <if test="channel != null and channel != ''">
- <choose>
- <when test="channel == 'other'">
- AND u.channel is null
- </when>
- <otherwise>
- AND u.channel= #{channel}
- </otherwise>
- </choose>
- </if>
- <if test="gender != null">
- AND u.gender=#{gender}
- </if>
- </where>
- GROUP BY signDate
- ORDER BY signDate DESC
- </select>
- <select id="selectLoginRechargeNum" resultType="com.juxiao.xchat.module.xbd.dto.ChargeRecordDTO">
- 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
- FROM account_login_record a force index(uid)
- WHERE a.uid in
- <foreach item="item" index="index" collection="list" open="(" separator="," close=")">
- #{item}
- </foreach>
- AND a.create_time BETWEEN #{beginDate} and #{endDate}
- GROUP BY chargeDate
- </select>
- <select id="selectLoginRechargeSun" resultType="java.math.BigDecimal">
- SELECT COUNT(DISTINCT c.uid) FROM account_login_record c force index(uid) WHERE c.uid in
- <foreach item="item" index="index" collection="list" open="(" separator="," close=")">
- #{item}
- </foreach>
- </select>
- <select id="selectRechargeAmountSun" resultType="java.math.BigDecimal">
- SELECT ifnull(sum(c.amount) / 100,0) FROM charge_record c force index(uid) WHERE c.uid in
- <foreach item="item" index="index" collection="list" open="(" separator="," close=")">
- #{item}
- </foreach>
- and c.charge_status='2' AND c.pingxx_charge_id IS NOT NULL
- </select>
- <select id="selectRechargeAmount" resultType="com.juxiao.xchat.module.xbd.dto.ChargeRecordDTO">
- 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
- FROM charge_record c force index(uid)
- WHERE c.uid in
- <foreach item="item" index="index" collection="list" open="(" separator="," close=")">
- #{item}
- </foreach>
- and c.charge_status='2' AND c.pingxx_charge_id IS NOT NULL AND c.create_time BETWEEN #{beginDate} and #{endDate} GROUP BY chargeDate
- </select>
- <select id="selectRechargeSun" resultType="java.math.BigDecimal">
- SELECT COUNT(DISTINCT c.uid) FROM charge_record c force index(uid) WHERE c.uid in
- <foreach item="item" index="index" collection="list" open="(" separator="," close=")">
- #{item}
- </foreach>
- and c.charge_status='2' AND c.pingxx_charge_id IS NOT NULL
- </select>
- <select id="selectRechargeSunByUidListOrTime" resultType="java.math.BigDecimal">
- SELECT COUNT(DISTINCT c.uid)
- FROM charge_record c force index(uid)
- WHERE c.uid in
- <foreach item="item" index="index" collection="list" open="(" separator="," close=")">
- #{item}
- </foreach>
- and c.charge_status='2' AND c.pingxx_charge_id IS NOT NULL AND c.create_time BETWEEN #{beginDate} and #{endDate}
- </select>
- <select id="selectRechargeNum" resultType="com.juxiao.xchat.module.xbd.dto.ChargeRecordDTO">
- 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
- FROM charge_record c force index(uid)
- WHERE c.uid in
- <foreach item="item" index="index" collection="list" open="(" separator="," close=")">
- #{item}
- </foreach>
- and c.charge_status='2' AND c.pingxx_charge_id IS NOT NULL AND c.create_time BETWEEN #{beginDate} and #{endDate} GROUP BY chargeDate
- </select>
- </mapper>
|