aboutsummaryrefslogtreecommitdiff
path: root/juick-server-jdbc/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'juick-server-jdbc/src/main/java')
-rw-r--r--juick-server-jdbc/src/main/java/com/juick/service/MessagesServiceImpl.java8
1 files changed, 7 insertions, 1 deletions
diff --git a/juick-server-jdbc/src/main/java/com/juick/service/MessagesServiceImpl.java b/juick-server-jdbc/src/main/java/com/juick/service/MessagesServiceImpl.java
index caffda14a..3533d7017 100644
--- a/juick-server-jdbc/src/main/java/com/juick/service/MessagesServiceImpl.java
+++ b/juick-server-jdbc/src/main/java/com/juick/service/MessagesServiceImpl.java
@@ -445,7 +445,7 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ
@Transactional(readOnly = true)
@Override
- public List<Integer> getMyFeed(final int uid, final int before) {
+ public List<Integer> getMyFeed(final int uid, final int before, boolean recommended) {
SqlParameterSource sqlParameterSource = new MapSqlParameterSource()
.addValue("uid", uid)
.addValue("before", before);
@@ -462,6 +462,12 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ
" (SELECT message_id FROM messages WHERE user_id=:uid " +
(before > 0 ?
" AND message_id < :before " : StringUtils.EMPTY) +
+ (recommended ?
+ ") UNION " +
+ " (SELECT f.message_id as message_id FROM favorites f WHERE " +
+ "EXISTS (SELECT 1 FROM subscr_users s WHERE s.suser_id = :uid and f.user_id = s.user_id)" +
+ (before > 0 ?
+ " AND f.message_id < :before " : StringUtils.EMPTY) : StringUtils.EMPTY) +
") ORDER BY message_id DESC LIMIT 20",
sqlParameterSource,
Integer.class);