diff options
Diffstat (limited to 'src/main/java/com/juick/service/PrivacyQueriesServiceImpl.java')
-rw-r--r-- | src/main/java/com/juick/service/PrivacyQueriesServiceImpl.java | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/main/java/com/juick/service/PrivacyQueriesServiceImpl.java b/src/main/java/com/juick/service/PrivacyQueriesServiceImpl.java index 437c9f8c..d954df09 100644 --- a/src/main/java/com/juick/service/PrivacyQueriesServiceImpl.java +++ b/src/main/java/com/juick/service/PrivacyQueriesServiceImpl.java @@ -60,4 +60,20 @@ public class PrivacyQueriesServiceImpl extends BaseJdbcService implements Privac return PrivacyResult.Added; } + + @Override + public PrivacyResult whiteListUser(User user, User target) { + int result = getJdbcTemplate().update( + "DELETE FROM wl_users WHERE user_id = ? AND wl_user_id = ?", + user.getUid(), target.getUid()); + + if (result > 0) + return PrivacyResult.Removed; + + getJdbcTemplate().update( + "INSERT INTO wl_users(user_id, wl_user_id) VALUES (?, ?)", + user.getUid(), target.getUid()); + + return PrivacyResult.Added; + } } |