package com.madeu.dao.mobile.mobileevent;

import jakarta.annotation.PostConstruct;
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 java.util.HashMap;
import java.util.List;
import java.util.Map;

@Repository
public class MobileEventSqlMapDAO extends SqlSessionDaoSupport{

	@Autowired
	private SqlSessionTemplate sqlSessionTemplate;

	@PostConstruct
	void init() {
		setSqlSessionTemplate(sqlSessionTemplate);
	}

	/**
	 * 이벤트 정보 총 갯수 조회 (total count)
	 *
	 * @param Map
	 * @return
	 * @throws DataAccessException
	 */
	public List<Map<String, Object>> selectListEventCount(HashMap<String, Object> paramMap)
			throws DataAccessException {
		logger.debug("MobileEventSqlMapDAO selectListEventCount START");
		String sqlId = "MobileEvent.selectListEventCount";
		logger.debug("MobileEventSqlMapDAO selectListEventCount END");
		return getSqlSession().selectList(sqlId, paramMap);
	}


	/**
	 * 이벤트 조회 (List)
	 *
	 * @param Map
	 * @return
	 * @throws DataAccessException
	 */
	public List<Map<String, Object>> selectListEvent(HashMap<String, Object> paramMap)
			throws DataAccessException {
		logger.debug("MobileEventSqlMapDAO selectListEvent START");
		String sqlId = "MobileEvent.selectListEvent";
		logger.debug("MobileEventSqlMapDAO selectListEvent END");
		return getSqlSession().selectList(sqlId, paramMap);
	}
	

	
	/**
	 * 이벤트 내용 정보 조회
	 * 
	 * @param Map
	 * @return
	 * @throws DataAccessException 
	 */
	public List<Map<String, Object>> selectEvent(HashMap<String, Object> paramMap)
			throws DataAccessException {
		logger.debug("MobileEventSqlMapDAO selectEvent START");
		String sqlId = "MobileEvent.selectEvent";
		logger.debug("MobileEventSqlMapDAO selectEvent END");
		return getSqlSession().selectList(sqlId, paramMap);
	}

}
