如果sql查出来是null 返回给前端的时候会直接没有这个字段
所以如果是空就要手动改成“” 这样前端才能正常显示为address : " "
select
md.id,
md.title,
md.introduction,
md.img_url as imgUrl,
(case when md.address is null then '' else md.address end) as address,
DATE_FORMAT(md.start_time,'%Y-%m-%d') as startTime,
DATE_FORMAT(md.end_time,'%Y-%m-%d') as endTime
from m_activity_detais as md
where md.is_del = -1 and md.start_time is not null and md.end_time is not null and md.activity_class_id = #{id}
order by md.create_time desc
(case when md.address is null then ‘’ else md.address end) as address, 如果是null就改为“” 不是就正常返回
时间格式化 DATE_FORMAT(md.start_time,’%Y-%m-%d’) as startTime
备忘