package com.madeu.dao.web.webtreatmentproceduredoctor;

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

	@Autowired
	private SqlSessionTemplate sqlSessionTemplate;

	@PostConstruct
	void init() {
		setSqlSessionTemplate(sqlSessionTemplate);
	}
	
	/**
	 * 닥터 정보 리스트 조회 (List)
	 * 
	 * @param Map
	 * @return
	 * @throws DataAccessException 
	 */
	public List<Map<String, Object>> selectListTreatmentProcedureDoctor(HashMap<String, Object> paramMap)
			throws DataAccessException {
		logger.debug("WebTreatmentProcedureDoctorSqlMapDAO selectListTreatmentProcedureDoctor START");
		String sqlId = "WebTreatmentProcedureDoctor.selectListTreatmentProcedureDoctor";
		logger.debug("WebTreatmentProcedureDoctorSqlMapDAO selectListTreatmentProcedureDoctor END");
		return getSqlSession().selectList(sqlId, paramMap);
	}
	
	/**
	 * 진료유형 닥터인지 확인 (COUNT)
	 * 
	 * @param Map
	 * @return
	 * @throws DataAccessException 
	 */
	public List<Map<String, Object>> checkTreatmentProcedureDoctor(HashMap<String, Object> paramMap)
			throws DataAccessException {
		logger.debug("WebTreatmentProcedureDoctorSqlMapDAO checkTreatmentProcedureDoctor START");
		String sqlId = "WebTreatmentProcedureDoctor.checkTreatmentProcedureDoctor";
		logger.debug("WebTreatmentProcedureDoctorSqlMapDAO checkTreatmentProcedureDoctor END");
		return getSqlSession().selectList(sqlId, paramMap);
	}
	
	/**
	 * 닥터 정보 등록
	 * 
	 * @param Map
	 * @return
	 * @throws DataAccessException
	 */
	public int insertTreatmentProcedureDoctor(HashMap<String, Object> paramMap)
			throws DataAccessException {
		logger.debug("WebTreatmentProcedureDoctorSqlMapDAO insertTreatmentProcedureDoctor START");
		String sqlId = "WebTreatmentProcedureDoctor.insertTreatmentProcedureDoctor";
		logger.debug("WebTreatmentProcedureDoctorSqlMapDAO insertTreatmentProcedureDoctor END");
		return getSqlSession().insert(sqlId, paramMap);
	}

	/**
	 * 닥터 정보 삭제
	 * 
	 * @param Map
	 * @return
	 * @throws DataAccessException
	 */
	public int deleteTreatmentProcedureDoctor(HashMap<String, Object> paramMap)
			throws DataAccessException {
		logger.debug("WebTreatmentProcedureDoctorSqlMapDAO deleteTreatmentProcedureDoctor START");
		String sqlId = "WebTreatmentProcedureDoctor.deleteTreatmentProcedureDoctor";
		logger.debug("WebTreatmentProcedureDoctorSqlMapDAO deleteTreatmentProcedureDoctor END");
		return getSqlSession().update(sqlId, paramMap);
	}
}
