|
@@ -157,7 +157,7 @@
|
|
|
LEFT JOIN cm_user_search_frequency cusf ON cusf.id = csk.searchId
|
|
|
<where>
|
|
|
csk.shopId = #{shopId}
|
|
|
- and csk.delFlag = 0 and cusf.delStatus = 0
|
|
|
+ and csk.delFlag = 0 and cusf.delStatus = 1
|
|
|
<if test="keyword != null and keyword != ''">
|
|
|
and cusf.keyword like concat('%',#{keyword},'%')
|
|
|
</if>
|
|
@@ -294,18 +294,15 @@
|
|
|
cps.shopId,
|
|
|
s.name AS shopName,
|
|
|
cps.shopLink,
|
|
|
- cps.accessNumber,
|
|
|
- cps.accessDuration,
|
|
|
- ifnull((cps.accessDuration / cps.accessNumber), 0) AS averageDuration
|
|
|
+ IFNULL(SUM(cps.accessNumber), 0) AS accessNumber,
|
|
|
+ IFNULL(SUM(cps.accessDuration), 0) AS accessDuration,
|
|
|
+ IFNULL((IFNULL(SUM(cps.accessDuration), 0) / IFNULL(SUM(cps.accessNumber), 0)), 0) AS averageDuration
|
|
|
FROM cm_page_shop cps
|
|
|
LEFT JOIN shop s ON s.shopId = cps.shopId
|
|
|
<where>
|
|
|
cps.shopId = #{shopId}
|
|
|
- <if test="startTime != null and startTime != ''">
|
|
|
- and cps.accessDate <![CDATA[ > ]]> #{startTime}
|
|
|
- </if>
|
|
|
- <if test="endTime != null and endTime != ''">
|
|
|
- and cps.accessDate <![CDATA[ < ]]> #{endTime}
|
|
|
+ <if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
|
|
|
+ and cps.accessDate BETWEEN #{startTime} and #{endTime}
|
|
|
</if>
|
|
|
</where>
|
|
|
group by cps.shopId
|
|
@@ -320,20 +317,17 @@
|
|
|
p.mainImage,
|
|
|
copi.validFlag,
|
|
|
cpsp.link,
|
|
|
- cpsp.accessNumber,
|
|
|
- cpsp.accessDuration,
|
|
|
- ifnull((cpsp.accessDuration / cpsp.accessNumber), 0) AS averageDuration
|
|
|
+ IFNULL(SUM(cpsp.accessNumber), 0) AS accessNumber,
|
|
|
+ IFNULL(SUM(cpsp.accessDuration), 0) AS accessDuration,
|
|
|
+ IFNULL((IFNULL(SUM(cpsp.accessDuration), 0) / IFNULL(SUM(cpsp.accessNumber), 0)), 0) AS averageDuration
|
|
|
FROM cm_page_shop_product cpsp
|
|
|
LEFT JOIN product p ON p.productId = cpsp.productId
|
|
|
LEFT JOIN cm_organize_product_info copi ON copi.productId = cpsp.productId
|
|
|
WHERE cpsp.shopId = #{shopId} and copi.organizeId = 0
|
|
|
- <if test="startTime != null and startTime != ''">
|
|
|
- and cpsp.accessDate <![CDATA[ > ]]> #{startTime}
|
|
|
- </if>
|
|
|
- <if test="endTime != null and endTime != ''">
|
|
|
- and cpsp.accessDate <![CDATA[ < ]]> #{endTime}
|
|
|
+ <if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
|
|
|
+ and cpsp.accessDate BETWEEN #{startTime} and #{endTime}
|
|
|
</if>
|
|
|
- group by cpsp.shopId
|
|
|
+ group by cpsp.productId
|
|
|
</select>
|
|
|
|
|
|
<select id="getPageShopInfo" resultType="com.caimei365.manager.entity.caimei.cmUser.CmPageShopInfo">
|
|
@@ -345,19 +339,16 @@
|
|
|
i.title,
|
|
|
i.onlineStatus,
|
|
|
cpsi.link,
|
|
|
- cpsi.accessNumber,
|
|
|
- cpsi.accessDuration,
|
|
|
- ifnull((cpsi.accessDuration / cpsi.accessNumber), 0) AS averageDuration
|
|
|
+ IFNULL(SUM(cpsi.accessNumber), 0) AS accessNumber,
|
|
|
+ IFNULL(SUM(cpsi.accessDuration), 0) AS accessDuration,
|
|
|
+ IFNULL((IFNULL(SUM(cpsi.accessDuration), 0) / IFNULL(SUM(cpsi.accessNumber), 0)), 0) AS averageDuration
|
|
|
FROM cm_page_shop_info cpsi
|
|
|
LEFT JOIN info i ON i.id = cpsi.infoId
|
|
|
WHERE cpsi.shopId = #{shopId}
|
|
|
- <if test="startTime != null and startTime != ''">
|
|
|
- and cpsi.accessDate <![CDATA[ > ]]> #{startTime}
|
|
|
+ <if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
|
|
|
+ and cpsi.accessDate BETWEEN #{startTime} and #{endTime}
|
|
|
</if>
|
|
|
- <if test="endTime != null and endTime != ''">
|
|
|
- and cpsi.accessDate <![CDATA[ < ]]> #{endTime}
|
|
|
- </if>
|
|
|
- group by cpsi.shopId
|
|
|
+ group by cpsi.infoId
|
|
|
</select>
|
|
|
|
|
|
<select id="getPageShopKeyword" resultType="com.caimei365.manager.entity.caimei.cmUser.CmPageShopKeyword">
|
|
@@ -366,18 +357,15 @@
|
|
|
cpsk.shopId,
|
|
|
cusf.keyword,
|
|
|
cpsk.link,
|
|
|
- cpsk.accessNumber,
|
|
|
- cpsk.accessDuration,
|
|
|
- ifnull((cpsk.accessDuration / cpsk.accessNumber), 0) AS averageDuration
|
|
|
+ IFNULL(SUM(cpsk.accessNumber), 0) AS accessNumber,
|
|
|
+ IFNULL(SUM(cpsk.accessDuration), 0) AS accessDuration,
|
|
|
+ IFNULL((IFNULL(SUM(cpsk.accessDuration), 0) / IFNULL(SUM(cpsk.accessNumber), 0)), 0) AS averageDuration
|
|
|
FROM cm_page_shop_keyword cpsk
|
|
|
LEFT JOIN cm_user_search_frequency cusf ON cusf.id = cpsk.searchId
|
|
|
WHERE cpsk.shopId = #{shopId}
|
|
|
- <if test="startTime != null and startTime != ''">
|
|
|
- and cpsk.accessDate <![CDATA[ > ]]> #{startTime}
|
|
|
- </if>
|
|
|
- <if test="endTime != null and endTime != ''">
|
|
|
- and cpsk.accessDate <![CDATA[ < ]]> #{endTime}
|
|
|
+ <if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
|
|
|
+ and cpsk.accessDate BETWEEN #{startTime} and #{endTime}
|
|
|
</if>
|
|
|
- group by cpsk.shopId
|
|
|
+ group by cpsk.searchId
|
|
|
</select>
|
|
|
</mapper>
|