@ -27,7 +27,7 @@
WHEN LOCATE('直播间', content) > 0 AND LOCATE('送礼物', content) > 0
WHEN LOCATE('直播间', content) > 0 AND LOCATE('送礼物', content) > 0
THEN SUBSTRING_INDEX(SUBSTRING(content, LOCATE('直播间', content) + CHAR_LENGTH('直播间')), '送礼物', 1)
THEN SUBSTRING_INDEX(SUBSTRING(content, LOCATE('直播间', content) + CHAR_LENGTH('直播间')), '送礼物', 1)
ELSE NULL
ELSE NULL
END AS c hannel,
END AS liveC hannel,
fyr.source_name AS liveName,
fyr.source_name AS liveName,
FROM_UNIXTIME(fyr.time, '%Y-%m-%d %H:%i:%s') AS consumeTime,
FROM_UNIXTIME(fyr.time, '%Y-%m-%d %H:%i:%s') AS consumeTime,
fyr.pay_type AS payType
fyr.pay_type AS payType
@ -54,8 +54,8 @@
<if test= "beanConsumeLive.gift != null and beanConsumeLive.gift != ''" >
<if test= "beanConsumeLive.gift != null and beanConsumeLive.gift != ''" >
AND t.gift = #{beanConsumeLive.gift}
AND t.gift = #{beanConsumeLive.gift}
</if>
</if>
<if test= "beanConsumeLive.channel != null and beanConsumeLive.c hannel != ''" >
AND t.channel= #{beanConsumeLive.c hannel}
<if test= "beanConsumeLive.liveChannel != null and beanConsumeLive.liveC hannel != ''" >
AND t.liveChannel= #{beanConsumeLive.liveC hannel}
</if>
</if>
<if test= "beanConsumeLive.liveName != null and beanConsumeLive.liveName != ''" >
<if test= "beanConsumeLive.liveName != null and beanConsumeLive.liveName != ''" >
AND t.liveName LIKE CONCAT('%', #{beanConsumeLive.liveName}, '%')
AND t.liveName LIKE CONCAT('%', #{beanConsumeLive.liveName}, '%')
@ -105,12 +105,12 @@
ELSE NULL
ELSE NULL
END = #{beanConsumeLive.gift}
END = #{beanConsumeLive.gift}
</if>
</if>
<if test= "beanConsumeLive.channel != null and beanConsumeLive.c hannel != ''" >
<if test= "beanConsumeLive.liveChannel != null and beanConsumeLive.liveC hannel != ''" >
AND CASE
AND CASE
WHEN LOCATE('直播间', fyr.content) > 0 AND LOCATE('送礼物', fyr.content) > 0
WHEN LOCATE('直播间', fyr.content) > 0 AND LOCATE('送礼物', fyr.content) > 0
THEN SUBSTRING_INDEX(SUBSTRING(fyr.content, LOCATE('直播间', fyr.content) + CHAR_LENGTH('直播间')), '送礼物', 1)
THEN SUBSTRING_INDEX(SUBSTRING(fyr.content, LOCATE('直播间', fyr.content) + CHAR_LENGTH('直播间')), '送礼物', 1)
ELSE NULL
ELSE NULL
END = #{beanConsumeLive.c hannel}
END = #{beanConsumeLive.liveC hannel}
</if>
</if>
<if test= "beanConsumeLive.startTime != null and beanConsumeLive.endTime != null" >
<if test= "beanConsumeLive.startTime != null and beanConsumeLive.endTime != null" >
AND fyr.time BETWEEN UNIX_TIMESTAMP(#{beanConsumeLive.startTime})
AND fyr.time BETWEEN UNIX_TIMESTAMP(#{beanConsumeLive.startTime})
@ -122,6 +122,78 @@
</where>
</where>
) AS t
) AS t
</select>
</select>
<select id= "selectFanBy" resultType= "com.example.demo.domain.vo.bean.BeanConsumeFan" >
SELECT fm.nickname AS name,
fm.jwcode,
fm.dept,
fyr.money AS beanNum,
fyr.source_name AS channel,
fyr.source_type AS type,
FROM_UNIXTIME(fyr.time, '%Y-%m-%d %H:%i:%s') AS consumeTime,
fyr.pay_type AS payType
FROM fx_member fm
INNER JOIN fx_yaoqing_records fyr ON fyr.uid = fm.id
<where >
fyr.pay_type IN (7)
<if test= "beanConsumeFan.jwcode != null and beanConsumeFan.jwcode != ''" >
AND fm.jwcode = #{beanConsumeFan.jwcode}
</if>
<if test= "beanConsumeFan.dept != null and beanConsumeFan.dept != ''" >
AND fm.dept = #{beanConsumeFan.dept}
</if>
<if test= "beanConsumeFan.channel != null and beanConsumeFan.channel != ''" >
AND fyr.source_name =#{beanConsumeFan.channel}
</if>
<if test= "beanConsumeFan.startTime != null and beanConsumeFan.endTime != null" >
AND fyr.time BETWEEN UNIX_TIMESTAMP(#{beanConsumeFan.startTime})
AND UNIX_TIMESTAMP(#{beanConsumeFan.endTime})
</if>
</where>
<choose >
<when test= "beanConsumeFan.sortField != null and beanConsumeFan.sortField != '' and beanConsumeFan.sortOrder != null and beanConsumeFan.sortOrder != ''" >
ORDER BY ${beanConsumeFan.sortField} ${beanConsumeFan.sortOrder}
</when>
<otherwise >
ORDER BY consumeTime DESC
</otherwise>
</choose>
</select>
<!-- 铁粉消耗合计数 -->
<select id= "selectSumFansBy" resultType= "com.example.demo.domain.vo.bean.BeanConsumeGold" >
SELECT
IFNULL(SUM(t.money_buy), 0) AS permanentBean,
IFNULL(SUM(t.money_free), 0) AS freeBean,
COUNT(*) AS totalNum
FROM (
SELECT
fyr.money_buy,
fyr.money_free,
fyr.time
FROM fx_member fm
INNER JOIN fx_yaoqing_records fyr ON fyr.uid = fm.id
<where >
fyr.pay_type = 7
<if test= "beanConsumeFan.jwcode != null and beanConsumeFan.jwcode != ''" >
AND fm.jwcode = #{beanConsumeFan.jwcode}
</if>
<if test= "beanConsumeFan.dept != null and beanConsumeFan.dept != ''" >
AND fm.dept = #{beanConsumeFan.dept}
</if>
<if test= "beanConsumeFan.channel != null and beanConsumeFan.channel != ''" >
AND fyr.source_name = #{beanConsumeFan.channel}
</if>
<if test= "beanConsumeFan.startTime != null and beanConsumeFan.endTime != null" >
AND fyr.time BETWEEN UNIX_TIMESTAMP(#{beanConsumeFan.startTime})
AND UNIX_TIMESTAMP(#{beanConsumeFan.endTime})
</if>
</where>
) AS t
</select>
<select id= "getLiveGift" resultType= "java.lang.String" >
<select id= "getLiveGift" resultType= "java.lang.String" >
SELECT DISTINCT
SELECT DISTINCT
CASE
CASE
@ -139,10 +211,11 @@
WHEN LOCATE('直播间', content) > 0 AND LOCATE('送礼物', content) > 0
WHEN LOCATE('直播间', content) > 0 AND LOCATE('送礼物', content) > 0
THEN SUBSTRING_INDEX(SUBSTRING(content, LOCATE('直播间', content) + CHAR_LENGTH('直播间')), '送礼物', 1)
THEN SUBSTRING_INDEX(SUBSTRING(content, LOCATE('直播间', content) + CHAR_LENGTH('直播间')), '送礼物', 1)
ELSE NULL
ELSE NULL
END AS c hannel
END AS liveC hannel
FROM fx_yaoqing_records
FROM fx_yaoqing_records
WHERE LOCATE('直播间', content) > 0 AND LOCATE('送礼物', content) > 0
WHERE LOCATE('直播间', content) > 0 AND LOCATE('送礼物', content) > 0
AND content IS NOT NULL AND pay_type in (1,2,3,4,5)
AND content IS NOT NULL AND pay_type in (1,2,3,4,5)
</select>
</select>
</mapper>
</mapper>