diff options
-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() |