package com.siginfo.dao;

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

import javax.annotation.Resource;

import org.apache.ibatis.session.SqlSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.siginfo.vo.PhaseInfoVO;
import com.siginfo.vo.PlanCRHDInfoVO;
import com.siginfo.vo.PlanCROPInfoVO;
import com.siginfo.vo.PlanCRRSInfoVO;
import com.siginfo.vo.PlanCRWDInfoVO;
import com.siginfo.vo.SignalInfoVO;
import com.siginfo.vo.TbIntPhaseVO;
import com.siginfo.vo.TbIntStatusVO;
import com.siginfo.vo.TbIntVO;
import com.siginfo.vo.TbRegionCenterVO;
import com.siginfo.vo.TbSigunguVO;

@Repository
public class MainDao {
	
	@Autowired
	@Resource(name="sqlSessionTemplate")
	private SqlSession query;
	
	public List<PhaseInfoVO> phaseInfoList(Map<String, Object> paramMap) throws Exception {
		return query.selectList("getPhaseInfo",paramMap);
	}
	
	public List<PlanCRRSInfoVO> crrsInfoList(Map<String, Object> paramMap) throws Exception {
//		return query.selectList("getResrvInfo",paramMap);
		return query.selectList("getResrvInfoNew",paramMap);
	}
	
	public List<PlanCRHDInfoVO> crhdInfoList(Map<String, Object> paramMap) throws Exception {
//		return query.selectList("getHolyInfo",paramMap);
		return query.selectList("getHolyInfoNew",paramMap);
	}
	
	public List<PlanCROPInfoVO> cropInfoList(Map<String, Object> paramMap) throws Exception {
//		return query.selectList("getDayInfo",paramMap);
		return query.selectList("getDayInfoNew",paramMap);
	}
	
	public List<PlanCRWDInfoVO> crwdInfoList(Map<String, Object> paramMap) throws Exception {
//		return query.selectList("getWeekInfo",paramMap);
		return query.selectList("getWeekInfoNew",paramMap);
	}
	
	public void deleteCoordToAngle() throws Exception {
		query.delete("deleteCoordToAngle");
	}

	public void xlsExcelReader(String uploadId, Map<String, String> paramMap) throws Exception {
		if("int".equals(uploadId)) 
		{
			query.update("updateIntInfoList",paramMap);
		}
		else if("phase".equals(uploadId))
		{
			query.update("updatePhaseInfoList",paramMap);
		}
	}

	public void intPhaseInfoDelete(Map<String,Object> paramMap) throws Exception {
		//System.out.println("TB_INT_PHASE 테이블 BATCH_JOB_DEL: N 지우기");
		query.delete("intPhaseInfoDelete",paramMap);
	}
	
	public void jobDelUpdate(Map<String,Object> paramMap) throws Exception {
		query.update("jobDelUpdate",paramMap);
	}
	
	public List<SignalInfoVO> getSignalInfoAll() throws Exception {
		return query.selectList("getSignalInfoAll");
	}
	
	public List<TbIntVO> getIntListAll() throws Exception {
		return query.selectList("getIntList");
	}
	
	public List<TbRegionCenterVO> getRegionCenterAll() throws Exception {
		return query.selectList("getRegionCenterList");
	}
	public List<TbIntStatusVO> getIntStatus() throws Exception {
		return query.selectList("getIntStatus");
	}
	public List<TbIntPhaseVO> getIntPhaseList() throws Exception {
		return query.selectList("getIntPhaseList");
	}
	public List<TbSigunguVO> getSigungu() throws Exception {
		return query.selectList("getSigungu");
	}

}
