diff options
author | Vitaly Takmazov | 2023-02-12 05:10:54 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2023-02-12 05:10:54 +0300 |
commit | 75a631d48bc3e3fea8d35cddbe0e2c639c252796 (patch) | |
tree | 07a49ca5da227e74a18a8c8518e03eb7d0e65847 /src/main/java/com | |
parent | 32fb3f61e8ce90b30d7ba58c820c9be523e7ff3f (diff) |
Drop `users_subscr` table
Diffstat (limited to 'src/main/java/com')
-rw-r--r-- | src/main/java/com/juick/service/UserServiceImpl.java | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/main/java/com/juick/service/UserServiceImpl.java b/src/main/java/com/juick/service/UserServiceImpl.java index 57fcd399..932be19c 100644 --- a/src/main/java/com/juick/service/UserServiceImpl.java +++ b/src/main/java/com/juick/service/UserServiceImpl.java @@ -439,11 +439,11 @@ public class UserServiceImpl extends BaseJdbcService implements UserService { @Transactional(readOnly = true) @Override public List<User> getUserReadLeastPopular(final int uid, final int cnt) { - return getJdbcTemplate().query( - "SELECT users.id,users.nick FROM (subscr_users " + - "INNER JOIN users_subscr ON (subscr_users.suser_id=? " + - "AND subscr_users.user_id=users_subscr.user_id)) INNER JOIN users " + - "ON subscr_users.user_id=users.id ORDER BY cnt " + limit(cnt), + return getJdbcTemplate().query(""" + SELECT users.id,users.nick, (select count(*) from subscr_users where user_id=users.id) cnt + FROM subscr_users INNER JOIN users + ON subscr_users.user_id=users.id WHERE subscr_users.suser_id=? ORDER by cnt + """ + limit(cnt), (rs, num) -> { User u = new User(); u.setUid(rs.getInt(1)); |