package com.eactive.eai.rms.bat.manage.comm.code;

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

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

import com.eactive.eai.rms.bat.common.base.BatBaseService;

@Service("batCodeService")
public class BatCodeService extends BatBaseService {

	@Autowired
	@Qualifier("batCodeDao")
	private BatCodeDao batCodeDao;

	public HashMap<String, Object> selectList(int startNum,int endNum, String searchMsg, String searchDesc) throws Exception {
		HashMap<String, Object> paramMap = new HashMap<String, Object>();

		//검색 조건 
		paramMap.put("searchMsg", searchMsg.toUpperCase());
		paramMap.put("searchDesc", searchDesc.toUpperCase());
 
		// 전체 목록수 얻기
		int totalCount = batCodeDao.selectListCount(paramMap);

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

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

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

		return map;
	}	

	public HashMap<String, Object> selectDetail(String msgId) throws Exception {

		HashMap<String, Object> paramMap = new HashMap<String, Object>();
		paramMap.put("msgId", msgId);

		return batCodeDao.selectDetail( paramMap);
	}	

	public void update(HashMap<String, Object> paramMap) throws Exception {
		batCodeDao.update(paramMap);
	}

	public void insert(HashMap<String, Object> paramMap) throws Exception {
		batCodeDao.insert(paramMap);
	}

	public void delete(HashMap<String, Object> paramMap) throws Exception {
		batCodeDao.delete(paramMap);
	}	
}