package com.eactive.eai.rms.onl.manage.adapter.sna;

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

import org.springframework.stereotype.Repository;

import com.eactive.eai.rms.common.base.SqlMapClientTemplateDao;

@Repository("snaAdapterDao")
public class SnaAdapterDao extends SqlMapClientTemplateDao{

	public int selectListCount(HashMap param) throws Exception {
	    	return (Integer)template.queryForObject("SnaAdapter.selectListCount", param);
	}	
	public List selectList(HashMap param) throws Exception {
		return template.queryForList("SnaAdapter.selectList", param);
	}	
	public List selectApCodeList(HashMap param) throws Exception {
		String instStr = (String)param.get("instStr");
		if(null!=instStr && instStr.length()>0){
			String[] instArr = instStr.split(",");
			String instSql = "( ";
				for(int i=0; i<instArr.length; i++){
					if(instArr.length>1){
						instSql+="EAISEVRINSTNCNAME = '"+instArr[i]+"' OR ";
					}
					if(i==instArr.length-1){
						instSql+="EAISEVRINSTNCNAME = '"+instArr[i]+"'";
					}
				}
			instSql+=" )";
			param.put("instSql", instSql);
		}
		return template.queryForList("SnaAdapter.selectApCodeList", param);
	}
	public List selectListToExcel(HashMap param) throws Exception {
		return template.queryForList("SnaAdapter.selectListToExcel", param);
	}	
}
