package com.madeu.dao.web.webtreatmentprocedure;

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

	@Autowired
	private SqlSessionTemplate sqlSessionTemplate;

	@PostConstruct
	void init() {
		setSqlSessionTemplate(sqlSessionTemplate);
	}
	
	/**
	 * 진료 시술 정보 총 갯수 조회 (total count, option)
	 * 
	 * @param Map
	 * @return
	 * @throws DataAccessException 
	 */
	public List<Map<String, Object>> selectTotalTreatmentProcedureOptionCount(HashMap<String, Object> paramMap)
			throws DataAccessException {
		logger.debug("WebTreatmentProcedureSqlMapDAO selectTotalTreatmentProcedureOptionCount START");
		String sqlId = "WebTreatmentProcedure.selectTotalTreatmentProcedureOptionCount";
		logger.debug("WebTreatmentProcedureSqlMapDAO selectTotalTreatmentProcedureOptionCount END");
		return getSqlSession().selectList(sqlId, paramMap);
	}
	
	/**
	 * 진료 시술 조회 (List, option)
	 * 
	 * @param Map
	 * @return
	 * @throws DataAccessException 
	 */
	public List<Map<String, Object>> selectListTreatmentProcedureOption(HashMap<String, Object> paramMap)
			throws DataAccessException {
		logger.debug("WebTreatmentProcedureSqlMapDAO selectListTreatmentProcedureOption START");
		String sqlId = "WebTreatmentProcedure.selectListTreatmentProcedureOption";
		logger.debug("WebTreatmentProcedureSqlMapDAO selectListTreatmentProcedureOption END");
		return getSqlSession().selectList(sqlId, paramMap);
	}
	
	/**
	 * 진료 시술 조회2 (List, option, 페이징처리X)
	 * 
	 * @param Map
	 * @return
	 * @throws DataAccessException 
	 */
	public List<Map<String, Object>> selectListTreatmentProcedureOption2(HashMap<String, Object> paramMap)
			throws DataAccessException {
		logger.debug("WebTreatmentProcedureSqlMapDAO selectListTreatmentProcedureOption2 START");
		String sqlId = "WebTreatmentProcedure.selectListTreatmentProcedureOption2";
		logger.debug("WebTreatmentProcedureSqlMapDAO selectListTreatmentProcedureOption2 END");
		return getSqlSession().selectList(sqlId, paramMap);
	}
	
	/**
	 * 진료 시술 조회3 (List, option, 페이징처리X)
	 * 
	 * @param Map
	 * @return
	 * @throws DataAccessException 
	 */
	public List<Map<String, Object>> selectListTreatmentProcedureOption3(HashMap<String, Object> paramMap)
			throws DataAccessException {
		logger.debug("WebTreatmentProcedureSqlMapDAO selectListTreatmentProcedureOption3 START");
		String sqlId = "WebTreatmentProcedure.selectListTreatmentProcedureOption3";
		logger.debug("WebTreatmentProcedureSqlMapDAO selectListTreatmentProcedureOption3 END");
		return getSqlSession().selectList(sqlId, paramMap);
	}
	
	/**
	 * 진료 시술 정보 총 갯수 조회 (total count)
	 * 
	 * @param Map
	 * @return
	 * @throws DataAccessException 
	 */
	public List<Map<String, Object>> selectTotalTreatmentProcedureCount(HashMap<String, Object> paramMap)
			throws DataAccessException {
		logger.debug("WebTreatmentProcedureSqlMapDAO selectTotalTreatmentProcedureCount START");
		String sqlId = "WebTreatmentProcedure.selectTotalTreatmentProcedureCount";
		logger.debug("WebTreatmentProcedureSqlMapDAO selectTotalTreatmentProcedureCount END");
		return getSqlSession().selectList(sqlId, paramMap);
	}
	/**
	 * 진료 시술 번호 생성
	 *
	 * @param Map
	 * @return
	 * @throws DataAccessException
	 */
	public String selectTreatmentProdureNumber()
			throws DataAccessException {
		logger.debug("WebTreatmentProcedureSqlMapDAO selectTreatmentProdureNumber START");
		String sqlId = "WebTreatmentProcedure.selectTreatmentProdureNumber";
		logger.debug("WebTreatmentProcedureSqlMapDAO selectTreatmentProdureNumber END");
		return getSqlSession().selectOne(sqlId);
	}
	
	/**
	 * 진료 시술 정보 리스트 조회 (List)
	 * 
	 * @param Map
	 * @return
	 * @throws DataAccessException 
	 */
	public List<Map<String, Object>> selectListTreatmentProcedure(HashMap<String, Object> paramMap)
			throws DataAccessException {
		logger.debug("WebTreatmentProcedureSqlMapDAO selectListTreatmentProcedure START");
		String sqlId = "WebTreatmentProcedure.selectListTreatmentProcedure";
		logger.debug("WebTreatmentProcedureSqlMapDAO selectListTreatmentProcedure END");
		return getSqlSession().selectList(sqlId, paramMap);
	}
	
	/**
	 * 진료 시술 정보 조회
	 * 
	 * @param Map
	 * @return
	 * @throws DataAccessException 
	 */
	public List<Map<String, Object>> selectTreatmentProcedure2(HashMap<String, Object> paramMap)
			throws DataAccessException {
		logger.debug("WebTreatmentProcedureSqlMapDAO selectTreatmentProcedure2 START");
		String sqlId = "WebTreatmentProcedure.selectTreatmentProcedure2";
		logger.debug("WebTreatmentProcedureSqlMapDAO selectTreatmentProcedure2 END");
		return getSqlSession().selectList(sqlId, paramMap);
	}
	/**
	 * 중복 시술명 체크
	 *
	 * @param Map
	 * @return
	 * @throws DataAccessException
	 */
	public Integer selectTreatmentProcedureCount(HashMap<String, Object> paramMap)
			throws DataAccessException {
		logger.debug("WebTreatmentProcedureSqlMapDAO selectTreatmentProcedureCount START");
		String sqlId = "WebTreatmentProcedure.selectTreatmentProcedureCount";
		logger.debug("WebTreatmentProcedureSqlMapDAO selectTreatmentProcedureCount END");
		return getSqlSession().selectOne(sqlId, paramMap);
	}
	
	/**
	 * 진료 시술 정보 조회2
	 * 
	 * @param Map
	 * @return
	 * @throws DataAccessException 
	 */
	public List<Map<String, Object>> selectTreatmentProcedure(HashMap<String, Object> paramMap)
			throws DataAccessException {
		logger.debug("WebTreatmentProcedureSqlMapDAO selectTreatmentProcedure START");
		String sqlId = "WebTreatmentProcedure.selectTreatmentProcedure";
		logger.debug("WebTreatmentProcedureSqlMapDAO selectTreatmentProcedure END");
		return getSqlSession().selectList(sqlId, paramMap);
	}
	
	/**
	 * 진료 시술 정보 등록
	 * 
	 * @param Map
	 * @return
	 * @throws DataAccessException
	 */
	public int insertTreatmentProcedure(HashMap<String, Object> paramMap)
			throws DataAccessException {
		logger.debug("WebTreatmentProcedureSqlMapDAO insertTreatmentProcedure START");
		String sqlId = "WebTreatmentProcedure.insertTreatmentProcedure";
		logger.debug("WebTreatmentProcedureSqlMapDAO insertTreatmentProcedure END");
		return getSqlSession().insert(sqlId, paramMap);
	}
	
	/**
	 * 진료 시술 정보 수정
	 * 
	 * @param Map
	 * @return
	 * @throws DataAccessException
	 */
	public int updateTreatmentProcedure(HashMap<String, Object> paramMap)
			throws DataAccessException {
		logger.debug("WebTreatmentProcedureSqlMapDAO updateTreatmentProcedure START");
		String sqlId = "WebTreatmentProcedure.updateTreatmentProcedure";
		logger.debug("WebTreatmentProcedureSqlMapDAO updateTreatmentProcedure END");
		return getSqlSession().update(sqlId, paramMap);
	}
	
	/**
	 * 진료 시술 정보 활성화 수정
	 * 
	 * @param Map
	 * @return
	 * @throws DataAccessException
	 */
	public int updateTreatmentProcedureEnableYn(HashMap<String, Object> paramMap)
			throws DataAccessException {
		logger.debug("WebTreatmentProcedureSqlMapDAO updateTreatmentProcedureEnableYn START");
		String sqlId = "WebTreatmentProcedure.updateTreatmentProcedureEnableYn";
		logger.debug("WebTreatmentProcedureSqlMapDAO updateTreatmentProcedureEnableYn END");
		return getSqlSession().update(sqlId, paramMap);
	}
	
	/**
	 * 진료 시술 정보 진료 이동 (수정)
	 * 
	 * @param Map
	 * @return
	 * @throws DataAccessException
	 */
	public int updateTreatmentProcedureTreatmentId(HashMap<String, Object> paramMap)
			throws DataAccessException {
		logger.debug("WebTreatmentProcedureSqlMapDAO updateTreatmentProcedureTreatmentId START");
		String sqlId = "WebTreatmentProcedure.updateTreatmentProcedureTreatmentId";
		logger.debug("WebTreatmentProcedureSqlMapDAO updateTreatmentProcedureTreatmentId END");
		return getSqlSession().update(sqlId, paramMap);
	}
	
	/**
	 * 진료 시술 정보 삭제
	 * 
	 * @param Map
	 * @return
	 * @throws DataAccessException
	 */
	public int deleteTreatmentProcedure(HashMap<String, Object> paramMap)
			throws DataAccessException {
		logger.debug("WebTreatmentProcedureSqlMapDAO deleteTreatmentProcedure START");
		String sqlId = "WebTreatmentProcedure.deleteTreatmentProcedure";
		logger.debug("WebTreatmentProcedureSqlMapDAO deleteTreatmentProcedure END");
		return getSqlSession().update(sqlId, paramMap);
	}
}
