package com.madeu.dao.web.webvacationmanagement;

import org.mybatis.spring.SqlSessionTemplate;
import org.mybatis.spring.support.SqlSessionDaoSupport;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataAccessException;
import org.springframework.stereotype.Repository;

import jakarta.annotation.PostConstruct;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Repository
public class WebVacationManagementSqlMapDAO extends SqlSessionDaoSupport{

	@Autowired
	private SqlSessionTemplate sqlSessionTemplate;

	@PostConstruct
	void init() {
		setSqlSessionTemplate(sqlSessionTemplate);
	}
	
	/**
	 * 연차관리 정보 총 갯수 조회 (total count)
	 * 
	 * @param Map
	 * @return
	 * @throws DataAccessException 
	 */
	public List<Map<String, Object>> selectTotalVacationManagementCount(HashMap<String, Object> paramMap)
			throws DataAccessException {
		logger.debug("WebVacationManagementSqlMapDAO selectTotalVacationManagementCount START");
		String sqlId = "WebVacationManagement.selectTotalVacationManagementCount";
		logger.debug("WebVacationManagementSqlMapDAO selectTotalVacationManagementCount END");
		return getSqlSession().selectList(sqlId, paramMap);
	}
	
	/**
	 * 연차관리 정보 리스트 조회 (List)
	 * 
	 * @param Map
	 * @return
	 * @throws DataAccessException 
	 */
	public List<Map<String, Object>> selectListVacationManagement(HashMap<String, Object> paramMap)
			throws DataAccessException {
		logger.debug("WebVacationManagementSqlMapDAO selectListVacationManagement START");
		String sqlId = "WebVacationManagement.selectListVacationManagement";
		logger.debug("WebVacationManagementSqlMapDAO selectListVacationManagement END");
		return getSqlSession().selectList(sqlId, paramMap);
	}
	
	/**
	 * 연차관리 정보 리스트 조회 (List, Excel)
	 * 
	 * @param Map
	 * @return
	 * @throws DataAccessException 
	 */
	public List<Map<String, Object>> selectListVacationManagementExcel(HashMap<String, Object> paramMap)
			throws DataAccessException {
		logger.debug("WebVacationManagementSqlMapDAO selectListVacationManagementExcel START");
		String sqlId = "WebVacationManagement.selectListVacationManagementExcel";
		logger.debug("WebVacationManagementSqlMapDAO selectListVacationManagementExcel END");
		return getSqlSession().selectList(sqlId, paramMap);
	}
	
	/**
	 * 연차관리 상세 정보 조회 (List)
	 * 
	 * @param Map
	 * @return
	 * @throws DataAccessException 
	 */
	public List<Map<String, Object>> selectVacationManagement(HashMap<String, Object> paramMap)
			throws DataAccessException {
		logger.debug("WebVacationManagementSqlMapDAO selectVacationManagement START");
		String sqlId = "WebVacationManagement.selectVacationManagement";
		logger.debug("WebVacationManagementSqlMapDAO selectVacationManagement END");
		return getSqlSession().selectList(sqlId, paramMap);
	}
	
	/**
	 * 연차관리 상세 직원 정보 조회 (List)
	 * 
	 * @param Map
	 * @return
	 * @throws DataAccessException 
	 */
	public List<Map<String, Object>> selectVacationManagementMember(HashMap<String, Object> paramMap)
			throws DataAccessException {
		logger.debug("WebVacationManagementSqlMapDAO selectVacationManagementMember START");
		String sqlId = "WebVacationManagement.selectVacationManagementMember";
		logger.debug("WebVacationManagementSqlMapDAO selectVacationManagementMember END");
		return getSqlSession().selectList(sqlId, paramMap);
	}
	
	/**
	 * 연차관리 사용기간 중복 정보 확인
	 * 
	 * @param Map
	 * @return
	 * @throws DataAccessException 
	 */
	public List<Map<String, Object>> selectVacationManagementDate(HashMap<String, Object> paramMap)
			throws DataAccessException {
		logger.debug("WebVacationManagementSqlMapDAO selectVacationManagementDate START");
		String sqlId = "WebVacationManagement.selectVacationManagementDate";
		logger.debug("WebVacationManagementSqlMapDAO selectVacationManagementDate END");
		return getSqlSession().selectList(sqlId, paramMap);
	}
	
	/**
	 * 연차관리 잔여 연차 조회 (one)
	 * 
	 * @param Map
	 * @return
	 * @throws DataAccessException 
	 */
	public List<Map<String, Object>> selectVacationManagementLeftDays(HashMap<String, Object> paramMap)
			throws DataAccessException {
		logger.debug("WebVacationManagementSqlMapDAO selectVacationManagementLeftDays START");
		String sqlId = "WebVacationManagement.selectVacationManagementLeftDays";
		logger.debug("WebVacationManagementSqlMapDAO selectVacationManagementLeftDays END");
		return getSqlSession().selectList(sqlId, paramMap);
	}

	/**
	 * 발행연차 수정 잔여 연차 조회
	 *
	 * @param Map
	 * @return
	 * @throws DataAccessException
	 */
	public List<Map<String, Object>> selectVacationManagementDays(HashMap<String, Object> paramMap)
			throws DataAccessException {
		logger.debug("WebVacationManagementSqlMapDAO selectVacationManagementDays START");
		String sqlId = "WebVacationManagement.selectVacationManagementDays";
		logger.debug("WebVacationManagementSqlMapDAO selectVacationManagementDays END");
		return getSqlSession().selectList(sqlId, paramMap);
	}
	
	/**
	 * 연차관리 정보 등록
	 * 
	 * @param Map
	 * @return
	 * @throws DataAccessException
	 */
	public int insertVacationManagement(HashMap<String, Object> paramMap)
			throws DataAccessException {
		logger.debug("WebVacationManagementSqlMapDAO insertVacationManagement START");
		String sqlId = "WebVacationManagement.insertVacationManagement";
		logger.debug("WebVacationManagementSqlMapDAO insertVacationManagement END");
		return getSqlSession().insert(sqlId, paramMap);
	}
	
	/**
	 * 연차관리 정보 수정
	 * 
	 * @param Map
	 * @return
	 * @throws DataAccessException
	 */
	public int updateVacationManagement(HashMap<String, Object> paramMap)
			throws DataAccessException {
		logger.debug("WebVacationManagementSqlMapDAO updateVacationManagement START");
		String sqlId = "WebVacationManagement.updateVacationManagement";
		logger.debug("WebVacationManagementSqlMapDAO updateVacationManagement END");
		return getSqlSession().update(sqlId, paramMap);
	}
	
	/**
	 * 연차관리 정보 잔여연차 수정
	 * 
	 * @param Map
	 * @return
	 * @throws DataAccessException
	 */
	public int updateVacationManagementLeftDays(HashMap<String, Object> paramMap)
			throws DataAccessException {
		logger.debug("WebVacationManagementSqlMapDAO updateVacationManagementLeftDays START");
		String sqlId = "WebVacationManagement.updateVacationManagementLeftDays";
		logger.debug("WebVacationManagementSqlMapDAO updateVacationManagementLeftDays END");
		return getSqlSession().update(sqlId, paramMap);
	}

	/**
	 * 연차관리 정보 삭제
	 * 
	 * @param Map
	 * @return
	 * @throws DataAccessException
	 */
	public int deleteVacationManagement(HashMap<String, Object> paramMap)
			throws DataAccessException {
		logger.debug("WebVacationManagementSqlMapDAO deleteVacationManagement START");
		String sqlId = "WebVacationManagement.deleteVacationManagement";
		logger.debug("WebVacationManagementSqlMapDAO deleteVacationManagement END");
		return getSqlSession().update(sqlId, paramMap);
	}
	/**
	 * 연차관리 상세정보 리스트 조회 (List, Excel)
	 *
	 * @param Map
	 * @return
	 * @throws DataAccessException
	 */
	public List<Map<String, Object>> downloadVacationManagementDetailExcel(HashMap<String, Object> paramMap)
			throws DataAccessException {
		logger.debug("WebVacationManagementSqlMapDAO downloadVacationManagementDetailExcel START");
		String sqlId = "WebVacationManagement.downloadVacationManagementDetailExcel";
		logger.debug("WebVacationManagementSqlMapDAO downloadVacationManagementDetailExcel END");
		return getSqlSession().selectList(sqlId, paramMap);
	}

	/**
	 * 연차관리 상세정보 리스트 조회 (List, Excel)
	 *
	 * @param Map
	 * @return
	 * @throws DataAccessException
	 */
	public List<Map<String, Object>> selectListMemberExcel(HashMap<String, Object> paramMap)
			throws DataAccessException {
		logger.debug("WebVacationManagementSqlMapDAO selectListMemberExcel START");
		String sqlId = "WebVacationManagement.selectListMemberExcel";
		logger.debug("WebVacationManagementSqlMapDAO selectListMemberExcel END");
		return getSqlSession().selectList(sqlId, paramMap);
	}
}
