From 495ee60b34991572c06732674c6e02f290cdbd55 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Wed, 11 Apr 2018 22:52:59 +0300 Subject: MessagesService::getUnread --- .../src/main/java/com/juick/service/MessagesServiceImpl.java | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'juick-server-jdbc') 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 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()); + } } -- cgit v1.2.3