'mybatis query sample'에 해당되는 글 1건

  1. 2013.04.18 [MyBatis] mybatis 쿼리 sample (EL) (4)

<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 &gt;= #{startLogDate}

                           and log_date &lt;= #{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>


Posted by 용식