aboutsummaryrefslogtreecommitdiff
path: root/juick-server/src/main/java/com/juick/service/MessagesServiceImpl.java
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2016-12-20 14:28:00 +0300
committerGravatar Vitaly Takmazov2016-12-20 14:28:00 +0300
commit3859c9616d0a7a04e68427d173b863161b818140 (patch)
treecba4d1aea88b7ce0d94cbc30fc05f765c9faaa15 /juick-server/src/main/java/com/juick/service/MessagesServiceImpl.java
parent8b02f969d3a09e39557474eb90ec821d550e3b1b (diff)
StringUtils.EMPTY
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.java30
1 files changed, 15 insertions, 15 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 88167be8..1ad29d00 100644
--- a/juick-server/src/main/java/com/juick/service/MessagesServiceImpl.java
+++ b/juick-server/src/main/java/com/juick/service/MessagesServiceImpl.java
@@ -107,7 +107,7 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ
int mid = holder.getKey().intValue();
if (mid > 0) {
- String tagsNames = "";
+ String tagsNames = StringUtils.EMPTY;
if (CollectionUtils.isNotEmpty(tags)) {
StringBuilder tasNamesBuilder = new StringBuilder();
@@ -364,7 +364,7 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ
return getNamedParameterJdbcTemplate().queryForList(
"SELECT m.message_id FROM messages m WHERE " +
(before > 0 ?
- " m.message_id < :before AND " : "") +
+ " m.message_id < :before AND " : StringUtils.EMPTY) +
" m.hidden = 0 AND (m.privacy > 0" +
(visitorUid > 1 ?
" OR m.user_id = :visitorUid) AND NOT EXISTS (" +
@@ -389,7 +389,7 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ
"ON ((tags.synonym_id = :tid OR tags.tag_id = :tid) AND tags.tag_id = messages_tags.tag_id)) " +
"INNER JOIN messages USING(message_id) WHERE " +
(before > 0 ?
- " messages.message_id < :before AND " : "") +
+ " messages.message_id < :before AND " : StringUtils.EMPTY) +
"(messages.privacy > 0 OR messages.user_id = :visitorUid) ORDER BY message_id DESC LIMIT :cnt",
sqlParameterSource,
Integer.class);
@@ -407,7 +407,7 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ
"SELECT messages.message_id FROM messages_tags " +
"INNER JOIN messages USING(message_id) WHERE messages_tags.tag_id IN (" + tids + ") " +
(before > 0 ?
- " AND messages.message_id < :before " : "") +
+ " AND messages.message_id < :before " : StringUtils.EMPTY) +
" AND (messages.privacy > 0 OR messages.user_id = :visitorUid) " +
"ORDER BY messages.message_id DESC LIMIT :cnt",
sqlParameterSource,
@@ -425,7 +425,7 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ
return getNamedParameterJdbcTemplate().queryForList(
"SELECT message_id FROM messages WHERE place_id = :placeId " +
(before > 0 ?
- " AND message_id < :before " : "") +
+ " AND message_id < :before " : StringUtils.EMPTY) +
" AND (privacy > 0 OR user_id = :visitorUid) ORDER BY message_id DESC LIMIT 20",
sqlParameterSource,
Integer.class);
@@ -443,13 +443,13 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ
" INNER JOIN subscr_users ON (subscr_users.suser_id = :uid AND subscr_users.user_id = messages.user_id) " +
" WHERE " +
(before > 0 ?
- " message_id < :before AND " : "") +
+ " message_id < :before AND " : StringUtils.EMPTY) +
" (privacy >= 0 OR (privacy >= -2 AND privacy <= -1" +
" AND EXISTS (SELECT 1 FROM wl_users w WHERE w.wl_user_id = :uid and w.user_id = messages.user_id)))) " +
" UNION " +
" (SELECT message_id FROM messages WHERE user_id=:uid " +
(before > 0 ?
- " AND message_id < :before " : "") +
+ " AND message_id < :before " : StringUtils.EMPTY) +
") ORDER BY message_id DESC LIMIT 20",
sqlParameterSource,
Integer.class);
@@ -467,7 +467,7 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ
return getNamedParameterJdbcTemplate().queryForList
("SELECT message_id FROM messages WHERE user_id = :uid AND privacy < 0" +
(before > 0 ?
- " AND message_id < :before " : "") +
+ " AND message_id < :before " : StringUtils.EMPTY) +
"ORDER BY message_id DESC LIMIT 20",
sqlParameterSource,
Integer.class);
@@ -500,7 +500,7 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ
"SELECT f.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 " : "") +
+ " AND f.message_id < :before " : StringUtils.EMPTY) +
"ORDER BY f.message_id DESC LIMIT 20",
sqlParameterSource,
Integer.class);
@@ -516,7 +516,7 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ
return getNamedParameterJdbcTemplate().queryForList(
"SELECT m.message_id FROM messages m WHERE m.privacy > 0 " +
(before > 0 ?
- " AND m.message_id < :before " : "") +
+ " AND m.message_id < :before " : StringUtils.EMPTY) +
" AND m.popular > 0 AND NOT EXISTS (SELECT 1 FROM bl_users b WHERE b.user_id = :vid and b.bl_user_id = m.user_id) " +
" ORDER BY m.message_id DESC LIMIT 20",
sqlParameterSource,
@@ -533,7 +533,7 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ
return getNamedParameterJdbcTemplate().queryForList(
"SELECT m.message_id FROM messages m WHERE (m.privacy > 0 OR m.user_id = :vid) " +
(before > 0 ?
- " AND m.message_id < :before " : "") +
+ " AND m.message_id < :before " : StringUtils.EMPTY) +
" AND m.attach IS NOT NULL " +
" AND NOT EXISTS (SELECT 1 from users u WHERE u.banned = 1 and u.id = m.user_id) " +
" AND NOT EXISTS (SELECT 1 FROM bl_users b WHERE b.user_id = :vid and b.bl_user_id = m.user_id) " +
@@ -566,7 +566,7 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ
return getNamedParameterJdbcTemplate().queryForList(
"SELECT message_id FROM messages WHERE user_id = :uid" +
(before > 0 ?
- " AND message_id < :before" : "") +
+ " AND message_id < :before" : StringUtils.EMPTY) +
" AND privacy >= :privacy ORDER BY message_id DESC LIMIT 20",
sqlParameterSource,
Integer.class);
@@ -585,7 +585,7 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ
"SELECT messages.message_id FROM messages_tags INNER JOIN messages " +
" USING (message_id) WHERE messages.user_id = :uid AND messages_tags.tag_id = :tid " +
(before > 0 ?
- " AND messages.message_id < :before " : "") +
+ " AND messages.message_id < :before " : StringUtils.EMPTY) +
" AND messages.privacy >= :privacy ORDER BY messages.message_id DESC LIMIT 20",
sqlParameterSource,
Integer.class);
@@ -602,7 +602,7 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ
"SELECT message_id FROM favorites " +
" WHERE user_id = :uid " +
(before > 0 ?
- " AND message_id < :before " : "") +
+ " AND message_id < :before " : StringUtils.EMPTY) +
" ORDER BY message_id DESC LIMIT 20",
sqlParameterSource,
Integer.class);
@@ -619,7 +619,7 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ
return getNamedParameterJdbcTemplate().queryForList(
"SELECT message_id FROM messages WHERE user_id = :uid " +
(before > 0 ?
- " AND message_id < :before " : "") +
+ " AND message_id < :before " : StringUtils.EMPTY) +
" AND privacy >= :privacy AND attach IS NOT NULL ORDER BY message_id DESC LIMIT 20",
sqlParameterSource,
Integer.class);