diff options
author | Alexander Alexeev | 2016-11-17 23:45:13 +0700 |
---|---|---|
committer | Vitaly Takmazov | 2016-11-23 13:02:55 +0300 |
commit | 19709fa2ade17433b9a76ad4459e1e09d27b88bf (patch) | |
tree | 188ba9d24f4fc5bdf7707c57d61cd9c7212b45cf /juick-server/src/main/java/com/juick/service/PrivacyQueriesServiceImpl.java | |
parent | 78a1a68e5555648a07588873b08d59a094391709 (diff) |
repository improvenments: using Collection in params, forse using exists in some query, force using Lists as query result
Diffstat (limited to 'juick-server/src/main/java/com/juick/service/PrivacyQueriesServiceImpl.java')
-rw-r--r-- | juick-server/src/main/java/com/juick/service/PrivacyQueriesServiceImpl.java | 42 |
1 files changed, 20 insertions, 22 deletions
diff --git a/juick-server/src/main/java/com/juick/service/PrivacyQueriesServiceImpl.java b/juick-server/src/main/java/com/juick/service/PrivacyQueriesServiceImpl.java index 7dac4073..4f19c70f 100644 --- a/juick-server/src/main/java/com/juick/service/PrivacyQueriesServiceImpl.java +++ b/juick-server/src/main/java/com/juick/service/PrivacyQueriesServiceImpl.java @@ -23,34 +23,32 @@ public class PrivacyQueriesServiceImpl extends BaseJdbcService implements Privac @Override public PrivacyResult blacklistUser(final User user, final User target) { int result = getJdbcTemplate().update( - "DELETE FROM bl_users WHERE user_id=? AND bl_user_id=?", - user.getUid(), - target.getUid()); - if (result > 0) { + "DELETE FROM bl_users WHERE user_id = ? AND bl_user_id = ?", + user.getUid(), target.getUid()); + + if (result > 0) return PrivacyResult.Removed; - } else { - getJdbcTemplate().update( - "INSERT INTO bl_users(user_id,bl_user_id) VALUES (?,?)", - user.getUid(), - target.getUid()); - return PrivacyResult.Added; - } + + getJdbcTemplate().update( + "INSERT INTO bl_users(user_id, bl_user_id) VALUES (?, ?)", + user.getUid(), target.getUid()); + + return PrivacyResult.Added; } @Override public PrivacyResult blacklistTag(final User user, final Tag tag) { int result = getJdbcTemplate().update( - "DELETE FROM bl_tags WHERE user_id=? AND tag_id=?", - user.getUid(), - tag.TID); - if (result > 0) { + "DELETE FROM bl_tags WHERE user_id = ? AND tag_id = ?", + user.getUid(), tag.TID); + + if (result > 0) return PrivacyResult.Removed; - } else { - getJdbcTemplate().update( - "INSERT INTO bl_tags(user_id,tag_id) VALUES (?,?)", - user.getUid(), - tag.TID); - return PrivacyResult.Added; - } + + getJdbcTemplate().update( + "INSERT INTO bl_tags(user_id, tag_id) VALUES (?, ?)", + user.getUid(), tag.TID); + + return PrivacyResult.Added; } } |