package com.eactive.eai.rms.onl.statistics.etc.dao;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

import org.springframework.stereotype.Repository;

import com.eactive.eai.rms.common.base.SqlMapClientTemplateDao;
import com.eactive.eai.rms.common.util.CommonUtil;
import com.eactive.eai.rms.onl.statistics.etc.vo.ResponseTimeTopTenVO;
import com.ibatis.sqlmap.client.event.RowHandler;
/**
 * <pre>
 * 1. 기능 :
 * 2. 처리 개요 :
 *     -
 * 3. 주의사항 :
 * </pre>
 * @author  : music75
 * @version : $Revision: 1.2 $
 * @since : rts 1.0
 * @spring.bean id="responseTimeTopTenDAO"
 * @spring.property name="dataSource" ref="dataSource"
 */
@Repository("responseTimeTopTenDAO")
public class ResponseTimeTopTenDAOImpl
        extends SqlMapClientTemplateDao
        implements ResponseTimeTopTenDAO {

    /**
     * <pre>
     * 1. 기능 : 평균 응답시간 TOP 10 통계 리스트 조회
     * 2. 처리 개요 :
     *     -
     * 3. 주의사항 : Overriden
     * </pre>
     * @author  : music75
     * @version : $Revision: 1.2 $
     * @since : rts 1.0
     * @see com.eactive.eai.rts.biz.statistics.etc.dao.ResponseTimeTopTenDAO#findRequestTime2Second(com.eactive.eai.rts.biz.statistics.eaisvcname.vo.StatisticsForm)
     * @param statisticsForm
     * @return
     */
    public List findRequestTime2Second(String msgDpstYMS) throws Exception{
    	final ArrayList<ResponseTimeTopTenVO> al = new ArrayList<ResponseTimeTopTenVO>();

        final HashMap<String, String> paramMap = new HashMap<String, String>();
        paramMap.put("msgDpstYMS", msgDpstYMS);
        paramMap.put("tableName", CommonUtil.getLogTable(msgDpstYMS, true) );
        
        template.queryWithRowHandler("ResponseTimeTopTen.findRequestTime2Second", paramMap,
    			new RowHandler(){
            		@SuppressWarnings("unchecked")
                    public void handleRow(Object valueObject) {
            			ResponseTimeTopTenVO vo = (ResponseTimeTopTenVO)valueObject;
                        al.add(vo);
        }});
        return al;
    }
}
