package com.madeu.dao.web.webuserconsultingchart;

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

	@Autowired
	private SqlSessionTemplate sqlSessionTemplate;

	@PostConstruct
	void init() {
		setSqlSessionTemplate(sqlSessionTemplate);
	}
	
	/**
	 * 고객 상세 - 고객 상담차트 정보 총 갯수 조회 (total count)
	 * 
	 * @param Map
	 * @return
	 * @throws DataAccessException 
	 */
	public List<Map<String, Object>> selectTotalUserConsultingChartCount(HashMap<String, Object> paramMap)
			throws DataAccessException {
		logger.debug("WebUserConsultingChartSqlMapDAO selectTotalUserConsultingChartCount START");
		String sqlId = "WebUserConsultingChart.selectTotalUserConsultingChartCount";
		logger.debug("WebUserConsultingChartSqlMapDAO selectTotalUserConsultingChartCount END");
		return getSqlSession().selectList(sqlId, paramMap);
	}
	
	/**
	 * 고객 상세 - 고객 상담차트 정보 리스트 조회 (List)
	 * 
	 * @param Map
	 * @return
	 * @throws DataAccessException 
	 */
	public List<Map<String, Object>> selectListUserConsultingChart(HashMap<String, Object> paramMap)
			throws DataAccessException {
		logger.debug("WebUserConsultingChartSqlMapDAO selectListUserConsultingChart START");
		String sqlId = "WebUserConsultingChart.selectListUserConsultingChart";
		logger.debug("WebUserConsultingChartSqlMapDAO selectListUserConsultingChart END");
		return getSqlSession().selectList(sqlId, paramMap);
	}
	
	/**
	 * 고객 상세 - 고객 상담차트 정보 리스트 조회 (List, Excel)
	 * 
	 * @param Map
	 * @return
	 * @throws DataAccessException 
	 */
	public List<Map<String, Object>> selectListUserConsultingChartExcel(HashMap<String, Object> paramMap)
			throws DataAccessException {
		logger.debug("WebUserConsultingChartSqlMapDAO selectListUserConsultingChartExcel START");
		String sqlId = "WebUserConsultingChart.selectListUserConsultingChartExcel";
		logger.debug("WebUserConsultingChartSqlMapDAO selectListUserConsultingChartExcel END");
		return getSqlSession().selectList(sqlId, paramMap);
	}
	
	/**
	 * 고객 상담차트 정보 리스트 조회 (List, Top5)
	 * 
	 * @param Map
	 * @return
	 * @throws DataAccessException 
	 */
	public List<Map<String, Object>> selectListUserConsultingChartTop5(HashMap<String, Object> paramMap)
			throws DataAccessException {
		logger.debug("WebUserConsultingChartSqlMapDAO selectListUserConsultingChartTop5 START");
		String sqlId = "WebUserConsultingChart.selectListUserConsultingChartTop5";
		logger.debug("WebUserConsultingChartSqlMapDAO selectListUserConsultingChartTop5 END");
		return getSqlSession().selectList(sqlId, paramMap);
	}
	
	/**
	 * 고객 상담차트 정보 조회
	 * 
	 * @param Map
	 * @return
	 * @throws DataAccessException 
	 */
	public Map<String, Object> selectUserConsultingChart(HashMap<String, Object> paramMap)
			throws DataAccessException {
		logger.debug("WebUserConsultingChartSqlMapDAO selectUserConsultingChart START");
		String sqlId = "WebUserConsultingChart.selectUserConsultingChart";
		logger.debug("WebUserConsultingChartSqlMapDAO selectUserConsultingChart END");
		return getSqlSession().selectOne(sqlId, paramMap);
	}
	
	/**
	 * 고객 상담차트 - 차트 번호 조회 (신규생성)
	 * 
	 * @param Map
	 * @return
	 * @throws DataAccessException 
	 */
	public List<Map<String, Object>> selectUserConsultingChartNumber(HashMap<String, Object> paramMap)
			throws DataAccessException {
		logger.debug("WebUserConsultingChartSqlMapDAO selectUserConsultingChartNumber START");
		String sqlId = "WebUserConsultingChart.selectUserConsultingChartNumber";
		logger.debug("WebUserConsultingChartSqlMapDAO selectUserConsultingChartNumber END");
		return getSqlSession().selectList(sqlId, paramMap);
	}
	
	/**
	 * 고객 상담차트 정보 등록
	 * 
	 * @param Map
	 * @return
	 * @throws DataAccessException
	 */
	public int insertUserConsultingChart(HashMap<String, Object> paramMap)
			throws DataAccessException {
		logger.debug("WebUserConsultingChartSqlMapDAO insertUserConsultingChart START");
		String sqlId = "WebUserConsultingChart.insertUserConsultingChart";
		logger.debug("WebUserConsultingChartSqlMapDAO insertUserConsultingChart END");
		return getSqlSession().insert(sqlId, paramMap);
	}
	
	/**
	 * 고객 상담차트 정보 수정
	 * 
	 * @param Map
	 * @return
	 * @throws DataAccessException
	 */
	public int updateUserConsultingChart(HashMap<String, Object> paramMap)
			throws DataAccessException {
		logger.debug("WebUserConsultingChartSqlMapDAO updateUserConsultingChart START");
		String sqlId = "WebUserConsultingChart.updateUserConsultingChart";
		logger.debug("WebUserConsultingChartSqlMapDAO updateUserConsultingChart END");
		return getSqlSession().update(sqlId, paramMap);
	}

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