diff options
author | Vitaly Takmazov | 2023-02-03 04:05:47 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2023-02-03 04:05:47 +0300 |
commit | 9cc7fb49b3d5ab2c0b963a5eb6497f385378eca0 (patch) | |
tree | 61e62ac5365b28362fa96085569100fc1ce4f98b /src/main/java | |
parent | febad867a57cfa1ae33c83dd9c0ddf51a303eb03 (diff) |
Make new queries compatible
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/com/juick/service/TagServiceImpl.java | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/main/java/com/juick/service/TagServiceImpl.java b/src/main/java/com/juick/service/TagServiceImpl.java index 403f05c4..9b8b4d95 100644 --- a/src/main/java/com/juick/service/TagServiceImpl.java +++ b/src/main/java/com/juick/service/TagServiceImpl.java @@ -72,8 +72,8 @@ public class TagServiceImpl extends BaseJdbcService implements TagService { public Tag getTag(int userId, int tid) { List<Tag> list = namedParameterJdbcTemplate.query(""" SELECT tag_id, synonym_id, name, noindex, notop, - (EXISTS(SELECT 1 FROM bl_tags WHERE tag_id=:tagId AND user_id=:userId)) ignored, - (EXISTS(SELECT 1 FROM subscr_tags WHERE tag_id=:tagId AND suser_id=:userId)) subscribed + COALESCE((SELECT 1 FROM bl_tags WHERE tag_id=:tagId AND user_id=:userId), 0) ignored, + COALESCE((SELECT 1 FROM subscr_tags WHERE tag_id=:tagId AND suser_id=:userId), 0) subscribed FROM tags WHERE tag_id = :tagId""", new MapSqlParameterSource() .addValue("userId", userId) @@ -95,8 +95,8 @@ public class TagServiceImpl extends BaseJdbcService implements TagService { return null; List<Tag> list = namedParameterJdbcTemplate.query(""" SELECT t.tag_id, t.synonym_id, t.name, t.noindex, t.notop, - (EXISTS(SELECT 1 FROM bl_tags WHERE tag_id=t.tag_id AND user_id=:userId)) ignored, - (EXISTS(SELECT 1 FROM subscr_tags WHERE tag_id=t.tag_id AND suser_id=:userId)) subscribed + COALESCE((SELECT 1 FROM bl_tags WHERE tag_id=t.tag_id AND user_id=:userId), 0) ignored, + COALESCE((SELECT 1 FROM subscr_tags WHERE tag_id=t.tag_id AND suser_id=:userId), 0) subscribed FROM (SELECT tag_id, synonym_id, name, noindex, notop FROM tags) t WHERE name = :tagName""", new MapSqlParameterSource() |