76 lines
2.7 KiB
XML
76 lines
2.7 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.ruoyi.xkt.mapper.UserSubscriptionsMapper">
|
|
|
|
<select id="selectUserSubscPage" resultType="com.ruoyi.xkt.dto.userSubscriptions.UserSubscPageResDTO">
|
|
SELECT
|
|
us.id AS userSubscId,
|
|
us.store_id,
|
|
s.store_name,
|
|
s.contact_phone,
|
|
s.contact_back_phone,
|
|
s.wechat_account,
|
|
s.qq_account,
|
|
s.store_logo_id,
|
|
s.store_address,
|
|
s.del_flag AS storeDelFlag,
|
|
DATEDIFF(CURDATE(), DATE(us.create_time)) AS focusDays
|
|
FROM
|
|
user_subscriptions us
|
|
JOIN store s ON us.store_id = s.id
|
|
WHERE
|
|
us.del_flag = 0 AND us.user_id = #{userId}
|
|
<if test="storeName != null and storeName != ''">and s.store_name LIKE CONCAT('%', #{storeName}, '%')</if>
|
|
ORDER BY
|
|
us.id DESC
|
|
</select>
|
|
|
|
<select id="selectTop10List" resultType="com.ruoyi.xkt.dto.dailyStoreTag.DailyStoreTagDTO">
|
|
SELECT
|
|
us.store_id,
|
|
SUM( us.id ) AS count
|
|
FROM
|
|
user_subscriptions us
|
|
WHERE
|
|
us.del_flag = 0
|
|
GROUP BY
|
|
us.store_id
|
|
ORDER BY
|
|
count DESC
|
|
</select>
|
|
|
|
<select id="getOverall" resultType="com.ruoyi.xkt.dto.userIndex.UserOverallResDTO">
|
|
SELECT
|
|
( SELECT COUNT( sc.id ) FROM shopping_cart sc WHERE sc.user_id = #{userId} AND sc.del_flag = 0 ) AS shoppingCartCount,
|
|
( SELECT COUNT( us.id ) FROM user_subscriptions us WHERE us.user_id = #{userId} AND us.del_flag = 0 ) AS focusStoreCount,
|
|
( SELECT COUNT( uf.id ) FROM user_favorites uf WHERE uf.user_id = #{userId} AND uf.del_flag = 0 ) AS collectProdCount,
|
|
( SELECT COUNT( so.id ) FROM store_order so WHERE so.order_user_id = #{userId} AND so.del_flag = 0 ) AS sendOrderCount
|
|
</select>
|
|
|
|
<select id="selectUserFocusList">
|
|
SELECT
|
|
us.user_id
|
|
FROM
|
|
user_subscriptions us
|
|
WHERE
|
|
us.store_id = #{storeId} AND us.del_flag = 0
|
|
</select>
|
|
|
|
<select id="selectFocusAndFavUserIdList" resultType="com.ruoyi.xkt.dto.userNotice.UserFocusAndFavUserIdDTO">
|
|
SELECT us.user_id, 3 AS targetNoticeType
|
|
FROM user_subscriptions us
|
|
WHERE us.del_flag = 0
|
|
AND us.store_id = #{storeId}
|
|
|
|
UNION
|
|
|
|
SELECT uf.user_id , 4 AS targetNoticeType
|
|
FROM user_favorites uf
|
|
WHERE uf.del_flag = 0
|
|
AND uf.store_prod_id = #{storeProdId}
|
|
</select>
|
|
|
|
|
|
</mapper> |