From 49c4b7f3ccbd4e22f500ea2f46e520786d8a8ab1 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Mon, 11 Sep 2017 21:00:02 +0300 Subject: no more recommended tab --- .../src/main/java/com/juick/service/MessagesServiceImpl.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'juick-server-jdbc/src/main/java/com') 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 caffda14..3533d701 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 getMyFeed(final int uid, final int before) { + public List 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); -- cgit v1.2.3