package com.madeu.dao.web.webtreatmentprocedureprice;

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;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Repository
public class WebTreatmentProcedurePriceSqlMapDAO extends SqlSessionDaoSupport{

	@Autowired
	private SqlSessionTemplate sqlSessionTemplate;

	@PostConstruct
	void init() {
		setSqlSessionTemplate(sqlSessionTemplate);
	}
	
	/**
	 * 시술 단가 정보 리스트 조회 (List)
	 * 
	 * @param Map
	 * @return
	 * @throws DataAccessException 
	 */
	public List<Map<String, Object>> selectListTreatmentProcedurePrice(HashMap<String, Object> paramMap)
			throws DataAccessException {
		logger.debug("WebTreatmentProcedurePriceSqlMapDAO selectListTreatmentProcedurePrice START");
		String sqlId = "WebTreatmentProcedurePrice.selectListTreatmentProcedurePrice";
		logger.debug("WebTreatmentProcedurePriceSqlMapDAO selectListTreatmentProcedurePrice END");
		return getSqlSession().selectList(sqlId, paramMap);
	}
	
	/**
	 * 시술 단가 정보 등록
	 * 
	 * @param Map
	 * @return
	 * @throws DataAccessException
	 */
	public int insertTreatmentProcedurePrice(HashMap<String, Object> paramMap)
			throws DataAccessException {
		logger.debug("WebTreatmentProcedurePriceSqlMapDAO insertTreatmentProcedurePrice START");
		String sqlId = "WebTreatmentProcedurePrice.insertTreatmentProcedurePrice";
		logger.debug("WebTreatmentProcedurePriceSqlMapDAO insertTreatmentProcedurePrice END");
		return getSqlSession().insert(sqlId, paramMap);
	}

	/**
	 * 시술 단가 정보 삭제
	 * 
	 * @param Map
	 * @return
	 * @throws DataAccessException
	 */
	public int deleteTreatmentProcedurePrice(HashMap<String, Object> paramMap)
			throws DataAccessException {
		logger.debug("WebTreatmentProcedurePriceSqlMapDAO deleteTreatmentProcedurePrice START");
		String sqlId = "WebTreatmentProcedurePrice.deleteTreatmentProcedurePrice";
		logger.debug("WebTreatmentProcedurePriceSqlMapDAO deleteTreatmentProcedurePrice END");
		return getSqlSession().update(sqlId, paramMap);
	}
}
