|
@@ -42,47 +42,49 @@
|
|
|
where lb.delete_flag = 0 and lb.blocker_type = 2 and lb.blocked_type = 2
|
|
where lb.delete_flag = 0 and lb.blocker_type = 2 and lb.blocked_type = 2
|
|
|
and lb.blocker_id = #{userId}
|
|
and lb.blocker_id = #{userId}
|
|
|
)
|
|
)
|
|
|
- SELECT
|
|
|
|
|
- g.id,
|
|
|
|
|
- g.user_id,
|
|
|
|
|
- g.title,
|
|
|
|
|
- g.description,
|
|
|
|
|
- g.price,
|
|
|
|
|
- g.price as amount,
|
|
|
|
|
- g.position,
|
|
|
|
|
- g.like_count,
|
|
|
|
|
- g.collect_count,
|
|
|
|
|
- g.category_one_id,
|
|
|
|
|
- g.category_two_id,
|
|
|
|
|
- g.label,
|
|
|
|
|
- g.topic,
|
|
|
|
|
- g.trade_id,
|
|
|
|
|
- g.created_time,
|
|
|
|
|
- g.created_user_id,
|
|
|
|
|
- g.updated_time,
|
|
|
|
|
- g.updated_user_id,
|
|
|
|
|
- u.user_name,
|
|
|
|
|
- u.user_image,
|
|
|
|
|
- g.goods_status,
|
|
|
|
|
- g.delete_flag,
|
|
|
|
|
- g.release_time,
|
|
|
|
|
- g.video_first_frame,
|
|
|
|
|
- ROUND(ST_Distance_Sphere(ST_GeomFromText(CONCAT('POINT(', REPLACE(#{position}, ',', ' '), ')' )), ST_GeomFromText(CONCAT('POINT(', REPLACE(g.position, ',', ' '), ')' ))) / 1000, 2) AS dist,
|
|
|
|
|
- case when llr.id is null then '0' else '1' end likeStatus,
|
|
|
|
|
- g.home_image,
|
|
|
|
|
- CONCAT('user_', u.user_phone) as user_phone
|
|
|
|
|
- FROM
|
|
|
|
|
- second_goods g inner join life_user u on u.id = g.user_id and u.delete_flag = 0
|
|
|
|
|
- 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
|
|
|
|
|
- where g.delete_flag = 0
|
|
|
|
|
- <if test="typeId != null and typeId != '' ">
|
|
|
|
|
- and (g.category_one_id = #{typeId} or g.category_two_id =#{typeId} )
|
|
|
|
|
- </if>
|
|
|
|
|
- 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)
|
|
|
|
|
- and g.goods_status = 3
|
|
|
|
|
- and g.position != '' and g.position is not null
|
|
|
|
|
- order by dist, like_count desc, release_time desc
|
|
|
|
|
|
|
+ SELECT * FROM (
|
|
|
|
|
+ SELECT
|
|
|
|
|
+ g.id,
|
|
|
|
|
+ g.user_id,
|
|
|
|
|
+ g.title,
|
|
|
|
|
+ g.description,
|
|
|
|
|
+ g.price,
|
|
|
|
|
+ g.price as amount,
|
|
|
|
|
+ g.position,
|
|
|
|
|
+ g.like_count,
|
|
|
|
|
+ g.collect_count,
|
|
|
|
|
+ g.category_one_id,
|
|
|
|
|
+ g.category_two_id,
|
|
|
|
|
+ g.label,
|
|
|
|
|
+ g.topic,
|
|
|
|
|
+ g.trade_id,
|
|
|
|
|
+ g.created_time,
|
|
|
|
|
+ g.created_user_id,
|
|
|
|
|
+ g.updated_time,
|
|
|
|
|
+ g.updated_user_id,
|
|
|
|
|
+ u.user_name,
|
|
|
|
|
+ u.user_image,
|
|
|
|
|
+ g.goods_status,
|
|
|
|
|
+ g.delete_flag,
|
|
|
|
|
+ g.release_time,
|
|
|
|
|
+ g.video_first_frame,
|
|
|
|
|
+ ROUND(ST_Distance_Sphere(ST_GeomFromText(CONCAT('POINT(', REPLACE(#{position}, ',', ' '), ')' )), ST_GeomFromText(CONCAT('POINT(', REPLACE(g.position, ',', ' '), ')' ))) / 1000, 2) AS dist,
|
|
|
|
|
+ case when llr.id is null then '0' else '1' end likeStatus,
|
|
|
|
|
+ g.home_image,
|
|
|
|
|
+ CONCAT('user_', u.user_phone) as user_phone
|
|
|
|
|
+ FROM
|
|
|
|
|
+ second_goods g inner join life_user u on u.id = g.user_id and u.delete_flag = 0
|
|
|
|
|
+ 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
|
|
|
|
|
+ where g.delete_flag = 0
|
|
|
|
|
+ <if test="typeId != null and typeId != '' ">
|
|
|
|
|
+ and (g.category_one_id = #{typeId} or g.category_two_id =#{typeId} )
|
|
|
|
|
+ </if>
|
|
|
|
|
+ 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)
|
|
|
|
|
+ and g.goods_status = 3
|
|
|
|
|
+ and g.position != '' and g.position is not null
|
|
|
|
|
+ order by dist, like_count desc, release_time desc
|
|
|
|
|
+ ) a where a.dist < #{radiusKm}
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
<!-- 分页查询关注数据concern -->
|
|
<!-- 分页查询关注数据concern -->
|
|
@@ -173,49 +175,51 @@
|
|
|
where lb.delete_flag = 0 and lb.blocker_type = 2 and lb.blocked_type = 2
|
|
where lb.delete_flag = 0 and lb.blocker_type = 2 and lb.blocked_type = 2
|
|
|
and lb.blocker_id = #{userId}
|
|
and lb.blocker_id = #{userId}
|
|
|
)
|
|
)
|
|
|
- SELECT
|
|
|
|
|
- g.id,
|
|
|
|
|
- g.user_id,
|
|
|
|
|
- g.title,
|
|
|
|
|
- g.description,
|
|
|
|
|
- g.price,
|
|
|
|
|
- g.price as amount,
|
|
|
|
|
- g.position,
|
|
|
|
|
- g.like_count,
|
|
|
|
|
- g.collect_count,
|
|
|
|
|
- g.category_one_id,
|
|
|
|
|
- g.category_two_id,
|
|
|
|
|
- g.label,
|
|
|
|
|
- g.topic,
|
|
|
|
|
- g.trade_id,
|
|
|
|
|
- g.created_time,
|
|
|
|
|
- g.created_user_id,
|
|
|
|
|
- g.updated_time,
|
|
|
|
|
- g.updated_user_id,
|
|
|
|
|
- g.release_time,
|
|
|
|
|
- u.user_name,
|
|
|
|
|
- u.user_image,
|
|
|
|
|
- CONCAT('user_', u.user_phone) as user_phone,
|
|
|
|
|
- g.goods_status,
|
|
|
|
|
- g.delete_flag,
|
|
|
|
|
- ROUND(ST_Distance_Sphere(ST_GeomFromText(CONCAT('POINT(', REPLACE(#{position}, ',', ' '), ')' )), ST_GeomFromText(CONCAT('POINT(', REPLACE(g.position, ',', ' '), ')' ))) / 1000, 2) AS dist,
|
|
|
|
|
- g.home_image,
|
|
|
|
|
- g.video_first_frame,
|
|
|
|
|
- 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
|
|
|
|
|
- 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
|
|
|
|
|
- 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)
|
|
|
|
|
- and g.goods_status = 3
|
|
|
|
|
- and g.position != '' and g.position is not null
|
|
|
|
|
- order by g.release_time desc
|
|
|
|
|
|
|
+ SELECT * FROM (
|
|
|
|
|
+ SELECT
|
|
|
|
|
+ g.id,
|
|
|
|
|
+ g.user_id,
|
|
|
|
|
+ g.title,
|
|
|
|
|
+ g.description,
|
|
|
|
|
+ g.price,
|
|
|
|
|
+ g.price as amount,
|
|
|
|
|
+ g.position,
|
|
|
|
|
+ g.like_count,
|
|
|
|
|
+ g.collect_count,
|
|
|
|
|
+ g.category_one_id,
|
|
|
|
|
+ g.category_two_id,
|
|
|
|
|
+ g.label,
|
|
|
|
|
+ g.topic,
|
|
|
|
|
+ g.trade_id,
|
|
|
|
|
+ g.created_time,
|
|
|
|
|
+ g.created_user_id,
|
|
|
|
|
+ g.updated_time,
|
|
|
|
|
+ g.updated_user_id,
|
|
|
|
|
+ g.release_time,
|
|
|
|
|
+ u.user_name,
|
|
|
|
|
+ u.user_image,
|
|
|
|
|
+ CONCAT('user_', u.user_phone) as user_phone,
|
|
|
|
|
+ g.goods_status,
|
|
|
|
|
+ g.delete_flag,
|
|
|
|
|
+ ROUND(ST_Distance_Sphere(ST_GeomFromText(CONCAT('POINT(', REPLACE(#{position}, ',', ' '), ')' )), ST_GeomFromText(CONCAT('POINT(', REPLACE(g.position, ',', ' '), ')' ))) / 1000, 2) AS dist,
|
|
|
|
|
+ g.home_image,
|
|
|
|
|
+ g.video_first_frame,
|
|
|
|
|
+ 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
|
|
|
|
|
+ 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
|
|
|
|
|
+ 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)
|
|
|
|
|
+ and g.goods_status = 3
|
|
|
|
|
+ and g.position != '' and g.position is not null
|
|
|
|
|
+ order by g.release_time desc
|
|
|
|
|
+ ) a where a.dist < #{radiusKm}
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
<select id="querySecondGoodsDetail" resultType="shop.alien.entity.second.vo.SecondGoodsRecommendVo">
|
|
<select id="querySecondGoodsDetail" resultType="shop.alien.entity.second.vo.SecondGoodsRecommendVo">
|