aboutsummaryrefslogtreecommitdiff
path: root/juick-server/src/main/java/com
diff options
context:
space:
mode:
Diffstat (limited to 'juick-server/src/main/java/com')
-rw-r--r--juick-server/src/main/java/com/juick/service/MessagesServiceImpl.java11
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)