From 937445c7e56a7bc9353e5aec1a0941c97b0f1386 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Thu, 3 May 2018 15:38:05 +0300 Subject: server: case-insensitive subscriptions command --- .../src/main/java/com/juick/service/MessagesServiceImpl.java | 2 +- .../src/main/java/com/juick/service/SubscriptionServiceImpl.java | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'juick-server-jdbc/src/main') diff --git a/juick-server-jdbc/src/main/java/com/juick/service/MessagesServiceImpl.java b/juick-server-jdbc/src/main/java/com/juick/service/MessagesServiceImpl.java index b64d7fd9..b6a37883 100644 --- a/juick-server-jdbc/src/main/java/com/juick/service/MessagesServiceImpl.java +++ b/juick-server-jdbc/src/main/java/com/juick/service/MessagesServiceImpl.java @@ -217,7 +217,7 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ @Transactional void updateRepliesBy(int mid) { - List users = getJdbcTemplate().queryForList("SELECT DISTINCT users.nick FROM replies " + + List users = getJdbcTemplate().queryForList("SELECT users.nick FROM replies " + "INNER JOIN users ON replies.user_id=users.id WHERE replies.message_id=? " + "GROUP BY replies.user_id ORDER BY COUNT(replies.reply_id) DESC LIMIT 5", String.class, mid); String result = users.stream().map(u -> "@" + u).collect(Collectors.joining(",")); diff --git a/juick-server-jdbc/src/main/java/com/juick/service/SubscriptionServiceImpl.java b/juick-server-jdbc/src/main/java/com/juick/service/SubscriptionServiceImpl.java index 7626651a..b97fc0a4 100644 --- a/juick-server-jdbc/src/main/java/com/juick/service/SubscriptionServiceImpl.java +++ b/juick-server-jdbc/src/main/java/com/juick/service/SubscriptionServiceImpl.java @@ -203,7 +203,8 @@ public class SubscriptionServiceImpl extends BaseJdbcService implements Subscrip @Transactional(readOnly = true) @Override public List getSubscribedTags(User user) { - return getJdbcTemplate().queryForList("SELECT tags.name FROM subscr_tags INNER JOIN tags USING(tag_id) " + + return getJdbcTemplate().queryForList("SELECT tags.name FROM subscr_tags INNER JOIN tags " + + "ON(tags.tag_id = subscr_tags.tag_id) " + "WHERE subscr_tags.suser_id=? ORDER BY tags.name", String.class, user.getUid()); } -- cgit v1.2.3