<!-- 会员统计 -->
<select id="analytics" resultType="map">
<choose>
<when test="module == 'AMOUNT'">
SELECT updatedAt,total,'AMOUNT' AS 'module' FROM xx.stt_member m
WHERE m.`updatedAt` >= DATE_SUB(CURDATE(),INTERVAL #{interval} DAY)
</when>
<when test="module == 'LOGIN'">
SELECT SUM(d.count) AS 'total','LOGIN' AS 'module' ,d.`updatedAt` FROM xx.stt_member_detail d WHERE
d.`action`='LOGIN' and d.`updatedAt` >= DATE_SUB(CURDATE(),INTERVAL #{interval} DAY) GROUP BY DATE_FORMAT(updatedAt,'%Y%M%d')
</when>
<when test="module == 'REGISTER'">
SELECT SUM(d.count) AS 'total', 'REGISTER' AS 'module',d.`updatedAt` FROM xx.stt_member_detail d WHERE
d.`action`='REGISTER' and d.`updatedAt` >= DATE_SUB(CURDATE(),INTERVAL #{interval} DAY) GROUP BY DATE_FORMAT(updatedAt,'%Y%M%d')
</when>
<when test="module == 'ACTIVE'">
SELECT updatedAt,`active` AS 'total','ACTIVE' AS 'module' FROM xx.stt_member m
WHERE m.`updatedAt` >= DATE_SUB(CURDATE(),INTERVAL #{interval} DAY)
</when>
</choose>
</select>