From a79be5c75d4409bd14a36b648c1a398b409cad65 Mon Sep 17 00:00:00 2001 From: yujian <yujian> Date: 星期二, 08 一月 2019 16:48:39 +0800 Subject: [PATCH] Merge branch 'div1' --- fanli/src/main/java/com/yeshi/fanli/mapping/user/UserActiveLogMapper.xml | 103 +++++++++++++++++++++++++-------------------------- 1 files changed, 51 insertions(+), 52 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 4020b05..47a7b4b 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 @@ -95,15 +95,15 @@ </update> <select id="countSameDayByChannel" resultType="java.util.HashMap"> - SELECT COALESCE(COUNT(*),0) AS 'sameDayNum', + SELECT COALESCE(COUNT(*),0) AS 'showValue', <if test="type == 1"> - FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m-%d') AS 'createDate' + FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m-%d') AS 'showDate' </if> <if test="type == 2"> - FROM_UNIXTIME(u.`createtime`/1000,'%m') AS 'createDate' + FROM_UNIXTIME(u.`createtime`/1000,'%m') AS 'showDate' </if> <if test="type == 3"> - FROM_UNIXTIME(u.`createtime`/1000,'%Y') AS 'createDate' + FROM_UNIXTIME(u.`createtime`/1000,'%Y') AS 'showDate' </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 @@ -132,24 +132,30 @@ </select> <select id="countSameDayAndBuyGoodsByChannel" resultType="java.util.HashMap"> - SELECT COALESCE(COUNT(DISTINCT u.`id`),0) AS 'sameDayNum', + SELECT COALESCE(COUNT(DISTINCT u.`id`),0) AS 'showValue', <if test="type == 1"> - FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m-%d') AS 'createDate' + FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m-%d') AS 'showDate' </if> <if test="type == 2"> - FROM_UNIXTIME(u.`createtime`/1000,'%m') AS 'createDate' + FROM_UNIXTIME(u.`createtime`/1000,'%m') AS 'showDate' </if> <if test="type == 3"> - FROM_UNIXTIME(u.`createtime`/1000,'%Y') AS 'createDate' + FROM_UNIXTIME(u.`createtime`/1000,'%Y') AS 'showDate' </if> - FROM (SELECT a.`lua_uid` AS uid FROM `yeshi_ec_log_user_active` a + + FROM + <if test="channel != null and channel != 'all' "> + (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 `yeshi_ec_hongbao` h ON h.`uid`= u.`id` - WHERE (h.`type`=1 OR h.`type`=20) - AND FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m-%d') = FROM_UNIXTIME(h.createtime/1000,'%Y-%m-%d') + </if> + LEFT JOIN yeshi_ec_user u <if test="channel != null and channel != 'all' ">ON u.`id`=a.uid</if> + LEFT JOIN `yeshi_ec_hongbao_v2` h ON h.`hb_uid`= u.`id` + WHERE (h.`hb_type`=1 OR h.`hb_type`=20) + <!-- 褰撴棩涓嬪崟 --> + AND FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m-%d') = FROM_UNIXTIME(h.hb_create_time/1000,'%Y-%m-%d') + <if test="startTime != null and startTime != '' "> - AND FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m-%d')<![CDATA[ >= ]]>'${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}' @@ -166,46 +172,39 @@ <if test="type == 3"> GROUP BY FROM_UNIXTIME(u.`createtime`/1000,'%Y') </if> - 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 id="countOneWeekUserInfo" resultType="java.util.HashMap"> + SELECT COALESCE(SUM(w.total),0) AS totalUser,COALESCE(SUM(w.orderUser),0)AS orderUser FROM + (SELECT COUNT(u.`id`)AS total,0 AS orderUser + FROM + <if test="channel != null and channel != 'all' "> + (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 + </if> + yeshi_ec_user u <if test="channel != null and channel != 'all' "> ON u.`id`=a.uid </if> + + WHERE FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m-%d') = '2018-11-01' + + UNION + + SELECT 0 AS total, COUNT(u.`id`) AS orderUser + FROM + <if test="channel != null and channel != 'all' "> + (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 + </if> + yeshi_ec_user u <if test="channel != null and channel != 'all' "> ON u.`id`=a.uid </if> + WHERE FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m-%d') = '2018-01-11' + AND u.id = ANY(SELECT hh.hb_uid FROM (SELECT COUNT(t.`hb_id`) AS num,t.hb_uid + FROM yeshi_ec_hongbao_v2 t + WHERE <![CDATA[DATE_FORMAT(t.`hb_create_time`,'%Y-%m-%d') >= '${startTime}']]> + AND <![CDATA[DATE_FORMAT(t.`hb_create_time`,'%Y-%m-%d') < '${endTime}']]> + GROUP BY t.hb_uid HAVING num >= ${orderNumber} + )hh + ) + )w + </select> </mapper> -- Gitblit v1.8.0