package kcg.faics.fa.service.impl;

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

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;

import kcg.faics.cmmn.service.CodeService;
import kcg.faics.fa.service.EduService;
import kcg.faics.fa.vo.EduSearchVO;
import kcg.faics.fa.vo.EduVO;
import egovframework.rte.fdl.cmmn.EgovAbstractServiceImpl;

/**
 * 교육현황 비즈니스 로직.
 * 
 * @author kimnomin
 *
 */
@Service("eduService")
public class EduServiceImpl extends EgovAbstractServiceImpl implements EduService {

	/**
	 * 교육현황 Mapper. 
	 */
	@Resource(name = "eduMapper")
	private EduMapper eduMapper;
	
	@Override
	public EduVO select(final EduVO dataVO) throws Exception {
		return eduMapper.select(dataVO);
	}

	@Override
	public List<EduVO> selectListAll(final EduSearchVO searchVO) throws Exception {
		// TODO Auto-generated method stub
		return null;		
	}

	@Override
	public List<EduVO> selectList(final EduSearchVO searchVO) throws Exception {
		if (CodeService.LIST_ALL_VAL.equals(searchVO.getEduCourse())) {
			searchVO.setEduCourse("");
		}
		if (CodeService.LIST_ALL_VAL.equals(searchVO.getPlace1())) {
			searchVO.setPlace1("");
		}
		return eduMapper.selectList(searchVO);
	}

	@Override
	public int selectListCnt(final EduSearchVO searchVO) throws Exception {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public int selectTotalCnt(final EduSearchVO searchVO) throws Exception {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public HashMap<String, Object> insert(final EduVO dataVO,
			final Map<String, MultipartFile> fileMap) throws Exception {
		HashMap<String, Object> map = new HashMap<String, Object>();
		map.put("result", eduMapper.insert(dataVO));
		return map;
	}

	@Override
	public HashMap<String, Object> update(final EduVO dataVO,
			final Map<String, MultipartFile> fileMap, final String[] deleteFiles)
			throws Exception {
		HashMap<String, Object> map = new HashMap<String, Object>();
		map.put("result", eduMapper.update(dataVO));
		return map;
	}

	@Override
	public HashMap<String, Object> delete(final EduVO dataVO) throws Exception {
		HashMap<String, Object> map = new HashMap<String, Object>();
		map.put("result", eduMapper.delete(dataVO));
		return map;
	}

}
