package com.madeu.dao.web.webphotodiet;

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

    @Autowired
    private SqlSessionTemplate sqlSessionTemplate;

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

    /**
     * 홈페이지 전후사진(다이어트) 정보 총 갯수 조회 (total count)
     *
     * @param Map
     * @return
     * @throws DataAccessException
     */
    public List<Map<String, Object>> selectTotalWebPhotoDietCount(HashMap<String, Object> paramMap)
            throws DataAccessException {
        logger.debug("WebPhotoDietSqlMapDAO selectTotalWebPhotoDietCount START");
        String sqlId = "WebPhotoDiet.selectTotalWebPhotoDietCount";
        logger.debug("WebPhotoDietSqlMapDAO selectTotalWebPhotoDietCount END");
        return getSqlSession().selectList(sqlId, paramMap);
    }

    /**
     * 홈페이지 전후사진(다이어트) 정보 리스트 조회 (List)
     *
     * @param Map
     * @return
     * @throws DataAccessException
     */
    public List<Map<String, Object>> selectListWebPhotoDiet(HashMap<String, Object> paramMap)
            throws DataAccessException {
        logger.debug("WebPhotoDietSqlMapDAO selectListWebPhotoDiet START");
        String sqlId = "WebPhotoDiet.selectListWebPhotoDiet";
        logger.debug("WebPhotoDietSqlMapDAO selectListWebPhotoDiet END");
        return getSqlSession().selectList(sqlId, paramMap);
    }

    /**
     * 홈페이지 전후사진(다이어트) 정보 조회
     *
     * @param Map
     * @return
     * @throws DataAccessException
     */
    public List<Map<String, Object>> selectWebPhotoDiet(HashMap<String, Object> paramMap)
            throws DataAccessException {
        logger.debug("WebPhotoDietSqlMapDAO selectWebPhotoDiet START");
        String sqlId = "WebPhotoDiet.selectWebPhotoDiet";
        logger.debug("WebPhotoDietSqlMapDAO selectWebPhotoDiet END");
        return getSqlSession().selectList(sqlId, paramMap);
    }

    /**
     * 홈페이지 전후사진(다이어트) 정보 등록
     *
     * @param Map
     * @return
     * @throws DataAccessException
     */
    public int insertWebPhotoDiet(HashMap<String, Object> paramMap)
            throws DataAccessException {
        logger.debug("WebPhotoDietSqlMapDAO insertWebPhotoDiet START");
        String sqlId = "WebPhotoDiet.insertWebPhotoDiet";
        logger.debug("WebPhotoDietSqlMapDAO insertWebPhotoDiet END");
        return getSqlSession().insert(sqlId, paramMap);
    }

    /**
     * 홈페이지 전후사진(다이어트) 정보 수정
     *
     * @param Map
     * @return
     * @throws DataAccessException
     */
    public int updateWebPhotoDiet(HashMap<String, Object> paramMap)
            throws DataAccessException {
        logger.debug("WebPhotoDietSqlMapDAO updateWebPhotoDiet START");
        String sqlId = "WebPhotoDiet.updateWebPhotoDiet";
        logger.debug("WebPhotoDietSqlMapDAO updateWebPhotoDiet END");
        return getSqlSession().update(sqlId, paramMap);
    }

    /**
     * 홈페이지 전후사진(다이어트) 정보 삭제
     *
     * @param Map
     * @return
     * @throws DataAccessException
     */
    public int deleteWebPhotoDiet(HashMap<String, Object> paramMap)
            throws DataAccessException {
        logger.debug("WebPhotoDietSqlMapDAO deleteWebPhotoDiet START");
        String sqlId = "WebPhotoDiet.deleteWebPhotoDiet";
        logger.debug("WebPhotoDietSqlMapDAO deleteWebPhotoDiet END");
        return getSqlSession().update(sqlId, paramMap);
    }
    
    /**
     * 카테고리 정보 리스트 조회 (List)
     *
     * @param Map
     * @return
     * @throws DataAccessException
     */
    public List<Map<String, Object>> selectListPhotoCategory(HashMap<String, Object> paramMap)
            throws DataAccessException {
        logger.debug("WebPhotoDietSqlMapDAO selectListPhotoCategory START");
        String sqlId = "WebPhotoDiet.selectListPhotoCategory";
        logger.debug("WebPhotoDietSqlMapDAO selectListPhotoCategory END");
        return getSqlSession().selectList(sqlId, paramMap);
    }
    
    /**
     * 홈페이지 전후사진(다이어트) 파일 정보 등록
     *
     * @param Map
     * @return
     * @throws DataAccessException
     */
    public int insertWebPhotoDietBeforeFile(HashMap<String, Object> paramMap)
            throws DataAccessException {
        logger.debug("WebPhotoDietSqlMapDAO insertWebPhotoDietBeforeFile START");
        String sqlId = "WebPhotoDiet.insertWebPhotoDietBeforeFile";
        logger.debug("WebPhotoDietSqlMapDAO insertWebPhotoDietBeforeFile END");
        return getSqlSession().insert(sqlId, paramMap);
    }
    
    /**
     * 홈페이지 전후사진(다이어트) 파일 정보 등록
     *
     * @param Map
     * @return
     * @throws DataAccessException
     */
    public int insertWebPhotoDietAfterFile(HashMap<String, Object> paramMap)
            throws DataAccessException {
        logger.debug("WebPhotoDietSqlMapDAO insertWebPhotoDietAfterFile START");
        String sqlId = "WebPhotoDiet.insertWebPhotoDietAfterFile";
        logger.debug("WebPhotoDietSqlMapDAO insertWebPhotoDietAfterFile END");
        return getSqlSession().insert(sqlId, paramMap);
    }

}
