package com.madeu.dao.mobile.mobilesms;

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

	@Autowired
	private SqlSessionTemplate sqlSessionTemplate;

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

	/**
	 * 문자 전송 이력 등록
	 *
	 *
	 * @param map
	 * @return
	 * @throws DataAccessException
	 */
	public int insertSms(HashMap<String, Object> paramMap) throws DataAccessException {
		logger.debug("MobileSmsSqlMapDAO insertSms START");
		String sqlId = "MobileSms.insertSms";
		logger.debug("MobileSmsSqlMapDAO insertSms END");
		return getSqlSession().update(sqlId, paramMap);
	}

	/**
	 * 문자 전송 상태 변경
	 *
	 *
	 * @param map
	 * @return
	 * @throws DataAccessException
	 */
	public int updateSmsState(HashMap<String, Object> paramMap) throws DataAccessException {
		logger.debug("MobileSmsSqlMapDAO updateSmsState START");
		String sqlId = "MobileSms.updateSmsState";
		logger.debug("MobileSmsSqlMapDAO updateSmsState END");
		return getSqlSession().update(sqlId, paramMap);
	}
	/**
	 * 문자 전송 팝빌 상태 변경
	 *
	 *
	 * @param map
	 * @return
	 * @throws DataAccessException
	 */
	public int updateSmsPopbillState(HashMap<String, Object> paramMap) throws DataAccessException {
		logger.debug("MobileSmsSqlMapDAO updateSmsPopbillState START");
		String sqlId = "MobileSms.updateSmsPopbillState";
		logger.debug("MobileSmsSqlMapDAO updateSmsPopbillState END");
		return getSqlSession().update(sqlId, paramMap);
	}

}
