WHEN LOCATE('直播间', content) > 0 AND LOCATE('送礼物', content) > 0
THEN SUBSTRING(content, LOCATE('送礼物', content) + CHAR_LENGTH('送礼物'))
ELSE NULL
END AS gift,
fyr.money AS beanNum,
CASE
WHEN LOCATE('直播间', content) > 0 AND LOCATE('送礼物', content) > 0
THEN SUBSTRING_INDEX(SUBSTRING(content, LOCATE('直播间', content) + CHAR_LENGTH('直播间')), '送礼物', 1)
ELSE NULL
END AS channel,
fyr.source_name AS liveName,
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 (1,2,3,4,5)
<iftest="beanConsumeLive.jwcode != null and beanConsumeLive.jwcode != ''">
AND fm.jwcode = #{beanConsumeLive.jwcode}
</if>
<iftest="beanConsumeLive.dept != null and beanConsumeLive.dept != ''">
AND fm.dept = #{beanConsumeLive.dept}
</if>
<iftest="beanConsumeLive.type != null and beanConsumeLive.type != ''">
AND fyr.source_type = #{beanConsumeLive.type}
</if>
<iftest="beanConsumeLive.consumeTime != null and beanConsumeLive.consumeTime != null">
AND consumeTime BETWEEN #{beanConsumeLive.startTime} AND #{beanConsumeLive.endTime}
</if>
</where>
) AS t
<where>
<iftest="beanConsumeLive.gift != null and beanConsumeLive.gift != ''">
AND t.gift = #{beanConsumeLive.gift}
</if>
<iftest="beanConsumeLive.channel != null and beanConsumeLive.channel != ''">
AND t.channel = #{beanConsumeLive.channel}
</if>
</where>
<choose>
<whentest="beanConsumeLive.sortField != null and beanConsumeLive.sortField != '' and beanConsumeLive.sortOrder != null and beanConsumeLive.sortOrder != ''">
ORDER BY t.${beanConsumeLive.sortField} ${beanConsumeLive.sortOrder}