package com.madeu.dao.mobile.mobileconsultingchart;

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

	@Autowired
	private SqlSessionTemplate sqlSessionTemplate;

	@PostConstruct
	void init() {
		setSqlSessionTemplate(sqlSessionTemplate);
	}
	
	/**
	 * 고객 상담차트 - 차트 번호 조회 (신규생성)
	 * 
	 * @param Map
	 * @return
	 * @throws DataAccessException 
	 */
	public List<Map<String, Object>> selectConsultingChartNumber(HashMap<String, Object> paramMap)
			throws DataAccessException {
		logger.debug("MobileConsultingChartSqlMapDAO selectConsultingChartNumber START");
		String sqlId = "MobileConsultingChart.selectConsultingChartNumber";
		logger.debug("MobileConsultingChartSqlMapDAO selectConsultingChartNumber END");
		return getSqlSession().selectList(sqlId, paramMap);
	}
	
	/**
	 * 고객 상담차트 정보 등록
	 * 
	 * @param Map
	 * @return
	 * @throws DataAccessException
	 */
	public int insertConsultingChart(HashMap<String, Object> paramMap)
			throws DataAccessException {
		logger.debug("MobileConsultingChartSqlMapDAO insertConsultingChart START");
		String sqlId = "MobileConsultingChart.insertConsultingChart";
		logger.debug("MobileConsultingChartSqlMapDAO insertConsultingChart END");
		return getSqlSession().insert(sqlId, paramMap);
	}

	/**
	 * 고객 상담차트 정보 삭제
	 *
	 * @param Map
	 * @return
	 * @throws DataAccessException
	 */
	public int deleteConsultingChart(HashMap<String, Object> paramMap)
			throws DataAccessException {
		logger.debug("MobileConsultingChartSqlMapDAO deleteConsultingChart START");
		String sqlId = "MobileConsultingChart.deleteConsultingChart";
		logger.debug("MobileConsultingChartSqlMapDAO deleteConsultingChart END");
		return getSqlSession().update(sqlId, paramMap);
	}
}
