| | |
| | | <result column="lua_device_type" property="deviceType" |
| | | jdbcType="VARCHAR" /> |
| | | <result column="lua_os_version" property="osVersion" jdbcType="VARCHAR" /> |
| | | <result column="lua_device" property="device" jdbcType="VARCHAR" /> |
| | | </resultMap> |
| | | <sql id="Base_Column_List">lua_id,lua_uid,lua_ip,lua_channel,lua_version_code,lua_createtime,lua_updatetime,lua_device_type,lua_os_version |
| | | <sql id="Base_Column_List">lua_id,lua_uid,lua_ip,lua_channel,lua_version_code,lua_createtime,lua_updatetime,lua_device_type,lua_os_version,lua_device |
| | | </sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" |
| | | parameterType="java.lang.Long"> |
| | |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_log_user_active where lua_id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | |
| | | <select id="selectLatestByUid" resultMap="BaseResultMap" |
| | | parameterType="java.lang.Long"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_log_user_active where lua_uid = #{0} order by lua_id desc limit 1 |
| | | from yeshi_ec_log_user_active where lua_uid = #{0} order by lua_id |
| | | desc limit 1 |
| | | </select> |
| | | |
| | | <select id="selectFirstActiveInfo" resultMap="BaseResultMap" |
| | | parameterType="java.lang.Long"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_log_user_active where lua_uid = #{0} order by lua_id |
| | | limit 1 |
| | | </select> |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from |
| | | yeshi_ec_log_user_active where lua_id = #{id,jdbcType=BIGINT} |
| | | </delete> |
| | | yeshi_ec_log_user_active where lua_id = #{id,jdbcType=BIGINT}</delete> |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.user.UserActiveLog" |
| | | useGeneratedKeys="true" keyProperty="id">insert into |
| | | yeshi_ec_log_user_active |
| | | (lua_id,lua_uid,lua_ip,lua_channel,lua_version_code,lua_createtime,lua_updatetime,lua_device_type,lua_os_version) |
| | | (lua_id,lua_uid,lua_ip,lua_channel,lua_version_code,lua_createtime,lua_updatetime,lua_device_type,lua_os_version,lua_device) |
| | | values |
| | | (#{id,jdbcType=BIGINT},#{uid,jdbcType=BIGINT},#{ip,jdbcType=VARCHAR},#{channel,jdbcType=VARCHAR},#{versionCode,jdbcType=VARCHAR},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP},#{deviceType,jdbcType=VARCHAR},#{osVersion,jdbcType=VARCHAR}) |
| | | (#{id,jdbcType=BIGINT},#{uid,jdbcType=BIGINT},#{ip,jdbcType=VARCHAR},#{channel,jdbcType=VARCHAR},#{versionCode,jdbcType=VARCHAR},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP},#{deviceType,jdbcType=VARCHAR},#{osVersion,jdbcType=VARCHAR},#{device,jdbcType=VARCHAR}) |
| | | </insert> |
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.user.UserActiveLog" |
| | | useGeneratedKeys="true" keyProperty="id"> |
| | |
| | | <if test="updateTime != null">lua_updatetime,</if> |
| | | <if test="deviceType != null">lua_device_type,</if> |
| | | <if test="osVersion != null">lua_os_version,</if> |
| | | <if test="device != null">lua_device,</if> |
| | | </trim> |
| | | values |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | |
| | | <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="deviceType != null">#{deviceType,jdbcType=VARCHAR},</if> |
| | | <if test="osVersion != null">#{osVersion,jdbcType=VARCHAR}</if> |
| | | <if test="osVersion != null">#{osVersion,jdbcType=VARCHAR},</if> |
| | | <if test="device != null">#{device,jdbcType=VARCHAR}</if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.user.UserActiveLog">update |
| | |
| | | #{createTime,jdbcType=TIMESTAMP},lua_updatetime = |
| | | #{updateTime,jdbcType=TIMESTAMP} ,lua_device_type |
| | | =#{deviceType,jdbcType=VARCHAR} ,lua_os_version |
| | | =#{osVersion,jdbcType=VARCHAR} where lua_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | =#{osVersion,jdbcType=VARCHAR},lua_device |
| | | =#{device,jdbcType=VARCHAR} where lua_id = #{id,jdbcType=BIGINT}</update> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.user.UserActiveLog"> |
| | | update yeshi_ec_log_user_active |
| | | <set> |
| | |
| | | <if test="versionCode != null">lua_version_code=#{versionCode,jdbcType=VARCHAR},</if> |
| | | <if test="createTime != null">lua_createtime=#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">lua_updatetime=#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="id !=null">lua_id =#{id,jdbcType=BIGINT},</if> |
| | | <if test="deviceType !=null">lua_device_type =#{deviceType,jdbcType=VARCHAR},</if> |
| | | <if test="osVersion !=null">lua_os_version =#{osVersion,jdbcType=VARCHAR},</if> |
| | | <if test="device !=null">lua_device =#{device,jdbcType=VARCHAR},</if> |
| | | </set> |
| | | where lua_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | |
| | | <select id="countSameDayByChannel" resultType="java.util.HashMap"> |
| | | SELECT COALESCE(COUNT(*),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 (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 |
| | | WHERE 1=1 |
| | | <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="countSameDayAndBuyGoodsByChannel" resultType="java.util.HashMap"> |
| | | SELECT COALESCE(COUNT(DISTINCT 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 |
| | | <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 |
| | | </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}' |
| | | </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="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> |