From c53f14a5c5d0bb6623987de84ef1bb8f8a8dbb3f Mon Sep 17 00:00:00 2001 From: yujian <yujian> Date: 星期一, 14 一月 2019 18:13:24 +0800 Subject: [PATCH] Merge branch 'div1' --- fanli/src/main/java/com/yeshi/fanli/mapping/UserInfoMapper.xml | 105 +++++++++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 99 insertions(+), 6 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/mapping/UserInfoMapper.xml b/fanli/src/main/java/com/yeshi/fanli/mapping/UserInfoMapper.xml index a1a849b..b024a50 100644 --- a/fanli/src/main/java/com/yeshi/fanli/mapping/UserInfoMapper.xml +++ b/fanli/src/main/java/com/yeshi/fanli/mapping/UserInfoMapper.xml @@ -376,26 +376,33 @@ </select> <select id="countHasOrderUser" resultType="java.lang.Long"> - SELECT COUNT(DISTINCT h.`uid`) FROM yeshi_ec_hongbao_v2 h + SELECT COUNT(DISTINCT h.`hb_uid`) FROM yeshi_ec_hongbao_v2 h WHERE h.`hb_type`=1 or h.`hb_type`=2 </select> <select id="countNewUserByDate" resultType="java.util.HashMap"> - SELECT COUNT(h.`id`) AS total, + SELECT COUNT(h.`id`) AS showValue, <if test="type == 1"> - FROM_UNIXTIME(h.`createtime`/1000,'%Y-%m-%d') AS 'createDate' + FROM_UNIXTIME(h.`createtime`/1000,'%Y-%m-%d') AS 'showDate' </if> <if test="type == 2"> - FROM_UNIXTIME(h.`createtime`/1000,'%m') AS 'createDate' + FROM_UNIXTIME(h.`createtime`/1000,'%m') AS 'showDate' </if> <if test="type == 3"> - FROM_UNIXTIME(h.`createtime`/1000,'%Y') AS 'createDate' + FROM_UNIXTIME(h.`createtime`/1000,'%Y') AS 'showDate' </if> FROM yeshi_ec_user h + <if test="channel != null and channel != 'all' "> + left join (SELECT a.`lua_uid` AS uid FROM `yeshi_ec_log_user_active` a + WHERE a.`lua_channel`='${channel}' GROUP BY a.`lua_uid`)a ON h.`id`=a.uid + </if> WHERE 1=1 + <if test="channel != null and channel != 'all' "> + AND a.uid is not null + </if> <if test="startTime != null and startTime != '' "> - AND FROM_UNIXTIME(h.`createtime`/1000,'%Y-%m-%d')<![CDATA[ >= ]]>'${startTime}' + AND FROM_UNIXTIME(h.`createtime`/1000,'%Y-%m-%d')<![CDATA[ >= ]]>'${startTime}' </if> <if test="endTime != null and endTime != '' "> AND FROM_UNIXTIME(h.`createtime`/1000,'%Y-%m-%d') <![CDATA[ <= ]]> '${endTime}' @@ -414,4 +421,90 @@ </if> ORDER BY h.`createtime` </select> + + <select id="getTodayHasOrder" resultType="java.util.HashMap"> + SELECT COALESCE(COUNT(u.`id`),0) AS 'showValue', + <if test="type == 1"> + FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m-%d') AS 'showDate' + </if> + <if test="type == 2"> + FROM_UNIXTIME(u.`createtime`/1000,'%m') AS 'showDate' + </if> + <if test="type == 3"> + FROM_UNIXTIME(u.`createtime`/1000,'%Y') AS 'showDate' + </if> + + FROM yeshi_ec_user u + <if test="channel != null and channel != 'all' "> + LEFT JOIN (SELECT a.`lua_uid` AS uid FROM `yeshi_ec_log_user_active` a + WHERE a.`lua_channel`='${channel}' GROUP BY a.`lua_uid`) a 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) + <if test="channel != null and channel != 'all' "> + AND a.uid is not null + </if> + <!-- 褰撴棩涓嬪崟 --> + 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}' + </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> + + + + <select id="countWeekUserInfo" 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 yeshi_ec_user u + <if test="channel != null and channel != 'all' "> + LEFT JOIN (SELECT a.`lua_uid` AS uid FROM `yeshi_ec_log_user_active` a + WHERE a.`lua_channel`='${channel}' GROUP BY a.`lua_uid`) a ON u.`id`=a.uid + </if> + WHERE FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m-%d') = '${startTime}' + <if test="channel != null and channel != 'all' "> + AND a.uid is not null + </if> + UNION + + SELECT 0 AS total, COUNT(u.`id`) AS orderUser + FROM yeshi_ec_user u + <if test="channel != null and channel != 'all' "> + LEFT JOIN (SELECT a.`lua_uid` AS uid FROM `yeshi_ec_log_user_active` a + WHERE a.`lua_channel`='${channel}' GROUP BY a.`lua_uid`) a ON u.`id`=a.uid + </if> + WHERE FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m-%d') = '${startTime}' + 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 + ) + + <if test="channel != null and channel != 'all' "> + AND a.uid is not null + </if> + )w + + </select> </mapper> -- Gitblit v1.8.0