package com.madeu.dao.web.webuserpushhistory;

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

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;

@Repository
public class WebUserPushHistorySqlMapDAO extends SqlSessionDaoSupport{

	@Autowired
	private SqlSessionTemplate sqlSessionTemplate;

	@PostConstruct
	void init() {
		setSqlSessionTemplate(sqlSessionTemplate);
	}
	
	/**
	 * 고객 - 알림 리스트 정보 총 갯수 조회 (total count)
	 * 
	 * @param Map
	 * @return
	 * @throws DataAccessException 
	 */
	public List<Map<String, Object>> selectTotalUserPushHistoryCount(HashMap<String, Object> paramMap)
			throws DataAccessException {
		logger.debug("WebUserPushHistorySqlMapDAO selectTotalUserPushHistoryCount START");
		String sqlId = "WebUserPushHistory.selectTotalUserPushHistoryCount";
		logger.debug("WebUserPushHistorySqlMapDAO selectTotalUserPushHistoryCount END");
		return getSqlSession().selectList(sqlId, paramMap);
	}
	
	/**
	 * 고객 - 알림 리스트 정보 조회 (List)
	 * 
	 * @param Map
	 * @return
	 * @throws DataAccessException 
	 */
	public List<Map<String, Object>> selectListUserPushHistory(HashMap<String, Object> paramMap)
			throws DataAccessException {
		logger.debug("WebUserPushHistorySqlMapDAO selectListUserPushHistory START");
		String sqlId = "WebUserPushHistory.selectListUserPushHistory";
		logger.debug("WebUserPushHistorySqlMapDAO selectListUserPushHistory END");
		return getSqlSession().selectList(sqlId, paramMap);
	}
	
	/**
	 * 고객 - 알림 리스트 정보 조회 (List, Excel)
	 * 
	 * @param Map
	 * @return
	 * @throws DataAccessException 
	 */
	public List<Map<String, Object>> selectListUserPushHistoryExcel(HashMap<String, Object> paramMap)
			throws DataAccessException {
		logger.debug("WebUserPushHistorySqlMapDAO selectListUserPushHistoryExcel START");
		String sqlId = "WebUserPushHistory.selectListUserPushHistoryExcel";
		logger.debug("WebUserPushHistorySqlMapDAO selectListUserPushHistoryExcel END");
		return getSqlSession().selectList(sqlId, paramMap);
	}
	
	/**
	 * 고객 알림 이력 정보 등록
	 * 
	 * @param Map
	 * @return
	 * @throws DataAccessException
	 */
	public int insertUserPushHistory(HashMap<String, Object> paramMap)
			throws DataAccessException {
		logger.debug("WebUserPushHistorySqlMapDAO insertUserPushHistory START");
		String sqlId = "WebUserPushHistory.insertUserPushHistory";
		logger.debug("WebUserPushHistorySqlMapDAO insertUserPushHistory END");
		return getSqlSession().insert(sqlId, paramMap);
	}
	
}
