diff options
Diffstat (limited to 'juick-server/src/main/java/com/juick/service/TelegramServiceImpl.java')
-rw-r--r-- | juick-server/src/main/java/com/juick/service/TelegramServiceImpl.java | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/juick-server/src/main/java/com/juick/service/TelegramServiceImpl.java b/juick-server/src/main/java/com/juick/service/TelegramServiceImpl.java index 4e37bfac..99cbabf6 100644 --- a/juick-server/src/main/java/com/juick/service/TelegramServiceImpl.java +++ b/juick-server/src/main/java/com/juick/service/TelegramServiceImpl.java @@ -36,24 +36,14 @@ public class TelegramServiceImpl extends BaseJdbcService implements TelegramServ @Transactional @Override - public boolean addChat(final Long id) { - try { - return getJdbcTemplate().update("INSERT INTO telegram_chats(chat_id) VALUES(?)", id) > 0; - } catch (DuplicateKeyException e) { - return true; - } - } - - @Transactional - @Override - public boolean deleteChat(Long id) { - return getJdbcTemplate().update("DELETE FROM telegram_chats WHERE chat_id=?", id) > 0; + public boolean deleteAnonymous(Long id) { + return getJdbcTemplate().update("DELETE FROM telegram WHERE tg_id=? AND user_id IS NULL", id) > 0; } @Transactional(readOnly = true) @Override - public List<Long> getChats() { - return getJdbcTemplate().queryForList("SELECT chat_id FROM telegram_chats", Long.class); + public List<Long> getAnonymous() { + return getJdbcTemplate().queryForList("SELECT tg_id FROM telegram WHERE user_id IS NULL", Long.class); } @Transactional(readOnly = true) |