diff options
Diffstat (limited to 'juick-server/src/main/java/com/juick/service')
-rw-r--r-- | juick-server/src/main/java/com/juick/service/MessagesServiceImpl.java | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/juick-server/src/main/java/com/juick/service/MessagesServiceImpl.java b/juick-server/src/main/java/com/juick/service/MessagesServiceImpl.java index a90cba556..b0daa9fb8 100644 --- a/juick-server/src/main/java/com/juick/service/MessagesServiceImpl.java +++ b/juick-server/src/main/java/com/juick/service/MessagesServiceImpl.java @@ -572,6 +572,14 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ .addValue("uid", uid) .addValue("to", new Timestamp(to)); + if (uid == 0) { + return getNamedParameterJdbcTemplate().query("SELECT message_id FROM messages" + + (to != 0 ? + " WHERE updated < :to " : StringUtils.EMPTY) + + " ORDER BY updated DESC, message_id DESC LIMIT 20", + sqlParameterSource, + (rs, rowNum) -> rs.getInt(1)); + } return getNamedParameterJdbcTemplate().query( "SELECT messages.message_id, messages.updated FROM subscr_messages " + "INNER JOIN messages ON messages.message_id=subscr_messages.message_id " + |