Browse Source

bug修改

zjy 1 day ago
parent
commit
3f59c0719b

+ 1 - 1
alien-entity/src/main/java/shop/alien/mapper/second/SecondRecommendMapper.java

@@ -19,7 +19,7 @@ public interface SecondRecommendMapper extends BaseMapper<SecondGoodsRecommendVo
      */
      */
     IPage<SecondGoodsRecommendVo> getSecondRecommendByPage(IPage<SecondGoodsRecommendVo> page, @Param("userId") Integer userId, @Param("position") String position, @Param("typeId") Integer typeId, @Param("phoneId") String phoneId);
     IPage<SecondGoodsRecommendVo> getSecondRecommendByPage(IPage<SecondGoodsRecommendVo> page, @Param("userId") Integer userId, @Param("position") String position, @Param("typeId") Integer typeId, @Param("phoneId") String phoneId);
 
 
-    IPage<SecondGoodsRecommendVo> querySecondConcernByPage(IPage<SecondGoodsRecommendVo> page, @Param("phoneId") String phoneId, @Param("position") String position);
+    IPage<SecondGoodsRecommendVo> querySecondConcernByPage(IPage<SecondGoodsRecommendVo> page, @Param("userId") Integer userId, @Param("phoneId") String phoneId, @Param("position") String position);
 
 
     IPage<SecondGoodsRecommendVo> querySecondNewGoodsByPage(IPage<SecondGoodsRecommendVo> page,@Param("userId") String userId, @Param("phoneId") String phoneId, @Param("position") String position);
     IPage<SecondGoodsRecommendVo> querySecondNewGoodsByPage(IPage<SecondGoodsRecommendVo> page,@Param("userId") String userId, @Param("phoneId") String phoneId, @Param("position") String position);
 
 

+ 11 - 7
alien-entity/src/main/resources/mapper/second/SecondGoodsInfoMapper.xml

@@ -84,6 +84,12 @@
 
 
     <!-- 分页查询关注数据concern -->
     <!-- 分页查询关注数据concern -->
     <select id="querySecondConcernByPage" resultType="shop.alien.entity.second.vo.SecondGoodsRecommendVo">
     <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
         select
             g.id,
             g.id,
             g.user_id,
             g.user_id,
@@ -109,8 +115,7 @@
             g.home_image,
             g.home_image,
             case when llr.id is null then '0' else '1' end likeStatus,
             case when llr.id is null then '0' else '1' end likeStatus,
             case when lc.id is null then '0' else '1' end collectStatus,
             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
         from
             life_fans f inner join life_user u on
             life_fans f inner join life_user u on
                 f.followed_id = CONCAT('user_', u.user_phone) and u.delete_flag = 0
                 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
             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
         where
             f.fans_id = #{phoneId} and f.delete_flag = 0
             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
         order by g.release_time desc
     </select>
     </select>
 
 
@@ -188,10 +195,9 @@
             g.home_image,
             g.home_image,
             case when llr.id is null then '0' else '1' end likeStatus,
             case when llr.id is null then '0' else '1' end likeStatus,
             case when lc.id is null then '0' else '1' end collectStatus,
             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
         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_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
             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
         where g.delete_flag = 0
@@ -222,8 +228,6 @@
             lu.user_image,
             lu.user_image,
             goods_status,
             goods_status,
             ROUND(ST_Distance_Sphere(ST_GeomFromText(CONCAT('POINT(', REPLACE(#{position}, ',', ' '), ')' )), ST_GeomFromText(CONCAT('POINT(', REPLACE(g.position, ',', ' '), ')' ))) / 1000, 2) AS dist,
             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 llr.id is null then '0' else '1' end likeStatus,
             case when lc.id is null then '0' else '1' end collectStatus
             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
         from second_goods g inner join life_user lu on g.user_id = lu.id and lu.delete_flag = 0

+ 3 - 1
alien-second/src/main/java/shop/alien/second/service/impl/SecondRecommendServiceImpl.java

@@ -86,13 +86,15 @@ public class SecondRecommendServiceImpl extends ServiceImpl<SecondRecommendMappe
         try {
         try {
             JSONObject data = JwtUtil.getCurrentUserInfo();
             JSONObject data = JwtUtil.getCurrentUserInfo();
             String phoneId = null;
             String phoneId = null;
+            Integer userId = null;
             if (data != null) {
             if (data != null) {
                 phoneId = data.getString("phone");
                 phoneId = data.getString("phone");
+                userId = data.getInteger("userId");
             }
             }
             if (StringUtil.isBlank(phoneId)) {
             if (StringUtil.isBlank(phoneId)) {
                 return null;
                 return null;
             }
             }
-            IPage<SecondGoodsRecommendVo> list = mapper.querySecondConcernByPage(page, "user_" + phoneId, position);
+            IPage<SecondGoodsRecommendVo> list = mapper.querySecondConcernByPage(page, userId, "user_" + phoneId, position);
             List<Integer> idList = list.getRecords().stream() // 创建流
             List<Integer> idList = list.getRecords().stream() // 创建流
                     .map(obj -> obj.getId())   // 提取每个元素的 ID
                     .map(obj -> obj.getId())   // 提取每个元素的 ID
                     .collect(Collectors.toList());
                     .collect(Collectors.toList());