diff options
author | 2018-05-11 13:07:39 +0300 | |
---|---|---|
committer | 2018-05-11 13:07:39 +0300 | |
commit | 007f78c1712e0dc1402c85914e40e9752deaae73 (patch) | |
tree | de04b8b2feb1b52dfa746fa73c3788798fa32d35 /juick-server-jdbc/src/main/java/com/juick/service/MessagesServiceImpl.java | |
parent | 1d77a4a23891eddfb6e17044e69ded949fb6a278 (diff) |
common: drop unused fields from Message
Diffstat (limited to 'juick-server-jdbc/src/main/java/com/juick/service/MessagesServiceImpl.java')
-rw-r--r-- | juick-server-jdbc/src/main/java/com/juick/service/MessagesServiceImpl.java | 48 |
1 files changed, 21 insertions, 27 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 b6a37883..6c12583c 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 @@ -73,27 +73,25 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ user.setName(rs.getString(5)); user.setBanned(rs.getBoolean(6)); msg.setUser(user); - msg.TimeAgo = rs.getInt(7); - msg.setTimestamp(rs.getTimestamp(8).toInstant()); - msg.ReadOnly = rs.getBoolean(9); - msg.setPrivacy(rs.getInt(10)); + msg.setTimestamp(rs.getTimestamp(7).toInstant()); + msg.ReadOnly = rs.getBoolean(8); + msg.setPrivacy(rs.getInt(9)); msg.FriendsOnly = msg.getPrivacy() < 0; - msg.setReplies(rs.getInt(11)); - msg.setAttachmentType(rs.getString(12)); - // TODO: reorder after place deletion - msg.setLikes(rs.getInt(16)); - msg.Hidden = rs.getBoolean(17); - String tagsStr = rs.getString(18); + msg.setReplies(rs.getInt(10)); + msg.setAttachmentType(rs.getString(11)); + msg.setLikes(rs.getInt(12)); + msg.Hidden = rs.getBoolean(13); + String tagsStr = rs.getString(14); msg.setTags(MessageUtils.parseTags(tagsStr)); - msg.setRepliesBy(rs.getString(19)); - msg.setText(rs.getString(20)); - msg.setReplyQuote(MessageUtils.formatQuote(rs.getString(21))); - msg.setUpdated(rs.getTimestamp(22).toInstant()); - int quoteUid = rs.getInt(23); + msg.setRepliesBy(rs.getString(15)); + msg.setText(rs.getString(16)); + msg.setReplyQuote(MessageUtils.formatQuote(rs.getString(17))); + msg.setUpdated(rs.getTimestamp(18).toInstant()); + int quoteUid = rs.getInt(19); if (quoteUid > 0) { User quoteUser = new User(); quoteUser.setUid(quoteUid); - quoteUser.setName(rs.getString(24)); + quoteUser.setName(rs.getString(20)); msg.setTo(quoteUser); } try { @@ -326,11 +324,10 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ List<com.juick.Message> list = getJdbcTemplate().query( "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," - + "messages.lon, COUNT(DISTINCT favorites.user_id) as likes, messages.hidden," + + "messages.attach, COUNT(DISTINCT favorites.user_id) as likes, messages.hidden," + "txt.tags, txt.repliesby, txt.txt, '' as q, messages.updated, 0 as to_uid, " + "NULL as to_name FROM messages " + "INNER JOIN users ON messages.user_id = users.id " @@ -339,8 +336,8 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ + "LEFT JOIN favorites " + "ON messages.message_id = favorites.message_id AND favorites.like_id=1 " + "WHERE messages.message_id = ? " - + "GROUP BY mid, rid, replyto, uid, nick, banned, ago, messages.ts, readonly, " - + "privacy, replies, attach, place_id, lat, lon, tags, repliesby, q", + + "GROUP BY mid, rid, replyto, uid, nick, banned, messages.ts, readonly, " + + "privacy, replies, attach, tags, repliesby, q", new MessageMapper(), mid); if (!list.isEmpty()) { @@ -779,11 +776,9 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ List<com.juick.Message> msgs = getNamedParameterJdbcTemplate().query( "SELECT messages.message_id, 0 as rid, 0 as replyto, " + "messages.user_id,users.nick, 0 as banned, " - + "TIMESTAMPDIFF(MINUTE,messages.ts,NOW())," + "messages.ts," + "messages.readonly,messages.privacy,messages.replies," - + "messages.attach,messages.place_id,messages.lat," - + "messages.lon,COUNT(DISTINCT favorites.user_id) AS likes,messages.hidden," + + "messages.attach,COUNT(DISTINCT favorites.user_id) AS likes,messages.hidden," + "messages_txt.tags,messages_txt.repliesby, messages_txt.txt, '' as q, " + "messages.updated, 0 as to_uid, NULL as to_name " + "FROM (messages INNER JOIN messages_txt " @@ -844,10 +839,9 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ List<Message> replies = getNamedParameterJdbcTemplate().query( "SELECT replies.message_id as mid, replies.reply_id, replies.replyto, " + "replies.user_id, users.nick, users.banned, " + - "TIMESTAMPDIFF(MINUTE, replies.ts, NOW()), replies.ts, " + + "replies.ts, " + "0 as readonly, 0 as privacy, 0 as replies, " + - "replies.attach, 0 as place_id, 0 as lat, " + - "0 as lon, 0 as likes, 0 as hidden, " + + "replies.attach, 0 as likes, 0 as hidden, " + "NULL as tags, NULL as repliesby, replies.txt, " + "IFNULL(qw.txt, t.txt) as q, " + "NOW(), " + |