package com.eactive.eai.rms.onl.statistics.chnlmdiadstcd.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.onl.statistics.chnlmdiadstcd.vo.ChnlMdiaDstcdYearlyVO;
import com.eactive.eai.rms.onl.statistics.eaisvcname.vo.StatisticsForm;
import com.ibatis.sqlmap.client.event.RowHandler;

/**
 * <pre>
 * 1. 기능 : 
 * 2. 처리 개요 : 
 *     - 
 * 3. 주의사항 : 
 * </pre>
 * @author  : music75
 * @version : $Revision: 1.1 $
 * @since : rts 1.0
 * @spring.bean id="chnlMdiaDstcdYearlyDAO"
 * @spring.property name="dataSource" ref="dataSource"
 */
@Repository("chnlMdiaDstcdYearlyDAO")
public class ChnlMdiaDstcdYearlyDAOImpl
        extends SqlMapClientTemplateDao
        implements ChnlMdiaDstcdYearlyDAO {

    /**
     * <pre>
     * 1. 기능 : 매체별 년간 통계 리스트 조회
     * 2. 처리 개요 : 
     *     - 
     * 3. 주의사항 : Overriden 
     * </pre>
     * @author  : music75
     * @version : $Revision: 1.1 $
     * @since : rts 1.0
     * @see com.eactive.eai.rts.biz.statistics.chnlmdiadstcd.dao.ChnlMdiaDstcdYearlyDAO#findByChnlMdiaDstcdYearly(com.eactive.eai.rts.biz.statistics.eaisvcname.vo.StatisticsForm)
     * @param statisticsForm
     * @return
     */
    public List findByChnlMdiaDstcdYearly(StatisticsForm statisticsForm) throws Exception {
    	final ArrayList<ChnlMdiaDstcdYearlyVO> al = new ArrayList<ChnlMdiaDstcdYearlyVO>();

        final HashMap<String, String> paramMap = new HashMap<String, String>();
        paramMap.put("chnlMdiaDstcd", statisticsForm.getChnlMdiaDstcd());
    	template.queryWithRowHandler("ChnlMdiaDstcdYearly.findByChnlMdiaDstcdYearly", paramMap,
    			new RowHandler(){
            		@SuppressWarnings("unchecked")
                    public void handleRow(Object valueObject) {
            			ChnlMdiaDstcdYearlyVO vo = (ChnlMdiaDstcdYearlyVO)valueObject;
                        al.add(vo);
        }});
        return al;
    }

    public List findByChnlMdiaDstcdYearlyObject2_1(StatisticsForm statisticsForm) throws Exception {
    	final ArrayList<ChnlMdiaDstcdYearlyVO> al = new ArrayList<ChnlMdiaDstcdYearlyVO>();

        final HashMap<String, String> paramMap = new HashMap<String, String>();
        paramMap.put("chnlMdiaDstcd", statisticsForm.getChnlMdiaDstcd());
        paramMap.put("startDate", statisticsForm.getStartDate());
    	template.queryWithRowHandler("ChnlMdiaDstcdYearly.findByChnlMdiaDstcdYearlyObject2_1", paramMap,
    			new RowHandler(){
            		@SuppressWarnings("unchecked")
                    public void handleRow(Object valueObject) {
            			ChnlMdiaDstcdYearlyVO vo = (ChnlMdiaDstcdYearlyVO)valueObject;
                        al.add(vo);
        }});
        return al;
    }

    public List findByChnlMdiaDstcdYearlyObject2_2(StatisticsForm statisticsForm) throws Exception {
    	final ArrayList<ChnlMdiaDstcdYearlyVO> al = new ArrayList<ChnlMdiaDstcdYearlyVO>();

        final HashMap<String, String> paramMap = new HashMap<String, String>();
        paramMap.put("chnlMdiaDstcd", statisticsForm.getChnlMdiaDstcd());
        paramMap.put("startDate", statisticsForm.getStartDate());
    	template.queryWithRowHandler("ChnlMdiaDstcdYearly.findByChnlMdiaDstcdYearlyObject2_2", paramMap,
    			new RowHandler(){
            		@SuppressWarnings("unchecked")
                    public void handleRow(Object valueObject) {
            			ChnlMdiaDstcdYearlyVO vo = (ChnlMdiaDstcdYearlyVO)valueObject;
                        al.add(vo);
        }});
        return al;
    }
}
