26
0

2 کامیت‌ها b5d75414c7 ... d2a5a09afa

نویسنده SHA1 پیام تاریخ
  zjy d2a5a09afa Merge remote-tracking branch 'origin/master' 1 هفته پیش
  zjy ccb98c7870 修改bug 1 هفته پیش
1فایلهای تغییر یافته به همراه6 افزوده شده و 3 حذف شده
  1. 6 3
      alien-entity/src/main/resources/mapper/second/SecondGoodsInfoMapper.xml

+ 6 - 3
alien-entity/src/main/resources/mapper/second/SecondGoodsInfoMapper.xml

@@ -102,7 +102,8 @@
             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 store_comment c where c.business_id = g.id and c.business_type = 1 and c.delete_flag = 0) as commentCount
+            (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.business_id = d.id and business_type = 6 and delete_flag = 0) a ) 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
@@ -178,7 +179,8 @@
             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 store_comment c where c.business_id = g.id and c.business_type = 1 and c.delete_flag = 0) as commentCount
+            (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.business_id = d.id and business_type = 6 and delete_flag = 0) a ) 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
@@ -211,7 +213,8 @@
             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 store_comment c where c.business_id = g.id and c.business_type = 6 and c.delete_flag = 0) as commentCount,
+            (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.business_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