MySql 里的IFNULL、NULLIF和ISNULL用法
mybatis不能使用IFNULL这些函数,可以用case . . . when . . . then . . . else . . . end代替
select id,is_topic_on as topicOn,topic_name as topicName,topic_recommend as topicRecommend,topic_introduction as topicIntroduction,topic_group as topicGroup,
CASE WHEN (topic_user is null || (LENGTH(trim(topic_user))=0))THEN 0 ELSE 1 END as topicUser,CASE WHEN ((topic_community is null) or (LENGTH(trim(topic_community))=0)) THEN 0 ELSE 1 END as topicCommunity
from tbl_community_topic where id=#{id}