149 lines
5.1 KiB
XML
149 lines
5.1 KiB
XML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
<mapper namespace="com.suisung.mall.shop.analytics.mapper.AnalyticsSysDao">
|
|
<select id="getVisitor" resultType="com.suisung.mall.common.pojo.vo.VisitorVo">
|
|
SELECT
|
|
COUNT(*) AS num
|
|
FROM
|
|
analytics_access_history
|
|
WHERE
|
|
1
|
|
AND access_time BETWEEN #{startTime} AND #{endTime}
|
|
</select>
|
|
|
|
<select id="getAccessNum" resultType="com.suisung.mall.common.pojo.vo.CommonNumVo">
|
|
SELECT
|
|
COUNT(*) AS num
|
|
FROM
|
|
analytics_access_history
|
|
<where>
|
|
<if test="startTime!=null and endTime!=null">
|
|
AND access_time BETWEEN #{startTime} AND #{endTime}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<select id="getVisitorNum" resultType="com.suisung.mall.common.pojo.vo.CommonNumVo">
|
|
SELECT
|
|
COUNT(DISTINCT ( access_client_id )) AS num
|
|
FROM
|
|
analytics_access_history
|
|
<where>
|
|
<if test="startTime!=null and endTime!=null">
|
|
AND access_time BETWEEN #{startTime} AND #{endTime}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
|
|
<select id="getAccessItemTimeLine" resultType="com.suisung.mall.common.pojo.output.TimelineOutput">
|
|
SELECT count(*) num,
|
|
from_unixtime(round(access_time / 1000), '%m-%d') AS time
|
|
FROM analytics_access_history
|
|
<where>
|
|
<if test="startTime!=null and endTime!=null">
|
|
AND access_time BETWEEN #{startTime} AND #{endTime}
|
|
</if>
|
|
<if test="itemId!=null">
|
|
AND item_id = #{itemId}
|
|
</if>
|
|
<if test="storeId!=null">
|
|
AND store_id = #{storeId}
|
|
</if>
|
|
</where>
|
|
GROUP BY time
|
|
ORDER BY access_time
|
|
</select>
|
|
|
|
|
|
<select id="getAccessItemNum" resultType="com.suisung.mall.common.pojo.vo.CommonNumVo">
|
|
SELECT count(*) num
|
|
FROM analytics_access_history
|
|
<where>
|
|
<if test="startTime!=null and endTime!=null">
|
|
AND access_time BETWEEN #{startTime} AND #{endTime}
|
|
</if>
|
|
<if test="itemId!=null">
|
|
AND item_id = #{itemId}
|
|
</if>
|
|
<if test="storeId!=null">
|
|
AND store_id = #{storeId}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
|
|
<select id="getAccessItemUserTimeLine" resultType="com.suisung.mall.common.pojo.output.TimelineOutput">
|
|
SELECT
|
|
count( DISTINCT ( access_client_id ) ) AS num,
|
|
from_unixtime(round(access_time / 1000), '%m-%d') AS time
|
|
FROM analytics_access_history
|
|
<where>
|
|
<if test="startTime!=null and endTime!=null">
|
|
AND access_time BETWEEN #{startTime} AND #{endTime}
|
|
</if>
|
|
<if test="itemId!=null">
|
|
AND item_id = #{itemId}
|
|
</if>
|
|
<if test="storeId!=null">
|
|
AND store_id = #{storeId}
|
|
</if>
|
|
</where>
|
|
GROUP BY time
|
|
ORDER BY access_time
|
|
</select>
|
|
|
|
<select id="getAccessItemUserNum" resultType="com.suisung.mall.common.pojo.vo.CommonNumVo">
|
|
SELECT count(DISTINCT ( access_client_id )) num
|
|
FROM analytics_access_history
|
|
<where>
|
|
<if test="startTime!=null and endTime!=null">
|
|
AND access_time BETWEEN #{startTime} AND #{endTime}
|
|
</if>
|
|
<if test="itemId!=null">
|
|
AND item_id = #{itemId}
|
|
</if>
|
|
<if test="storeId!=null">
|
|
AND store_id = #{storeId}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
|
|
<select id="getAccessVisitorTimeLine" resultType="com.suisung.mall.common.pojo.output.TimelineOutput">
|
|
SELECT count(*) num,
|
|
from_unixtime(round(access_time / 1000), '%m-%d') AS time
|
|
FROM analytics_access_history
|
|
<where>
|
|
<if test="startTime!=null and endTime!=null">
|
|
AND access_time BETWEEN #{startTime} AND #{endTime}
|
|
</if>
|
|
</where>
|
|
GROUP BY time
|
|
ORDER BY access_time
|
|
</select>
|
|
<select id="listAccessItem"
|
|
resultType="com.suisung.mall.common.pojo.output.AnalyticsAccessItemOutput">
|
|
SELECT ash.item_id,ppi.item_name,ppi.product_id,ppi.item_unit_price,ppb.product_name,
|
|
COUNT(*) AS num
|
|
FROM analytics_access_history ash
|
|
INNER JOIN shop_product_item ppi on ash.item_id = ppi.item_id
|
|
INNER JOIN shop_product_base ppb on ppi.product_id = ppb.product_id
|
|
<where>
|
|
<if test="params.stime!=null and params.etime!=null">
|
|
AND ash.access_time BETWEEN #{params.stime} AND #{params.etime}
|
|
</if>
|
|
<if test="params.itemId != null">
|
|
AND ash.item_id = #{params.itemId}
|
|
</if>
|
|
<if test="storeId!=null">
|
|
AND sh.store_id = #{storeId}
|
|
</if>
|
|
</where>
|
|
GROUP BY ash.item_id
|
|
ORDER BY num DESC
|
|
LIMIT 0, 100
|
|
</select>
|
|
|
|
</mapper>
|