package com.madeu.dao.web.webholidaymanagement;

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 WebHolidayManagementSqlMapDAO extends SqlSessionDaoSupport{

	@Autowired
	private SqlSessionTemplate sqlSessionTemplate;

	@PostConstruct
	void init() {
		setSqlSessionTemplate(sqlSessionTemplate);
	}
	
	/**
	 * 휴무관리 정보 총 갯수 조회 (total count)
	 * 
	 * @param Map
	 * @return
	 * @throws DataAccessException 
	 */
	public List<Map<String, Object>> selectTotalHolidayManagementCount(HashMap<String, Object> paramMap)
			throws DataAccessException {
		logger.debug("WebHolidayManagementSqlMapDAO selectTotalHolidayManagementCount START");
		String sqlId = "WebHolidayManagement.selectTotalHolidayManagementCount";
		logger.debug("WebHolidayManagementSqlMapDAO selectTotalHolidayManagementCount END");
		return getSqlSession().selectList(sqlId, paramMap);
	}
	
	/**
	 * 휴무관리 정보 리스트 조회 (List)
	 * 
	 * @param Map
	 * @return
	 * @throws DataAccessException 
	 */
	public List<Map<String, Object>> selectListHolidayManagement(HashMap<String, Object> paramMap)
			throws DataAccessException {
		logger.debug("WebHolidayManagementSqlMapDAO selectListHolidayManagement START");
		String sqlId = "WebHolidayManagement.selectListHolidayManagement";
		logger.debug("WebHolidayManagementSqlMapDAO selectListHolidayManagement END");
		return getSqlSession().selectList(sqlId, paramMap);
	}
	
	/**
	 * 휴무관리 정보 리스트 조회 (List, Excel)
	 * 
	 * @param Map
	 * @return
	 * @throws DataAccessException 
	 */
	public List<Map<String, Object>> selectListHolidayManagementExcel(HashMap<String, Object> paramMap)
			throws DataAccessException {
		logger.debug("WebHolidayManagementSqlMapDAO selectListHolidayManagementExcel START");
		String sqlId = "WebHolidayManagement.selectListHolidayManagementExcel";
		logger.debug("WebHolidayManagementSqlMapDAO selectListHolidayManagementExcel END");
		return getSqlSession().selectList(sqlId, paramMap);
	}
	
	/**
	 * 휴무관리 정보 조회
	 * 
	 * @param Map
	 * @return
	 * @throws DataAccessException 
	 */
	public List<Map<String, Object>> selectHolidayManagement(HashMap<String, Object> paramMap)
			throws DataAccessException {
		logger.debug("WebHolidayManagementSqlMapDAO selectHolidayManagement START");
		String sqlId = "WebHolidayManagement.selectHolidayManagement";
		logger.debug("WebHolidayManagementSqlMapDAO selectHolidayManagement END");
		return getSqlSession().selectList(sqlId, paramMap);
	}
	
	/**
	 * 휴무관리 정보 등록
	 * 
	 * @param Map
	 * @return
	 * @throws DataAccessException
	 */
	public int insertHolidayManagement(HashMap<String, Object> paramMap)
			throws DataAccessException {
		logger.debug("WebHolidayManagementSqlMapDAO insertHolidayManagement START");
		String sqlId = "WebHolidayManagement.insertHolidayManagement";
		logger.debug("WebHolidayManagementSqlMapDAO insertHolidayManagement END");
		return getSqlSession().insert(sqlId, paramMap);
	}
	
	/**
	 * 휴무관리 정보 수정
	 * 
	 * @param Map
	 * @return
	 * @throws DataAccessException
	 */
	public int updateHolidayManagement(HashMap<String, Object> paramMap)
			throws DataAccessException {
		logger.debug("WebHolidayManagementSqlMapDAO updateHolidayManagement START");
		String sqlId = "WebHolidayManagement.updateHolidayManagement";
		logger.debug("WebHolidayManagementSqlMapDAO updateHolidayManagement END");
		return getSqlSession().update(sqlId, paramMap);
	}
	
	/**
	 * 휴무관리 정보 휴무취소
	 * 
	 * @param Map
	 * @return
	 * @throws DataAccessException
	 */
	public int updateHolidayManagementCancel(HashMap<String, Object> paramMap)
			throws DataAccessException {
		logger.debug("WebHolidayManagementSqlMapDAO updateHolidayManagementCancel START");
		String sqlId = "WebHolidayManagement.updateHolidayManagementCancel";
		logger.debug("WebHolidayManagementSqlMapDAO updateHolidayManagementCancel END");
		return getSqlSession().update(sqlId, paramMap);
	}
	
	/**
	 * 휴무관리 정보 취소사유 수정
	 * 
	 * @param Map
	 * @return
	 * @throws DataAccessException
	 */
	public int updateHolidayManagementCancelEtc(HashMap<String, Object> paramMap)
			throws DataAccessException {
		logger.debug("WebHolidayManagementSqlMapDAO updateHolidayManagementCancelEtc START");
		String sqlId = "WebHolidayManagement.updateHolidayManagementCancelEtc";
		logger.debug("WebHolidayManagementSqlMapDAO updateHolidayManagementCancelEtc END");
		return getSqlSession().update(sqlId, paramMap);
	}

	/**
	 * 휴무관리 정보 삭제
	 * 
	 * @param Map
	 * @return
	 * @throws DataAccessException
	 */
	public int deleteHolidayManagement(HashMap<String, Object> paramMap)
			throws DataAccessException {
		logger.debug("WebHolidayManagementSqlMapDAO deleteHolidayManagement START");
		String sqlId = "WebHolidayManagement.deleteHolidayManagement";
		logger.debug("WebHolidayManagementSqlMapDAO deleteHolidayManagement END");
		return getSqlSession().update(sqlId, paramMap);
	}
}
