aboutsummaryrefslogtreecommitdiff
path: root/juick-server/src/main/java/com/juick/service
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2018-09-05 13:10:24 +0300
committerGravatar Vitaly Takmazov2018-09-05 13:10:24 +0300
commitb2c48c5a77ca119276cab2ad6df4db4841376f04 (patch)
tree780281fb019b57aa3f182dc4acd3f6e2e70071b1 /juick-server/src/main/java/com/juick/service
parent972d3aef3ab12c38c7f4a3b085c2c99cdc4d1d51 (diff)
ActivityStreams: followers and following collections
Diffstat (limited to 'juick-server/src/main/java/com/juick/service')
-rw-r--r--juick-server/src/main/java/com/juick/service/UserServiceImpl.java11
1 files changed, 11 insertions, 0 deletions
diff --git a/juick-server/src/main/java/com/juick/service/UserServiceImpl.java b/juick-server/src/main/java/com/juick/service/UserServiceImpl.java
index e841b539..bd72bed9 100644
--- a/juick-server/src/main/java/com/juick/service/UserServiceImpl.java
+++ b/juick-server/src/main/java/com/juick/service/UserServiceImpl.java
@@ -26,6 +26,7 @@ import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.RandomStringUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.dao.DuplicateKeyException;
+import org.springframework.dao.EmptyResultDataAccessException;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
import org.springframework.jdbc.support.GeneratedKeyHolder;
@@ -500,6 +501,16 @@ public class UserServiceImpl extends BaseJdbcService implements UserService {
@Transactional(readOnly = true)
@Override
+ public Integer getUserRecommendations(User user) {
+ try {
+ return jdbcTemplate.queryForObject("SELECT COUNT(*) FROM favorites WHERE user_id=?", Integer.class, user.getUid());
+ } catch (EmptyResultDataAccessException e) {
+ return 0;
+ }
+ }
+
+ @Transactional(readOnly = true)
+ @Override
public List<com.juick.User> getUserBLUsers(final int uid) {
return getJdbcTemplate().query("SELECT users.id,users.nick FROM users INNER JOIN bl_users " +
"ON(bl_users.bl_user_id=users.id) WHERE bl_users.user_id=? ORDER BY users.nick",