From b6db99da90ae4202ec58974a1e237aac6570e8a9 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Sun, 22 Jan 2023 21:14:18 +0300 Subject: `isInBL`: do not check anonymous user --- src/main/java/com/juick/service/UserServiceImpl.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/main/java/com/juick/service') diff --git a/src/main/java/com/juick/service/UserServiceImpl.java b/src/main/java/com/juick/service/UserServiceImpl.java index 99e56229..5ae0b2d1 100644 --- a/src/main/java/com/juick/service/UserServiceImpl.java +++ b/src/main/java/com/juick/service/UserServiceImpl.java @@ -370,10 +370,13 @@ public class UserServiceImpl extends BaseJdbcService implements UserService { @Transactional(readOnly = true) @Override public boolean isInBL(final int uid, final int check) { - List list = getJdbcTemplate().queryForList( - "SELECT 1 FROM bl_users WHERE user_id = ? AND bl_user_id = ?", Integer.class, uid, check); + if (check > 0) { + List list = getJdbcTemplate().queryForList( + "SELECT 1 FROM bl_users WHERE user_id = ? AND bl_user_id = ?", Integer.class, uid, check); - return !list.isEmpty() && list.get(0) == 1; + return !list.isEmpty() && list.get(0) == 1; + } + return false; } @Transactional(readOnly = true) -- cgit v1.2.3