|
@@ -84,6 +84,12 @@
|
|
|
|
|
|
<!-- 分页查询关注数据concern -->
|
|
|
<select id="querySecondConcernByPage" resultType="shop.alien.entity.second.vo.SecondGoodsRecommendVo">
|
|
|
+ with shieldUser as (
|
|
|
+ select g.id from life_blacklist lb inner join second_goods g
|
|
|
+ on lb.blocked_id = g.user_id and g.delete_flag = '0' and g.goods_status = '3'
|
|
|
+ where lb.delete_flag = 0 and lb.blocker_type = 2 and lb.blocked_type = 2
|
|
|
+ and lb.blocker_id = #{userId}
|
|
|
+ )
|
|
|
select
|
|
|
g.id,
|
|
|
g.user_id,
|
|
@@ -109,8 +115,7 @@
|
|
|
g.home_image,
|
|
|
case when llr.id is null then '0' else '1' end likeStatus,
|
|
|
case when lc.id is null then '0' else '1' end collectStatus,
|
|
|
- (select count(1) from (SELECT id FROM store_comment c where c.business_id = g.id and c.business_type = 7 and c.delete_flag = 0 UNION ALL
|
|
|
- SELECT t.id FROM store_comment t INNER JOIN (SELECT id FROM store_comment c where c.business_id = g.id and c.business_type = 7 and c.delete_flag = 0) d ON t.reply_id = d.id and business_type = 6 and delete_flag = 0) a ) as commentCount
|
|
|
+ (SELECT count(1) FROM store_comment c where c.business_id = g.id and c.business_type = 7 and c.delete_flag = 0 ) as commentCount
|
|
|
from
|
|
|
life_fans f inner join life_user u on
|
|
|
f.followed_id = CONCAT('user_', u.user_phone) and u.delete_flag = 0
|
|
@@ -122,6 +127,8 @@
|
|
|
left join life_collect lc on lc.business_id = g.id and lc.user_id = #{phoneId} and lc.delete_flag = 0 and lc.business_type = 1
|
|
|
where
|
|
|
f.fans_id = #{phoneId} and f.delete_flag = 0
|
|
|
+ and not exists (select 1 from shieldUser s where s.id = g.id)
|
|
|
+ and not exists (select 1 from second_shield s where s.user_id = #{userId} and s.shield_type = 1 and s.shield_id = g.id and s.delete_flag = 0)
|
|
|
order by g.release_time desc
|
|
|
</select>
|
|
|
|
|
@@ -188,10 +195,9 @@
|
|
|
g.home_image,
|
|
|
case when llr.id is null then '0' else '1' end likeStatus,
|
|
|
case when lc.id is null then '0' else '1' end collectStatus,
|
|
|
- (select count(1) from (SELECT id FROM store_comment c where c.business_id = g.id and c.business_type = 7 and c.delete_flag = 0 UNION ALL
|
|
|
- SELECT t.id FROM store_comment t INNER JOIN (SELECT id FROM store_comment c where c.business_id = g.id and c.business_type = 7 and c.delete_flag = 0) d ON t.reply_id = d.id and business_type = 6 and delete_flag = 0) a ) as commentCount
|
|
|
+ (SELECT count(1) FROM store_comment c where c.business_id = g.id and c.business_type = 7 and c.delete_flag = 0 ) as commentCount
|
|
|
FROM
|
|
|
- second_goods g inner join life_user u on u.id = g.user_id
|
|
|
+ second_goods g inner join life_user u on u.id = g.user_id
|
|
|
left join life_like_record llr on llr.dianzan_id = #{phoneId} and llr.huifu_id = g.id and llr.type = 6 and llr.delete_flag = 0
|
|
|
left join life_collect lc on lc.business_id = g.id and lc.user_id = #{phoneId} and lc.delete_flag = 0 and lc.business_type = 1
|
|
|
where g.delete_flag = 0
|
|
@@ -222,8 +228,6 @@
|
|
|
lu.user_image,
|
|
|
goods_status,
|
|
|
ROUND(ST_Distance_Sphere(ST_GeomFromText(CONCAT('POINT(', REPLACE(#{position}, ',', ' '), ')' )), ST_GeomFromText(CONCAT('POINT(', REPLACE(g.position, ',', ' '), ')' ))) / 1000, 2) AS dist,
|
|
|
- (select count(1) from (SELECT id FROM store_comment c where c.business_id = g.id and c.business_type = 7 and c.delete_flag = 0 UNION ALL
|
|
|
- SELECT t.id FROM store_comment t INNER JOIN (SELECT id FROM store_comment c where c.business_id = g.id and c.business_type = 7 and c.delete_flag = 0) d ON t.reply_id = d.id and business_type = 6 and delete_flag = 0) a ) as commentCount,
|
|
|
case when llr.id is null then '0' else '1' end likeStatus,
|
|
|
case when lc.id is null then '0' else '1' end collectStatus
|
|
|
from second_goods g inner join life_user lu on g.user_id = lu.id and lu.delete_flag = 0
|