package com.madeu.dao.mobile.mobilemedicalchart;

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

	@Autowired
	private SqlSessionTemplate sqlSessionTemplate;

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

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