diff options
-rw-r--r-- | juick-server-core/src/main/java/com/juick/service/UserService.java | 8 | ||||
-rw-r--r-- | juick-server-jdbc/src/main/java/com/juick/service/UserServiceImpl.java | 14 |
2 files changed, 20 insertions, 2 deletions
diff --git a/juick-server-core/src/main/java/com/juick/service/UserService.java b/juick-server-core/src/main/java/com/juick/service/UserService.java index 2da643d8..507935e1 100644 --- a/juick-server-core/src/main/java/com/juick/service/UserService.java +++ b/juick-server-core/src/main/java/com/juick/service/UserService.java @@ -67,7 +67,7 @@ public interface UserService { int getUIDbyHash(String hash); - com.juick.User getUserByHash(String hash); + User getUserByHash(String hash); String getHashByUID(int uid); @@ -99,7 +99,7 @@ public interface UserService { List<Integer> getUserRead(int uid); - List<com.juick.User> getUserReadLeastPopular(int uid, int cnt); + List<User> getUserReadLeastPopular(int uid, int cnt); List<User> getUserReaders(int uid); @@ -117,6 +117,10 @@ public interface UserService { int getStatsReplies(int uid); + int getStatsPhotos(int uid); + + int getStatsFavorites(int uid); + boolean setActiveStatusForJID(String JID, ActiveStatus jidStatus); List<String> getAllJIDs(User user); diff --git a/juick-server-jdbc/src/main/java/com/juick/service/UserServiceImpl.java b/juick-server-jdbc/src/main/java/com/juick/service/UserServiceImpl.java index 9aa82559..d3f1c777 100644 --- a/juick-server-jdbc/src/main/java/com/juick/service/UserServiceImpl.java +++ b/juick-server-jdbc/src/main/java/com/juick/service/UserServiceImpl.java @@ -617,6 +617,20 @@ public class UserServiceImpl extends BaseJdbcService implements UserService { return list.isEmpty() ? 0 : list.get(0); } + @Transactional(readOnly = true) + @Override + public int getStatsPhotos(final int uid) { + List<Integer> list = getJdbcTemplate().queryForList("SELECT COUNT(*) FROM messages WHERE user_id = ? AND attach IS NOT NULL", Integer.class, uid); + return list.isEmpty() ? 0 : list.get(0); + } + + @Transactional(readOnly = true) + @Override + public int getStatsFavorites(final int uid) { + List<Integer> list = getJdbcTemplate().queryForList("SELECT COUNT(*) FROM favorites WHERE user_id = ?", Integer.class, uid); + return list.isEmpty() ? 0 : list.get(0); + } + @Transactional @Override public boolean setActiveStatusForJID(final String JID, final UserService.ActiveStatus jidStatus) { |