From 4220ceb661146c58d1d6855f14dcdcc3d8c7bb24 Mon Sep 17 00:00:00 2001 From: yujian <yujian> Date: 星期六, 05 一月 2019 14:45:10 +0800 Subject: [PATCH] Merge branch 'div1' --- fanli/src/main/java/com/yeshi/fanli/mapping/user/UserActiveLogMapper.xml | 39 +++++++++++++++++++++++++++++++++++++++ 1 files changed, 39 insertions(+), 0 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/mapping/user/UserActiveLogMapper.xml b/fanli/src/main/java/com/yeshi/fanli/mapping/user/UserActiveLogMapper.xml index a5cbcf1..4020b05 100644 --- a/fanli/src/main/java/com/yeshi/fanli/mapping/user/UserActiveLogMapper.xml +++ b/fanli/src/main/java/com/yeshi/fanli/mapping/user/UserActiveLogMapper.xml @@ -169,4 +169,43 @@ ORDER BY u.`createtime` </select> + + <select id="countSameDayAndBuyGoodsByChannelAndBuyNum" resultType="java.util.HashMap"> + SELECT COALESCE(COUNT(DISTINCT u.`id`),0) AS 'sameDayNum', + <if test="type == 1"> + FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m-%d') AS 'createDate' + </if> + <if test="type == 2"> + FROM_UNIXTIME(u.`createtime`/1000,'%m') AS 'createDate' + </if> + <if test="type == 3"> + FROM_UNIXTIME(u.`createtime`/1000,'%Y') AS 'createDate' + </if> + FROM (SELECT a.`lua_uid` AS uid FROM `yeshi_ec_log_user_active` a + WHERE a.`lua_channel`='${channel}' GROUP BY a.`lua_uid`) a + LEFT JOIN yeshi_ec_user u ON u.`id`=a.uid + LEFT JOIN (SELECT COUNT(DISTINCT h.`order_id`) AS count_num,h.uid,h.`createtime` FROM yeshi_ec_hongbao h + WHERE h.`type`=1 OR h.`type`=20 + GROUP BY h.`createtime`,h.uid HAVING count_num>= ${orderNum})hb ON hb.`uid`= u.`id` + WHERE FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m-%d') = FROM_UNIXTIME(hb.createtime/1000,'%Y-%m-%d') + <if test="startTime != null and startTime != '' "> + AND FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m-%d')<![CDATA[ >= ]]>'${startTime}' + </if> + <if test="endTime != null and endTime != '' "> + AND FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m-%d') <![CDATA[ <= ]]> '${endTime}' + </if> + <if test="years != null and years != '' "> + AND FROM_UNIXTIME(u.`createtime`/1000,'%Y') = '${years}' + </if> + <if test="type == 1"> + GROUP BY FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m-%d') + </if> + <if test="type == 2"> + GROUP BY FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m') + </if> + <if test="type == 3"> + GROUP BY FROM_UNIXTIME(u.`createtime`/1000,'%Y') + </if> + ORDER BY u.`createtime` + </select> </mapper> -- Gitblit v1.8.0