From 8b267a3b630f5843623801f42eb90d0ad6a9d849 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Mon, 21 Nov 2016 17:12:20 +0300 Subject: juick-server: fix subscribed users query also in service implementation --- .../main/java/com/juick/service/SubscriptionServiceImpl.java | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'juick-server/src/main/java/com/juick/service') diff --git a/juick-server/src/main/java/com/juick/service/SubscriptionServiceImpl.java b/juick-server/src/main/java/com/juick/service/SubscriptionServiceImpl.java index f6ecb658..7e6b9d0a 100644 --- a/juick-server/src/main/java/com/juick/service/SubscriptionServiceImpl.java +++ b/juick-server/src/main/java/com/juick/service/SubscriptionServiceImpl.java @@ -64,13 +64,11 @@ public class SubscriptionServiceImpl extends BaseJdbcService implements Subscrip set.addAll(userids.stream().map(User::getUid).collect(Collectors.toList())); List tags = messagesService.getMessageTagsIDs(mid); if (tags.size() > 0) { - List tagUsers = getJdbcTemplate().queryForList( - "SELECT suser_id FROM subscr_tags " + - "WHERE tag_id IN (" + StringUtils.arrayToCommaDelimitedString(tags.toArray()) + ") AND suser_id!=? " + - " AND suser_id NOT IN (SELECT user_id FROM bl_users WHERE bl_user_id=?)", - Integer.class, - uid, - author.getUid()); + String tagsStr = StringUtils.arrayToCommaDelimitedString(tags.toArray()); + List tagUsers = getJdbcTemplate().queryForList("SELECT suser_id FROM subscr_tags " + + "WHERE tag_id IN (" + tagsStr + ") AND suser_id!=? " + + " AND suser_id NOT IN (SELECT user_id FROM bl_users WHERE bl_user_id=?)" + + " AND suser_id NOT IN (SELECT user_id FROM bl_tags WHERE tag_id IN (" + tagsStr + "))", Integer.class, uid, author.getUid()); set.addAll(tagUsers); } return userService.getUsersByID(new ArrayList<>(set)); -- cgit v1.2.3