aboutsummaryrefslogtreecommitdiff
path: root/juick-server/src/main/java/com/juick/service/MessagesServiceImpl.java
diff options
context:
space:
mode:
authorGravatar Evgeniy Shishkin2017-03-09 16:25:30 +0300
committerGravatar Evgeniy Shishkin2017-03-09 16:25:30 +0300
commit779024f65c14436b48e015eaaef0f4956bd5aa8a (patch)
tree3b095ac01c55149e484f51f6cc901470b33ccedc /juick-server/src/main/java/com/juick/service/MessagesServiceImpl.java
parent35534495110bb044d548b7c0d7607e252470e462 (diff)
timehop api
Diffstat (limited to 'juick-server/src/main/java/com/juick/service/MessagesServiceImpl.java')
-rw-r--r--juick-server/src/main/java/com/juick/service/MessagesServiceImpl.java18
1 files changed, 18 insertions, 0 deletions
diff --git a/juick-server/src/main/java/com/juick/service/MessagesServiceImpl.java b/juick-server/src/main/java/com/juick/service/MessagesServiceImpl.java
index 0a35cee9..11ea0cbf 100644
--- a/juick-server/src/main/java/com/juick/service/MessagesServiceImpl.java
+++ b/juick-server/src/main/java/com/juick/service/MessagesServiceImpl.java
@@ -590,6 +590,24 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ
@Transactional(readOnly = true)
@Override
+ public List<Integer> getUserBlogAtDay(final int uid, final int privacy, final int daysback) {
+ SqlParameterSource sqlParameterSource = new MapSqlParameterSource()
+ .addValue("uid", uid)
+ .addValue("privacy", privacy)
+ .addValue("daysback", daysback);
+
+ return getNamedParameterJdbcTemplate().queryForList(
+ "SELECT message_id FROM messages WHERE user_id = :uid" +
+ (daysback > 0 ?
+ " AND ts >= date(NOW() - INTERVAL :daysback day)" +
+ " AND ts < date(NOW() - INTERVAL :daysback day + INTERVAL 1 day)" : StringUtils.EMPTY) +
+ " AND privacy >= :privacy ORDER BY message_id DESC LIMIT 20",
+ sqlParameterSource,
+ Integer.class);
+ }
+
+ @Transactional(readOnly = true)
+ @Override
public List<Integer> getUserBlogWithRecommendations(final int uid, final int privacy, final int before) {
SqlParameterSource sqlParameterSource = new MapSqlParameterSource()
.addValue("uid", uid)