package com.madeu.dao.mobile.mobilemedical;

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

	@Autowired
	private SqlSessionTemplate sqlSessionTemplate;

	@PostConstruct
	void init() {
		setSqlSessionTemplate(sqlSessionTemplate);
	}

	/**
	 * 시술보드 정보 총 갯수 조회 (total count)
	 *
	 * @param Map
	 * @return
	 * @throws DataAccessException
	 */
	public List<Map<String, Object>> selectListMedicalBoardCount(HashMap<String, Object> paramMap)
			throws DataAccessException {
		logger.debug("MobileMedicalSqlMapDAO selectListMedicalBoardCount START");
		String sqlId = "MobileMedical.selectListMedicalBoardCount";
		logger.debug("MobileMedicalSqlMapDAO selectListMedicalBoardCount END");
		return getSqlSession().selectList(sqlId, paramMap);
	}


	/**
	 * 시술보드 조회 (List)
	 *
	 * @param Map
	 * @return
	 * @throws DataAccessException
	 */
	public List<Map<String, Object>> selectListMedicalBoard(HashMap<String, Object> paramMap)
			throws DataAccessException {
		logger.debug("MobileMedicalSqlMapDAO selectListMedicalBoard START");
		String sqlId = "MobileMedical.selectListMedicalBoard";
		logger.debug("MobileMedicalSqlMapDAO selectListMedicalBoard END");
		return getSqlSession().selectList(sqlId, paramMap);
	}

	/**
	 * 시술 정보 리스트 조회 (List)
	 *
	 * @param Map
	 * @return
	 * @throws DataAccessException
	 */
	public List<Map<String, Object>> selectListMedical(HashMap<String, Object> paramMap)
			throws DataAccessException {
		logger.debug("MobileMedicalSqlMapDAO selectListMedical START");
		String sqlId = "MobileMedical.selectListMedical";
		logger.debug("MobileMedicalSqlMapDAO selectListMedical END");
		return getSqlSession().selectList(sqlId, paramMap);
	}

	/**
	 * 시술 조회
	 *
	 * @param Map
	 * @return
	 * @throws DataAccessException
	 */
	public List<Map<String, Object>> selectMedical(HashMap<String, Object> paramMap)
			throws DataAccessException {
		logger.debug("MobileMedicalSqlMapDAO selectMedical START");
		String sqlId = "MobileMedical.selectMedical";
		logger.debug("MobileMedicalSqlMapDAO selectMedical END");
		return getSqlSession().selectList(sqlId, paramMap);
	}

}
