diff options
author | 2018-03-14 10:04:40 +0300 | |
---|---|---|
committer | 2018-03-14 10:04:40 +0300 | |
commit | b2f3afebc7de684d1d49042f5f79a9cbf9c1f2f2 (patch) | |
tree | b7d5c7ca5b728751fa16d0085486b305da87d61d /juick-server-jdbc/src/main/java/com/juick/service/EmailServiceImpl.java | |
parent | b1e8980ed1460340fe4e8db2ce0d7ee1d213854a (diff) |
refactor email settings
Diffstat (limited to 'juick-server-jdbc/src/main/java/com/juick/service/EmailServiceImpl.java')
-rw-r--r-- | juick-server-jdbc/src/main/java/com/juick/service/EmailServiceImpl.java | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/juick-server-jdbc/src/main/java/com/juick/service/EmailServiceImpl.java b/juick-server-jdbc/src/main/java/com/juick/service/EmailServiceImpl.java index 1921354a..0cccc915 100644 --- a/juick-server-jdbc/src/main/java/com/juick/service/EmailServiceImpl.java +++ b/juick-server-jdbc/src/main/java/com/juick/service/EmailServiceImpl.java @@ -68,6 +68,14 @@ public class EmailServiceImpl extends BaseJdbcService implements EmailService { .addValue("email", account)) > 0; } + @Transactional(readOnly = true) + @Override + public String getNotificationsEmail(Integer userId) { + List<String> list = getJdbcTemplate().queryForList( + "SELECT email FROM emails WHERE user_id=? AND subscr_hour IS NOT NULL", String.class, userId); + return list.isEmpty() ? StringUtils.EMPTY : list.get(0); + } + @Override public boolean setNotificationsEmail(Integer userId, String account) { getJdbcTemplate().update("UPDATE emails SET subscr_hour=NULL WHERE user_id=?", userId); |