SELECT distinct c.name,SUM(a.occupation) occupation ,substr(a.cdate,12,2) as "小时",a.cdate FROM view_space365_heatmap aleft join view_space365_rooms b on a.code=b.codeleft join view_space365_buildings c on b.building=c.source_pkwhere c.name not like '%路门%'and day(a.cdate) = day(now()) and year(a.cdate) = year(now()) and month(a.cdate) = month(now()) -- ${if(len(sClass) == 0 || sClass == "全部" ,"","and c.name = '" + sClass + "'")}group by substr(a.cdate,12,2),c.name,a.cdate