|
@@ -85,4 +85,88 @@
|
|
|
</if>
|
|
|
) h
|
|
|
</select>
|
|
|
+ <select id="queryCommentReplyLikeCount" resultType="java.lang.Integer">
|
|
|
+ select sum(count) sum from (
|
|
|
+ select
|
|
|
+ a.user_id, count(1) count
|
|
|
+ from community_article a
|
|
|
+ left join community_like b
|
|
|
+ on a.id = b.article_id
|
|
|
+ where (a.is_delete != 1 or a.is_delete is null)
|
|
|
+ and b.id is not null
|
|
|
+ and a.user_id = #{userId}
|
|
|
+
|
|
|
+ GROUP BY a.user_id
|
|
|
+ union ALL
|
|
|
+ select
|
|
|
+ a.user_id,count(1) count
|
|
|
+ from
|
|
|
+ community_article_comment a
|
|
|
+ left join community_comment_like b
|
|
|
+ on a.id = b.comment_id
|
|
|
+ where (a.is_delete != 1 or a.is_delete is null)
|
|
|
+ and b.id is not null and EXISTS (select distinct id from community_article z where a.article_id = z.id and (z.is_delete != 1 or z.is_delete is null))
|
|
|
+ and a.user_id = #{userId}
|
|
|
+ group by a.user_id
|
|
|
+ union all
|
|
|
+ select
|
|
|
+ b.user_id,count(1) count
|
|
|
+ from
|
|
|
+ community_article_comment a
|
|
|
+ left join community_comment_reply b on a.id = b.comment_id
|
|
|
+ left join community_comment_like c on b.id = c.reply_id
|
|
|
+ where
|
|
|
+ b.user_id = #{userId}
|
|
|
+ and b.id is not null
|
|
|
+ and c.id is not null
|
|
|
+ and (a.is_delete != 1 or a.is_delete is null)
|
|
|
+ and (b.is_delete != 1 or b.is_delete is null)
|
|
|
+ and EXISTS (select distinct id from community_article z where a.article_id = z.id and (z.is_delete != 1 or z.is_delete is null))
|
|
|
+ group by b.user_id ) AA
|
|
|
+ group by user_id
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="queryCommentReplyLikeCountPerson" resultType="java.lang.Integer">
|
|
|
+ select count(*) from (
|
|
|
+ select user_id,sum(count) counts from (
|
|
|
+ select
|
|
|
+ a.user_id, count(1) count
|
|
|
+ from community_article a
|
|
|
+ left join community_like b
|
|
|
+ on a.id = b.article_id
|
|
|
+ where (a.is_delete != 1 or a.is_delete is null)
|
|
|
+ and b.id is not null
|
|
|
+ GROUP BY a.user_id
|
|
|
+ union ALL
|
|
|
+ select
|
|
|
+ a.user_id,count(1) count
|
|
|
+ from
|
|
|
+ community_article_comment a
|
|
|
+ left join community_comment_like b
|
|
|
+ on a.id = b.comment_id
|
|
|
+ where (a.is_delete != 1 or a.is_delete is null)
|
|
|
+ and b.id is not null and EXISTS (select distinct id from community_article z where a.article_id = z.id and (z.is_delete != 1 or z.is_delete is null))
|
|
|
+ group by a.user_id
|
|
|
+ union all
|
|
|
+ select
|
|
|
+ b.user_id,count(1) count
|
|
|
+ from
|
|
|
+ community_article_comment a
|
|
|
+ left join community_comment_reply b on a.id = b.comment_id
|
|
|
+ left join community_comment_like c on b.id = c.reply_id
|
|
|
+ where
|
|
|
+ b.id is not null
|
|
|
+ and c.id is not null
|
|
|
+ and (a.is_delete != 1 or a.is_delete is null)
|
|
|
+ and (b.is_delete != 1 or b.is_delete is null)
|
|
|
+ and EXISTS (select distinct id from community_article z where a.article_id = z.id and (z.is_delete != 1 or z.is_delete is null))
|
|
|
+ group by b.user_id ) AA
|
|
|
+ group by user_id
|
|
|
+ <if test="likeSum != null and likeSum > 0">
|
|
|
+ HAVING counts <= #{likeSum}
|
|
|
+ </if>
|
|
|
+
|
|
|
+ ) BB
|
|
|
+
|
|
|
+ </select>
|
|
|
</mapper>
|