<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
	 PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
	 "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
	 
<!-- 해당 부분의 namespace는 project package + Mapper Package + Mapper Interface 이름입니다. -->
<mapper namespace="com.elt.ems.mapper.DataTableMapper">
	
    <sql id="commonPagingHeader"  >
      SELECT R1.* FROM (
    </sql>
    
    <sql id="commonPagingFooter"  >
      ) R1 LIMIT #{pgtl.startNo}, #{pgtl.listPerPage}
    </sql>   
   		 
	<select id="selectList" parameterType="com.elt.ems.vo.DataTableVo"  resultType="com.elt.ems.vo.DataTableVo">

		select *
		from t_data_table_statistics 
		where inputYear = #{inputYear} 
		<if test="inputMonth != null and inputMonth != '' "> and inputMonth = #{inputMonth} </if>
		order by inputMonth desc, inputYear desc, tableName asc	
     
  	</select>   
  	
  	
	<select id="listDataQueryCount" parameterType="com.elt.ems.vo.SearchMapVo"  resultType="int">
		select  count(*) as count from (
			${map.queryString}	   
		) a   
  	</select>  
  	  	
	<select id="listDataQuery" parameterType="com.elt.ems.vo.SearchMapVo"  resultType="com.elt.ems.common.CaseSensibleHashMap">

	  <if test="pgtl != null">
        <include refid="commonPagingHeader" /> 
      </if>
		${map.queryString}	      
      <if test="pgtl != null">
        <include refid="commonPagingFooter" />
      </if>		
     
  	</select>  
  		   		
</mapper>