diff options
Diffstat (limited to 'juick-server/src/main/java/com/juick/service/MessagesServiceImpl.java')
-rw-r--r-- | juick-server/src/main/java/com/juick/service/MessagesServiceImpl.java | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/juick-server/src/main/java/com/juick/service/MessagesServiceImpl.java b/juick-server/src/main/java/com/juick/service/MessagesServiceImpl.java index 054503c1..ba721eea 100644 --- a/juick-server/src/main/java/com/juick/service/MessagesServiceImpl.java +++ b/juick-server/src/main/java/com/juick/service/MessagesServiceImpl.java @@ -517,18 +517,24 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ (before > 0 ? " message_id < :before AND " : StringUtils.EMPTY) + " (privacy >= 0 OR (privacy >= -2 AND privacy <= -1" + - " AND EXISTS (SELECT 1 FROM wl_users w WHERE w.wl_user_id = :uid and w.user_id = messages.user_id)))) " + + " AND EXISTS (SELECT 1 FROM wl_users w WHERE w.wl_user_id = :uid and w.user_id = messages.user_id))) " + + " AND NOT EXISTS (SELECT 1 FROM bl_tags bt WHERE bt.tag_id IN " + + "(SELECT tag_id FROM messages_tags WHERE message_id = messages.message_id) and :uid = bt.user_id))" + " UNION " + " (SELECT message_id FROM messages WHERE user_id=:uid " + (before > 0 ? " AND message_id < :before " : StringUtils.EMPTY) + (recommended ? ") UNION " + - " (SELECT f.message_id as message_id FROM favorites f WHERE " + + " (SELECT f.message_id as message_id FROM favorites f INNER JOIN messages ON " + + "f.message_id=messages.message_id WHERE " + "EXISTS (SELECT 1 FROM subscr_users s WHERE s.suser_id = :uid and f.user_id = s.user_id)" + (before > 0 ? " AND f.message_id < :before " : StringUtils.EMPTY) : StringUtils.EMPTY) + - ") ORDER BY message_id DESC LIMIT 20", + " AND NOT EXISTS (SELECT 1 FROM bl_users b WHERE b.user_id = :uid and b.bl_user_id = messages.user_id)" + + " AND NOT EXISTS (SELECT 1 FROM bl_tags bt WHERE bt.tag_id IN " + + "(SELECT tag_id FROM messages_tags WHERE message_id = messages.message_id) and :uid = bt.user_id)) " + + "ORDER BY message_id DESC LIMIT 20", sqlParameterSource, Integer.class); |