package com.madeu.dao.web.webusermedicalchart;

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

	@Autowired
	private SqlSessionTemplate sqlSessionTemplate;

	@PostConstruct
	void init() {
		setSqlSessionTemplate(sqlSessionTemplate);
	}
	
	/**
	 * 고객 시술차트 정보 총 갯수 조회 (total count)
	 * 
	 * @param Map
	 * @return
	 * @throws DataAccessException 
	 */
	public List<Map<String, Object>> selectTotalUserMedicalChartCount(HashMap<String, Object> paramMap)
			throws DataAccessException {
		logger.debug("WebUserMedicalChartSqlMapDAO selectTotalUserMedicalChartCount START");
		String sqlId = "WebUserMedicalChart.selectTotalUserMedicalChartCount";
		logger.debug("WebUserMedicalChartSqlMapDAO selectTotalUserMedicalChartCount END");
		return getSqlSession().selectList(sqlId, paramMap);
	}
	
	/**
	 * 고객 시술차트 정보 리스트 조회 (List)
	 * 
	 * @param Map
	 * @return
	 * @throws DataAccessException 
	 */
	public List<Map<String, Object>> selectListUserMedicalChart(HashMap<String, Object> paramMap)
			throws DataAccessException {
		logger.debug("WebUserMedicalChartSqlMapDAO selectListUserMedicalChart START");
		String sqlId = "WebUserMedicalChart.selectListUserMedicalChart";
		logger.debug("WebUserMedicalChartSqlMapDAO selectListUserMedicalChart END");
		return getSqlSession().selectList(sqlId, paramMap);
	}
	
	/**
	 * 고객 상세 - 고객 시술차트 정보 리스트 조회 (List, Excel)
	 * 
	 * @param Map
	 * @return
	 * @throws DataAccessException 
	 */
	public List<Map<String, Object>> selectListUserMedicalChartExcel(HashMap<String, Object> paramMap)
			throws DataAccessException {
		logger.debug("WebUserMedicalChartSqlMapDAO selectListUserMedicalChartExcel START");
		String sqlId = "WebUserMedicalChart.selectListUserMedicalChartExcel";
		logger.debug("WebUserMedicalChartSqlMapDAO selectListUserMedicalChartExcel END");
		return getSqlSession().selectList(sqlId, paramMap);
	}
	
	/**
	 * 고객 시술차트 정보 리스트 조회 (List, Top5)
	 * 
	 * @param Map
	 * @return
	 * @throws DataAccessException 
	 */
	public List<Map<String, Object>> selectListUserMedicalChartTop5(HashMap<String, Object> paramMap)
			throws DataAccessException {
		logger.debug("WebUserMedicalChartSqlMapDAO selectListUserMedicalChartTop5 START");
		String sqlId = "WebUserMedicalChart.selectListUserMedicalChartTop5";
		logger.debug("WebUserMedicalChartSqlMapDAO selectListUserMedicalChartTop5 END");
		return getSqlSession().selectList(sqlId, paramMap);
	}
	
	/**
	 * 고객 시술차트 정보 조회
	 *
	 * @param Map
	 * @return
	 * @throws DataAccessException
	 */
	public Map<String, Object> selectUserMedicalChart(HashMap<String, Object> paramMap)
			throws DataAccessException {
		logger.debug("WebUserMedicalChartSqlMapDAO selectUserMedicalChart START");
		String sqlId = "WebUserMedicalChart.selectUserMedicalChart";
		logger.debug("WebUserMedicalChartSqlMapDAO selectUserMedicalChart END");
		return getSqlSession().selectOne(sqlId, paramMap);
	}
	
	/**
	 * 고객 시술차트 - 차트 번호 조회 (신규생성)
	 * 
	 * @param Map
	 * @return
	 * @throws DataAccessException 
	 */
	public List<Map<String, Object>> selectUserMedicalChartNumber(HashMap<String, Object> paramMap)
			throws DataAccessException {
		logger.debug("WebUserMedicalChartSqlMapDAO selectUserMedicalChartNumber START");
		String sqlId = "WebUserMedicalChart.selectUserMedicalChartNumber";
		logger.debug("WebUserMedicalChartSqlMapDAO selectUserMedicalChartNumber END");
		return getSqlSession().selectList(sqlId, paramMap);
	}
	
	/**
	 * 고객 시술차트 정보 등록
	 * 
	 * @param Map
	 * @return
	 * @throws DataAccessException
	 */
	public int insertUserMedicalChart(HashMap<String, Object> paramMap)
			throws DataAccessException {
		logger.debug("WebUserMedicalChartSqlMapDAO insertUserMedicalChart START");
		String sqlId = "WebUserMedicalChart.insertUserMedicalChart";
		logger.debug("WebUserMedicalChartSqlMapDAO insertUserMedicalChart END");
		return getSqlSession().insert(sqlId, paramMap);
	}
	
	/**
	 * 고객 시술차트 정보 수정
	 * 
	 * @param Map
	 * @return
	 * @throws DataAccessException
	 */
	public int updateUserMedicalChart(HashMap<String, Object> paramMap)
			throws DataAccessException {
		logger.debug("WebUserMedicalChartSqlMapDAO updateUserMedicalChart START");
		String sqlId = "WebUserMedicalChart.updateUserMedicalChart";
		logger.debug("WebUserMedicalChartSqlMapDAO updateUserMedicalChart END");
		return getSqlSession().update(sqlId, paramMap);
	}

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