aboutsummaryrefslogtreecommitdiff
path: root/juick-server-jdbc/src/main/java
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2018-04-11 22:52:59 +0300
committerGravatar Vitaly Takmazov2018-04-11 22:52:59 +0300
commit495ee60b34991572c06732674c6e02f290cdbd55 (patch)
tree71b62ed5038f8021bf9086cd4819d66d67a18389 /juick-server-jdbc/src/main/java
parent336517508441ecb9a78418065f5a6c068d15f3cb (diff)
MessagesService::getUnread
Diffstat (limited to 'juick-server-jdbc/src/main/java')
-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());
+ }
}