package com.madeu.dao.web.webcategory;

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

    @Autowired
    private SqlSessionTemplate sqlSessionTemplate;

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

    /**
     * 병원 기타설정 데이터 조회(list)
     *
     * @param Map
     * @return
     * @throws DataAccessException
     */
    public List<Map<String, Object>> selectCategoryItemList(HashMap<String, Object> paramMap)
            throws DataAccessException {
        logger.debug("WebCategorySqlMapDAO selectCategoryItemList START");
        String sqlId = "WebCategory.selectCategoryItemList";
        logger.debug("WebCategorySqlMapDAO selectCategoryItemList END");
        return getSqlSession().selectList(sqlId, paramMap);
    }
    /**
     * 병원 기타설정 데이터 조회(select box)
     *
     * @param Map
     * @return
     * @throws DataAccessException
     */
    public List<Map<String, Object>> selectCategoryItem(HashMap<String, Object> paramMap)
            throws DataAccessException {
        logger.debug("WebCategorySqlMapDAO selectCategoryItem START");
        String sqlId = "WebCategory.selectCategoryItem";
        logger.debug("WebCategorySqlMapDAO selectCategoryItem END");
        return getSqlSession().selectList(sqlId, paramMap);
    }
    /**
     * 병원 기타설정 카테고리 종류 조회
     *
     * @param Map
     * @return
     * @throws DataAccessException
     */
    public List<Map<String, Object>> selectCategoryList(HashMap<String, Object> paramMap)
            throws DataAccessException {
        logger.debug("WebCategorySqlMapDAO selectCategoryList START");
        String sqlId = "WebCategory.selectCategoryList";
        logger.debug("WebCategorySqlMapDAO selectCategoryList END");
        return getSqlSession().selectList(sqlId, paramMap);
    }
    
    /**
     * 카테고리 상세 조회
     *
     * @param Map
     * @return
     * @throws DataAccessException
     */
    public List<Map<String, Object>> selectCategoryItemId(HashMap<String, Object> paramMap)
            throws DataAccessException {
        logger.debug("WebCategorySqlMapDAO selectCategoryItemId START");
        String sqlId = "WebCategory.selectCategoryItemId";
        logger.debug("WebCategorySqlMapDAO selectCategoryItemId END");
        return getSqlSession().selectList(sqlId, paramMap);
    }
    
    /**
     *  병원 기타정보 삭제
     *
     * @param Map
     * @return
     * @throws DataAccessException
     */
    public int deleteHospitalOther(Map<String, Object> paramMap)
            throws DataAccessException {
        logger.debug("WebCategorySqlMapDAO deleteHospitalOther START");
        String sqlId = "WebCategory.deleteHospitalOther";
        logger.debug("WebCategorySqlMapDAO deleteHospitalOther END");
        return getSqlSession().update(sqlId, paramMap);
    }
    /**
     * 병원 기타정보 등록
     *
     * @param Map
     * @return
     * @throws DataAccessException
     */
    public int insertHospitalOther(HashMap<String, Object> paramMap)
            throws DataAccessException {
        logger.debug("WebCategorySqlMapDAO insertHospitalOther START");
        String sqlId = "WebCategory.insertHospitalOther";
        logger.debug("WebCategorySqlMapDAO insertHospitalOther END");
        return getSqlSession().insert(sqlId, paramMap);
    }
    /**
     * 병원 기타정보 수정
     *
     * @param Map
     * @return
     * @throws DataAccessException
     */
    public int updateHospitalOther(HashMap<String, Object> paramMap)
            throws DataAccessException {
        logger.debug("WebCategorySqlMapDAO updateHospitalOther START");
        String sqlId = "WebCategory.updateHospitalOther";
        logger.debug("WebCategorySqlMapDAO updateHospitalOther END");
        return getSqlSession().update(sqlId, paramMap);
    }
    /**
     * 병원 기타정보 정렬순번 수정
     *
     * @param Map
     * @return
     * @throws DataAccessException
     */
    public int updateCategoryItemOrderNumber(HashMap<String, Object> paramMap)
            throws DataAccessException {
        logger.debug("WebCategorySqlMapDAO updateCategoryItemOrderNumber START");
        String sqlId = "WebCategory.updateCategoryItemOrderNumber";
        logger.debug("WebCategorySqlMapDAO updateCategoryItemOrderNumber END");
        return getSqlSession().update(sqlId, paramMap);
    }
}
