From 83af39fd6c3f89670130a8f6a63898e35e172cbf Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Mon, 25 Sep 2017 14:19:18 +0300 Subject: jdbc: fix getMessage query --- .../src/main/java/com/juick/service/MessagesServiceImpl.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) 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 c23b04e4..430039ea 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 @@ -286,9 +286,9 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ @Override public com.juick.Message getMessage(final int mid) { List list = getJdbcTemplate().query( - "SELECT messages.message_id, 0 as rid, 0 as replyto, " - + "messages.user_id, users.nick, users.banned as banned, " - + "TIMESTAMPDIFF(MINUTE, messages.ts, NOW())," + "SELECT messages.message_id as mid, 0 as rid, 0 as replyto, " + + "messages.user_id as uid, users.nick, users.banned as banned, " + + "TIMESTAMPDIFF(MINUTE, messages.ts, NOW()) as ago," + "messages.ts," + "messages.readonly, messages.privacy, messages.replies," + "messages.attach, messages.place_id, messages.lat," @@ -299,7 +299,9 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ + "ON messages.message_id = txt.message_id " + "LEFT JOIN favorites " + "ON messages.message_id = favorites.message_id " - + "WHERE messages.message_id = ?", + + "WHERE messages.message_id = ? " + + "GROUP BY mid, rid, replyto, uid, nick, banned, ago, ts, readonly, " + + "privacy, replies, attach, place_id, lat, lon, tags, repliesby, q", new MessageMapper(), mid); -- cgit v1.2.3