aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/juick/service
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2021-10-23 00:55:06 +0300
committerGravatar Vitaly Takmazov2021-10-23 01:01:14 +0300
commit26e4c1c4046914f064046229e927461d93bce534 (patch)
treeba1502cce1b683fbbf8d0e7dfa8dce41e2abd677 /src/main/java/com/juick/service
parentc2337749232a930776b4fa3680a813dd6a936ac8 (diff)
getUserBlogWithRecommendations: fix query
Diffstat (limited to 'src/main/java/com/juick/service')
-rw-r--r--src/main/java/com/juick/service/MessagesServiceImpl.java8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/main/java/com/juick/service/MessagesServiceImpl.java b/src/main/java/com/juick/service/MessagesServiceImpl.java
index b14e9261..b6a2edb7 100644
--- a/src/main/java/com/juick/service/MessagesServiceImpl.java
+++ b/src/main/java/com/juick/service/MessagesServiceImpl.java
@@ -704,15 +704,15 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ
+ " AND NOT EXISTS (SELECT 1 FROM bl_users b WHERE b.user_id = :vid 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 = favorites.message_id) and :vid = bt.user_id)"
- + (before > 0 ? " AND message_id < :before " : StringUtils.EMPTY)
- + " ORDER BY message_id DESC LIMIT 20) as r" + " UNION ALL " + "SELECT message_id FROM "
+ + (before > 0 ? " AND messages.message_id < :before " : StringUtils.EMPTY)
+ + " ORDER BY messages.message_id DESC LIMIT 20) as r" + " UNION ALL " + "SELECT message_id FROM "
+ "(SELECT message_id FROM messages" + " INNER JOIN users" + " ON messages.user_id = users.id"
+ " WHERE user_id = :uid AND users.banned = 0"
+ " AND NOT EXISTS (SELECT 1 FROM bl_users b WHERE b.user_id = :vid 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 :vid = bt.user_id)"
- + (before > 0 ? " AND message_id < :before" : StringUtils.EMPTY)
- + " AND privacy >= :privacy ORDER BY message_id DESC LIMIT 20) as m "
+ + (before > 0 ? " AND messages.message_id < :before" : StringUtils.EMPTY)
+ + " AND privacy >= :privacy ORDER BY messages.message_id DESC LIMIT 20) as m "
+ "ORDER BY message_id DESC LIMIT 20", sqlParameterSource, Integer.class);
}