Przeglądaj źródła

短视频修复BUG

半月无霜 4 lat temu
rodzic
commit
fcdcb44e3a
1 zmienionych plików z 9 dodań i 6 usunięć
  1. 9 6
      ymall/src/main/resources/mapper/VideoMapper.xml

+ 9 - 6
ymall/src/main/resources/mapper/VideoMapper.xml

@@ -127,7 +127,7 @@
 
 
   <select id="getVideoByHome" resultMap="videoMap">
-    select <include refid="baseColumn" />,
+    select DISTINCT <include refid="baseColumn" />,
     (select count(*) from video_like_intermediate where superior_id=v.ID )+v.dummy_like_frequency like_frequency,
     (select count(*) from video_statistics_intermediate where superior_id=v.ID and Type=7 )+v.dummy_frequency_of_play frequency_of_play,
     (select count(*) from video_statistics_intermediate where superior_id=v.ID and Type=6 )+v.dummy_share_frequency share_frequency,
@@ -152,13 +152,16 @@
   </select>
 
   <select id="countVideoByHome" resultType="java.lang.Integer">
-    select count(*)
+    SELECT COUNT(1) FROM
+    (
+    select DISTINCT v.id
     from video v
-    left join  doctor d  on (case when v.doctor_id='' then null else v.doctor_id::uuid = d.id end)
-    left join video_statistics_intermediate si on v.id=si.superior_id and si.type=7 and si.subordinate_id= #{userId}
-    left join video_user_attention ua on v.doctor_id=ua.superior_id and ua.subordinate_id= #{userId}
-    left join video_like_intermediate li on v.id=li.superior_id and li.subordinate_id= #{userId}
+      left join  doctor d  on (case when v.doctor_id='' then null else v.doctor_id::uuid = d.id end)
+      left join video_statistics_intermediate si on v.id=si.superior_id and si.type=7 and si.subordinate_id= #{userId}
+      left join video_user_attention ua on v.doctor_id=ua.superior_id and ua.subordinate_id= #{userId}
+      left join video_like_intermediate li on v.id=li.superior_id and li.subordinate_id= #{userId}
     where 1=1 ${filterSql}
+    ) T
   </select>
 
 </mapper>