diff options
Diffstat (limited to 'src/main/java/com/juick/service')
-rw-r--r-- | src/main/java/com/juick/service/MessagesServiceImpl.java | 18 | ||||
-rw-r--r-- | src/main/java/com/juick/service/UserServiceImpl.java | 4 |
2 files changed, 10 insertions, 12 deletions
diff --git a/src/main/java/com/juick/service/MessagesServiceImpl.java b/src/main/java/com/juick/service/MessagesServiceImpl.java index b3b51bcc..eee40512 100644 --- a/src/main/java/com/juick/service/MessagesServiceImpl.java +++ b/src/main/java/com/juick/service/MessagesServiceImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008-2020, Juick + * Copyright (C) 2008-2021, Juick * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as @@ -334,8 +334,8 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ public boolean isReadOnly(final int mid) { List<Integer> list = getJdbcTemplate().queryForList( "SELECT readonly FROM messages WHERE message_id = ?", - new Object[]{mid}, - Integer.class); + Integer.class, + mid); return !list.isEmpty() && list.get(0) == 1; } @@ -345,8 +345,8 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ public boolean isSubscribed(final int uid, final int mid) { List<Integer> list = getJdbcTemplate().queryForList( "SELECT 1 FROM subscr_messages WHERE suser_id = ? AND message_id = ?", - new Object[]{uid, mid}, - Integer.class); + Integer.class, + uid, mid); return !list.isEmpty() && list.get(0) == 1; } @@ -356,8 +356,8 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ public int getMessagePrivacy(final int mid) { List<Integer> list = getJdbcTemplate().queryForList( "SELECT privacy FROM messages WHERE message_id = ?", - new Object[]{mid}, - Integer.class); + Integer.class, + mid); return list.isEmpty() ? -4 : list.get(0); } @@ -473,13 +473,13 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ List<User> list = getJdbcTemplate().query( "SELECT messages.user_id, users.nick " + "FROM messages INNER JOIN users ON messages.user_id = users.id WHERE messages.message_id = ?", - new Object[]{mid}, (rs, num) -> { User res = new User(); res.setUid(rs.getInt(1)); res.setName(rs.getString(2)); return res; - }); + }, + mid); return list.isEmpty() ? null : list.get(0); diff --git a/src/main/java/com/juick/service/UserServiceImpl.java b/src/main/java/com/juick/service/UserServiceImpl.java index a86b22a6..7d215260 100644 --- a/src/main/java/com/juick/service/UserServiceImpl.java +++ b/src/main/java/com/juick/service/UserServiceImpl.java @@ -428,9 +428,7 @@ public class UserServiceImpl extends BaseJdbcService implements UserService { List<Integer> list = getJdbcTemplate().queryForList( "SELECT 1 FROM bl_users WHERE (user_id = ? AND bl_user_id = ?) " + "OR (user_id = ? AND bl_user_id = ?)", - new Object[]{uid, uid2, uid2, uid}, - Integer.class); - + Integer.class, uid, uid2, uid2, uid); return !list.isEmpty() && list.get(0) == 1; } |