package com.madeu.dao.web.webphotopetit;

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

    @Autowired
    private SqlSessionTemplate sqlSessionTemplate;

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

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

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

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

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

    /**
     * 홈페이지 전후사진(쁘띠) 정보 수정
     *
     * @param Map
     * @return
     * @throws DataAccessException
     */
    public int updateWebPhotoPetit(HashMap<String, Object> paramMap)
            throws DataAccessException {
        logger.debug("WebPhotoPetitSqlMapDAO updateWebPhotoPetit START");
        String sqlId = "WebPhotoPetit.updateWebPhotoPetit";
        logger.debug("WebPhotoPetitSqlMapDAO updateWebPhotoPetit END");
        return getSqlSession().update(sqlId, paramMap);
    }

    /**
     * 홈페이지 전후사진(쁘띠) 정보 삭제
     *
     * @param Map
     * @return
     * @throws DataAccessException
     */
    public int deleteWebPhotoPetit(HashMap<String, Object> paramMap)
            throws DataAccessException {
        logger.debug("WebPhotoPetitSqlMapDAO deleteWebPhotoPetit START");
        String sqlId = "WebPhotoPetit.deleteWebPhotoPetit";
        logger.debug("WebPhotoPetitSqlMapDAO deleteWebPhotoPetit 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("WebPhotoPetitSqlMapDAO selectListPhotoCategory START");
        String sqlId = "WebPhotoPetit.selectListPhotoCategory";
        logger.debug("WebPhotoPetitSqlMapDAO selectListPhotoCategory END");
        return getSqlSession().selectList(sqlId, paramMap);
    }
    
    /**
     * 홈페이지 전후사진(쁘띠) 파일 정보 등록
     *
     * @param Map
     * @return
     * @throws DataAccessException
     */
    public int insertWebPhotoPetitBeforeFile(HashMap<String, Object> paramMap)
            throws DataAccessException {
        logger.debug("WebPhotoPetitSqlMapDAO insertWebPhotoPetitBeforeFile START");
        String sqlId = "WebPhotoPetit.insertWebPhotoPetitBeforeFile";
        logger.debug("WebPhotoPetitSqlMapDAO insertWebPhotoPetitBeforeFile END");
        return getSqlSession().insert(sqlId, paramMap);
    }
    
    /**
     * 홈페이지 전후사진(쁘띠) 파일 정보 등록
     *
     * @param Map
     * @return
     * @throws DataAccessException
     */
    public int insertWebPhotoPetitAfterFile(HashMap<String, Object> paramMap)
            throws DataAccessException {
        logger.debug("WebPhotoPetitSqlMapDAO insertWebPhotoPetitAfterFile START");
        String sqlId = "WebPhotoPetit.insertWebPhotoPetitAfterFile";
        logger.debug("WebPhotoPetitSqlMapDAO insertWebPhotoPetitAfterFile END");
        return getSqlSession().insert(sqlId, paramMap);
    }

}
