diff options
author | Vitaly Takmazov | 2018-08-29 17:28:11 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2018-08-29 17:28:11 +0300 |
commit | 70963f3c8a616039a442362e778825f4fe85e4c5 (patch) | |
tree | 7a85efc93ce242ba196a49195cc55f36a86ce1c9 /juick-server/src/main/java/com | |
parent | bdf6c8ff1eb67d320684df025632ebf72966db37 (diff) |
shadow banned users from recommendations list
Diffstat (limited to 'juick-server/src/main/java/com')
-rw-r--r-- | juick-server/src/main/java/com/juick/service/MessagesServiceImpl.java | 11 |
1 files changed, 7 insertions, 4 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 913ee747..e2958112 100644 --- a/juick-server/src/main/java/com/juick/service/MessagesServiceImpl.java +++ b/juick-server/src/main/java/com/juick/service/MessagesServiceImpl.java @@ -423,10 +423,13 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ @Override public List<String> getMessageRecommendations(final int mid) { return getJdbcTemplate().queryForList( - "SELECT DISTINCT users.nick FROM favorites INNER JOIN users " + - "ON (favorites.message_id = ? AND favorites.user_id = users.id) WHERE favorites.like_id=1", - new Object[]{mid}, - String.class); + "SELECT DISTINCT users.nick FROM favorites " + + "INNER JOIN users ON (favorites.message_id = ? AND favorites.user_id = users.id) " + + "INNER JOIN messages m ON favorites.message_id=m.message_id WHERE favorites.like_id=1 " + + "AND NOT EXISTS (SELECT 1 FROM bl_users WHERE " + + "(user_id = favorites.user_id AND bl_user_id = m.user_id) " + + "OR (user_id = m.user_id AND bl_user_id = favorites.user_id))", + String.class, mid); } @Transactional(readOnly = true) |