<select id="selectCategoryCount" parameterType="java.util.Map" resultType="keyword">
select
log_date as logDate,
<choose>
<when test="@org.apache.commons.lang.StringUtils@isEmpty(siteCode)">
'전체' as siteCode,
</when>
<otherwise>
site_code as siteCode,
</otherwise>
</choose>
<choose>
<when test="@org.apache.commons.lang.StringUtils@isEmpty(firstKeyName)">
'전체' as keyName,
</when>
<otherwise>
category as keyName,
</otherwise>
</choose>
sum(count) as value
from category_count
where log_date >= #{startLogDate}
and log_date <= #{endLogDate}
<if test="@org.apache.commons.lang.StringUtils@isNotEmpty(siteCode)">
and site_code = #{siteCode}
</if>
<if test="@org.apache.commons.lang.StringUtils@isNotEmpty(firstKeyName)">
and category = #{firstKeyName}
</if>
group by log_date
</select>