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

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

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

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

@Service("luHostService")
public class LuHostService extends BaseService{
	
	@Autowired
	@Qualifier("luHostDao")
	private LuHostDao dao;
	
	public HashMap selectList(int startNum,int endNum) throws Exception{
		HashMap paramMap = new HashMap();
		
		// 전체 목록수 얻기
		int totalCount = dao.selectListCount(paramMap);

		paramMap.put("startNum" , startNum);// 시작 record
		paramMap.put("endNum"   , endNum);// 끝 record

		List<HashMap<String, Object>> list = dao.selectList(paramMap);
		
		HashMap map = new HashMap();

		map.put("totalCount", totalCount);
		map.put("list", list);

		return map;
	}
	
	public HashMap selectDetail(String snaAdptrSevrName) throws Exception { 
		HashMap paramMap = new HashMap();
		paramMap.put("snaAdptrSevrName", snaAdptrSevrName);
		HashMap resultMap = dao.selectDetail(paramMap);

		return resultMap;

	}
	
	public int selectHostCnt(HashMap paramMap) throws Exception{
		return dao.selectHostCnt(paramMap);
	}
	
	public void update(HashMap paramMap) throws Exception {
		dao.update(paramMap);
	}	
	public void insert(HashMap paramMap) throws Exception {
		dao.insert(paramMap);
	}
	public void delete(HashMap paramMap) throws Exception {
		dao.delete(paramMap);
	}	
	
	public HashMap selectListToExcel(HashMap<String, Object> paramMap ) throws Exception {

		List list = dao.selectListToExcel(paramMap);
		
		for(int i=0;i<list.size();i++){
			HashMap tmp = (HashMap) list.get(i);
			String rowNo = tmp.get("ROWNO").toString();
			tmp.put("ROWNO", String.valueOf(rowNo));
		}
		

		HashMap map = new HashMap();

		map.put("list", list);

		return map;
	}
	

}
