diff options
Diffstat (limited to 'juick-server-jdbc/src/main/java/com/juick/service/PMQueriesServiceImpl.java')
-rw-r--r-- | juick-server-jdbc/src/main/java/com/juick/service/PMQueriesServiceImpl.java | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/juick-server-jdbc/src/main/java/com/juick/service/PMQueriesServiceImpl.java b/juick-server-jdbc/src/main/java/com/juick/service/PMQueriesServiceImpl.java index d42e375c..67d7b386 100644 --- a/juick-server-jdbc/src/main/java/com/juick/service/PMQueriesServiceImpl.java +++ b/juick-server-jdbc/src/main/java/com/juick/service/PMQueriesServiceImpl.java @@ -135,7 +135,7 @@ public class PMQueriesServiceImpl extends BaseJdbcService implements PMQueriesSe @Override public List<com.juick.Message> getLastPMInbox(final int uid) { return getJdbcTemplate().query( - "SELECT pm.user_id,users.nick,pm.txt,TIMESTAMPDIFF(MINUTE,pm.ts,NOW()),pm.ts " + + "SELECT pm.user_id, users.nick, pm.txt, pm.ts " + "FROM pm INNER JOIN users ON pm.user_id=users.id WHERE pm.user_id_to=? ORDER BY pm.ts DESC LIMIT 20", (rs, num) -> { com.juick.Message msg = new com.juick.Message(); @@ -143,8 +143,7 @@ public class PMQueriesServiceImpl extends BaseJdbcService implements PMQueriesSe msg.getUser().setUid(rs.getInt(1)); msg.getUser().setName(rs.getString(2)); msg.setText(rs.getString(3)); - msg.TimeAgo = rs.getInt(4); - msg.setTimestamp(rs.getTimestamp(5).toInstant()); + msg.setTimestamp(rs.getTimestamp(4).toInstant()); return msg; }, uid); @@ -154,7 +153,7 @@ public class PMQueriesServiceImpl extends BaseJdbcService implements PMQueriesSe @Override public List<com.juick.Message> getLastPMSent(final int uid) { return getJdbcTemplate().query( - "SELECT pm.user_id_to,users.nick,pm.txt,TIMESTAMPDIFF(MINUTE,pm.ts,NOW())," + + "SELECT pm.user_id_to, users.nick, pm.txt, " + "pm.ts FROM pm INNER JOIN users ON pm.user_id_to=users.id " + "WHERE pm.user_id=? ORDER BY pm.ts DESC LIMIT 20", (rs, num) -> { @@ -163,8 +162,7 @@ public class PMQueriesServiceImpl extends BaseJdbcService implements PMQueriesSe msg.getUser().setUid(rs.getInt(1)); msg.getUser().setName(rs.getString(2)); msg.setText(rs.getString(3)); - msg.TimeAgo = rs.getInt(4); - msg.setTimestamp(rs.getTimestamp(5).toInstant()); + msg.setTimestamp(rs.getTimestamp(4).toInstant()); return msg; }, uid); |