123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111 |
- <?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.TrickTreatMapper">
- <select id="selectTrickTreatByList" resultType="com.juxiao.xchat.module.xbd.vo.TrickTreatVO">
- select u.erban_no as erbanNo, u.nick, b.input_num as inputNum,b.out_num as outputNum,DATE_FORMAT(b.create_date,'%Y-%m-%d') as createTime,b.uid
- from user_draw_gift_day b
- inner join users u on b.uid = u.uid
- where 1 = 1
- <if test="beginTime != null and beginTime != '' and endTime != null and endTime != ''">
- AND b.create_date between #{beginTime} AND #{endTime}
- </if>
- <if test="osType != null and osType != ''">
- AND u.os = #{osType}
- </if>
- <if test="erbanNo!=null">
- AND u.erban_no = #{erbanNo}
- </if>
- <if test="gender!=null">
- AND u.gender = #{gender}
- </if>
- GROUP BY createTime,b.uid
- ORDER BY b.create_date desc,inputNum desc, outputNum desc
- </select>
- <select id="selectTrickTreatStatistics" resultType="com.juxiao.xchat.module.xbd.vo.TrickTreatStatisticsVO">
- SELECT COUNT(DISTINCT b.uid) as userNum,sum(b.input_num) as totalInputNum ,sum(b.out_num) as totalOutputNum
- from user_draw_gift_day b
- inner join users u on b.uid = u.uid
- where 1 = 1
- <if test="beginTime != null and beginTime != '' and endTime != null and endTime != ''">
- AND b.create_date between #{beginTime} AND #{endTime}
- </if>
- <if test="osType != null and osType != ''">
- AND u.os = #{osType}
- </if>
- <if test="erbanNo != null">
- AND u.erban_no = #{erbanNo}
- </if>
- <if test="gender!=null">
- AND u.gender = #{gender}
- </if>
- </select>
- <select id="selectFullGiftNum" resultType="java.lang.Integer">
- select COALESCE(sum(num),0) as num
- from user_draw_gift_record
- where gift_id = #{giftId}
- <if test="beginTime != null and beginTime != '' and endTime != null and endTime != ''">
- AND create_time between #{beginTime} AND #{endTime}
- </if>
- <if test="erbanNo != null">
- AND uid = #{erbanNo}
- </if>
- </select>
- <select id="selectTrickTreatWhitelistByList" resultType="com.juxiao.xchat.module.xbd.vo.TrickTreatVO">
- select SUM(b.gold_cost) as inputNum,SUM(b.gift_num * g.gold_price) as outputNum,DATE_FORMAT(b.create_time,'%Y-%m-%d') as createTime,b.uid
- from bill_gift_draw b
- inner join gift g on g.gift_id = b.gift_id
- where
- b.uid in
- <foreach collection="uidList" index="index" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- <if test="beginTime != null and beginTime != '' and endTime != null and endTime != ''">
- AND b.create_time between #{beginTime} AND #{endTime}
- </if>
- GROUP BY createTime,b.uid
- ORDER BY inputNum desc,b.create_time desc, outputNum desc
- </select>
- <select id="selectTrickTreatWhitelistStatistics" resultType="com.juxiao.xchat.module.xbd.vo.TrickTreatStatisticsVO">
- SELECT COUNT(DISTINCT b.uid) as userNum, ifnull(SUM(b.gold_cost),0) as totalInputNum, ifnull(SUM(b.gift_num * g.gold_price),0) as totalOutputNum
- from bill_gift_draw b
- inner join users u on b.uid = u.uid
- inner join gift g on g.gift_id = b.gift_id
- where
- b.uid in
- <foreach collection="uidList" index="index" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- <if test="beginTime != null and beginTime != '' and endTime != null and endTime != ''">
- AND b.create_time between #{beginTime} AND #{endTime}
- </if>
- </select>
- <select id="selectFullWhitelistGiftNum" resultType="java.lang.Integer">
- select COALESCE(sum(num),0) as num
- from user_draw_gift_record
- where gift_id = #{giftId}
- and uid in
- <foreach collection="uidList" index="index" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- <if test="beginTime != null and beginTime != '' and endTime != null and endTime != ''">
- AND create_time between #{beginTime} AND #{endTime}
- </if>
- </select>
- </mapper>
|