aboutsummaryrefslogtreecommitdiff
path: root/juick-server-jdbc/src
diff options
context:
space:
mode:
Diffstat (limited to 'juick-server-jdbc/src')
-rw-r--r--juick-server-jdbc/src/main/java/com/juick/service/MessagesServiceImpl.java10
1 files changed, 10 insertions, 0 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 5370295a..1401cfce 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
@@ -930,4 +930,14 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ
jdbcTemplate.update("UPDATE subscr_messages SET last_read_rid=? WHERE message_id=? AND suser_id=?",
rid, mid, user.getUid());
}
+
+ @Override
+ public List<Integer> getUnread(User user) {
+ return jdbcTemplate.queryForList(
+ "select subscr_messages.message_id " +
+ "from subscr_messages inner join messages on subscr_messages.message_id=messages.message_id " +
+ "where subscr_messages.suser_id=? and " +
+ "messages.replies>subscr_messages.last_read_rid",
+ Integer.class, user.getUid());
+ }
}