package com.madeu.dao.web.webmembership;

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 WebMembershipSqlMapDAO extends SqlSessionDaoSupport {
    @Autowired
    private SqlSessionTemplate sqlSessionTemplate;

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

    /**
     * 중복 멤버십상품 조회 (total count)
     *
     * @param Map
     * @return
     * @throws DataAccessException
     */
    public Integer selectMembershipProcedureCount(HashMap<String, Object> paramMap)
            throws DataAccessException {
        logger.debug("WebMembershipSqlMapDAO selectMembershipProcedureCount START");
        String sqlId = "WebMembership.selectMembershipProcedureCount";
        logger.debug("WebMembershipSqlMapDAO selectMembershipProcedureCount END");
        return getSqlSession().selectOne(sqlId, paramMap);
    }
    /**
     * 멤버십고객 정보 총 갯수 조회 (total count)
     *
     * @param Map
     * @return
     * @throws DataAccessException
     */
    public List<Map<String, Object>> selectTotalMembershipCount(HashMap<String, Object> paramMap)
            throws DataAccessException {
        logger.debug("WebMembershipSqlMapDAO selectTotalMembershipCount START");
        String sqlId = "WebMembership.selectTotalMembershipCount";
        logger.debug("WebMembershipSqlMapDAO selectTotalMembershipCount END");
        return getSqlSession().selectList(sqlId, paramMap);
    }
    /**
     * 멤버십상품 정보 총 갯수 조회 (total count)
     *
     * @param Map
     * @return
     * @throws DataAccessException
     */
    public List<Map<String, Object>> selectTotalMembershipProcedureCount()
            throws DataAccessException {
        logger.debug("WebMembershipSqlMapDAO selectTotalMembershipProcedureCount START");
        String sqlId = "WebMembership.selectTotalMembershipProcedureCount";
        logger.debug("WebMembershipSqlMapDAO selectTotalMembershipProcedureCount END");
        return getSqlSession().selectList(sqlId);
    }
    /**
     * 멤버십상품 정보 리스트 조회 (List)
     *
     * @param Map
     * @return
     * @throws DataAccessException
     */
    public List<Map<String, Object>> selectListMembershipProcedure(HashMap<String, Object> paramMap)
            throws DataAccessException {
        logger.debug("WebMembershipSqlMapDAO selectListMembershipProcedure START");
        String sqlId = "WebMembership.selectListMembershipProcedure";
        logger.debug("WebMembershipSqlMapDAO selectListMembershipProcedure END");
        return getSqlSession().selectList(sqlId, paramMap);
    }
    /**
     * 멤버십고객 정보 총 갯수 조회 (total count)
     *
     * @param Map
     * @return
     * @throws DataAccessException
     */
    public List<Map<String, Object>> selectTotalMembershipCount()
            throws DataAccessException {
        logger.debug("WebMembershipSqlMapDAO selectTotalMembershipCount START");
        String sqlId = "WebMembership.selectTotalMembershipCount";
        logger.debug("WebMembershipSqlMapDAO selectTotalMembershipCount END");
        return getSqlSession().selectList(sqlId);
    }
    /**
     * 멤버십고객 정보 리스트 조회 (List)
     *
     * @param Map
     * @return
     * @throws DataAccessException
     */
    public List<Map<String, Object>> selectListMembership(HashMap<String, Object> paramMap)
            throws DataAccessException {
        logger.debug("WebMembershipSqlMapDAO selectListMembership START");
        String sqlId = "WebMembership.selectListMembership";
        logger.debug("WebMembershipSqlMapDAO selectListMembership END");
        return getSqlSession().selectList(sqlId, paramMap);
    }

    /**
     * 멤버십고객 정보 리스트 조회 (List, Excel)
     *
     * @param Map
     * @return
     * @throws DataAccessException
     */
    public List<Map<String, Object>> downloadMembershipExcel(HashMap<String, Object> paramMap)
            throws DataAccessException {
        logger.debug("WebMembershipSqlMapDAO downloadMembershipExcel START");
        String sqlId = "WebMembership.downloadMembershipExcel";
        logger.debug("WebMembershipSqlMapDAO downloadMembershipExcel END");
        return getSqlSession().selectList(sqlId, paramMap);
    }
    /**
     * 멤버십 누적금액 정보 조회 (List)
     *
     * @param Map
     * @return
     * @throws DataAccessException
     */
    public List<Map<String, Object>> selectSumMembershipBalance(HashMap<String, Object> paramMap)
            throws DataAccessException {
        logger.debug("WebMembershipSqlMapDAO selectSumMembershipBalance START");
        String sqlId = "WebMembership.selectSumMembershipBalance";
        logger.debug("WebMembershipSqlMapDAO selectSumMembershipBalance END");
        return getSqlSession().selectList(sqlId, paramMap);
    }
    /**
     * 멤버십고객 상세정보 총 갯수 조회 (total count)
     *
     * @param Map
     * @return
     * @throws DataAccessException
     */
    public List<Map<String, Object>> selectTotalMembershipHistoryCount(HashMap<String, Object> paramMap)
            throws DataAccessException {
        logger.debug("WebMembershipSqlMapDAO selectTotalMembershipHistoryCount START");
        String sqlId = "WebMembership.selectTotalMembershipHistoryCount";
        logger.debug("WebMembershipSqlMapDAO selectTotalMembershipHistoryCount END");
        return getSqlSession().selectList(sqlId, paramMap);
    }
    /**
     * 멤버십 상세페이지 상단 누적금액 정보 조회
     *
     * @param Map
     * @return
     * @throws DataAccessException
     */
    public List<Map<String, Object>> selectTotalMembershipHistoryInfo(HashMap<String, Object> paramMap)
            throws DataAccessException {
        logger.debug("WebMembershipSqlMapDAO selectTotalMembershipHistoryInfo START");
        String sqlId = "WebMembership.selectTotalMembershipHistoryInfo";
        logger.debug("WebMembershipSqlMapDAO selectTotalMembershipHistoryInfo END");
        return getSqlSession().selectList(sqlId, paramMap);
    }

    /**
     * 멤버십고객 정보 리스트 조회 (List)
     *
     * @param Map
     * @return
     * @throws DataAccessException
     */
    public List<Map<String, Object>> selectListMembershipHistory(HashMap<String, Object> paramMap)
            throws DataAccessException {
        logger.debug("WebMembershipSqlMapDAO selectListMembershipHistory START");
        String sqlId = "WebMembership.selectListMembershipHistory";
        logger.debug("WebMembershipSqlMapDAO selectListMembershipHistory END");
        return getSqlSession().selectList(sqlId, paramMap);
    }

    /**
     * 멤버십고객 정보 리스트 조회 (List, Excel)
     *
     * @param Map
     * @return
     * @throws DataAccessException
     */
    public List<Map<String, Object>> downloadMembershipHistoryExcel(HashMap<String, Object> paramMap)
            throws DataAccessException {
        logger.debug("WebMembershipSqlMapDAO downloadMembershipHistoryExcel START");
        String sqlId = "WebMembership.downloadMembershipHistoryExcel";
        logger.debug("WebMembershipSqlMapDAO downloadMembershipHistoryExcel END");
        return getSqlSession().selectList(sqlId, paramMap);
    }

    /**
     * 양수인 정보 조회 (List)
     *
     * @param Map
     * @return
     * @throws DataAccessException
     */
    public List<Map<String, Object>> selectToTransferUser(HashMap<String, Object> paramMap)
            throws DataAccessException {
        logger.debug("WebMembershipSqlMapDAO selectToTransferUser START");
        String sqlId = "WebMembership.selectToTransferUser";
        logger.debug("WebMembershipSqlMapDAO selectToTransferUser END");
        return getSqlSession().selectList(sqlId, paramMap);
    }

    /**
     * 멤버십 정보 체크 (배치)
     *
     * @param Map
     * @return
     * @throws DataAccessException
     */
    public List<Map<String, Object>> selectMembershipCheckBatch(HashMap<String, Object> paramMap)
            throws DataAccessException {
        logger.debug("WebMembershipSqlMapDAO selectMembershipCheckBatch START");
        String sqlId = "WebMembership.selectMembershipCheckBatch";
        logger.debug("WebMembershipSqlMapDAO selectMembershipCheckBatch END");
        return getSqlSession().selectList(sqlId, paramMap);
    }

    /**
     * 멤버십 이력 정보 체크 (배치)
     *
     * @param Map
     * @return
     * @throws DataAccessException
     */
    public List<Map<String, Object>> selectMembershipHistoryCheckBatch(HashMap<String, Object> paramMap)
            throws DataAccessException {
        logger.debug("WebMembershipSqlMapDAO selectMembershipHistoryCheckBatch START");
        String sqlId = "WebMembership.selectMembershipHistoryCheckBatch";
        logger.debug("WebMembershipSqlMapDAO selectMembershipHistoryCheckBatch END");
        return getSqlSession().selectList(sqlId, paramMap);
    }

    /**
     * 양수/양도 내역 상세 정보 조회
     *
     * @param Map
     * @return
     * @throws DataAccessException
     */
    public List<Map<String, Object>> selectMembershipTransfer(HashMap<String, Object> paramMap)
            throws DataAccessException {
        logger.debug("WebMembershipSqlMapDAO selectMembershipTransfer START");
        String sqlId = "WebMembership.selectMembershipTransfer";
        logger.debug("WebMembershipSqlMapDAO selectMembershipTransfer END");
        return getSqlSession().selectList(sqlId, paramMap);
    }

    /**
     * 멤버십 정보 등록
     *
     * @param Map
     * @return
     * @throws DataAccessException
     */
    public int insertMembership(HashMap<String, Object> paramMap)
            throws DataAccessException {
        logger.debug("WebMembershipSqlMapDAO insertMembership START");
        String sqlId = "WebMembership.insertMembership";
        logger.debug("WebMembershipSqlMapDAO insertMembership END");
        return getSqlSession().insert(sqlId, paramMap);
    }

    /**
     * 멤버십 정보 등록 (배치)
     *
     * @param Map
     * @return
     * @throws DataAccessException
     */
    public int insertMembershipBatch(HashMap<String, Object> paramMap)
            throws DataAccessException {
        logger.debug("WebMembershipSqlMapDAO insertMembershipBatch START");
        String sqlId = "WebMembership.insertMembershipBatch";
        logger.debug("WebMembershipSqlMapDAO insertMembershipBatch END");
        return getSqlSession().insert(sqlId, paramMap);
    }
    /**
     * 멤버십 상품정보 등록
     *
     * @param Map
     * @return
     * @throws DataAccessException
     */
    public int insertTreatmentProcedurePrice(HashMap<String, Object> paramMap)
            throws DataAccessException {
        logger.debug("WebMembershipSqlMapDAO insertTreatmentProcedurePrice START");
        String sqlId = "WebMembership.insertTreatmentProcedurePrice";
        logger.debug("WebMembershipSqlMapDAO insertTreatmentProcedurePrice END");
        return getSqlSession().insert(sqlId, paramMap);
    }
    /**
     * 멤버십 상품정보 등록
     *
     * @param Map
     * @return
     * @throws DataAccessException
     */
    public int insertMembershipProcedure(HashMap<String, Object> paramMap)
            throws DataAccessException {
        logger.debug("WebMembershipSqlMapDAO insertMembershipProcedure START");
        String sqlId = "WebMembership.insertMembershipProcedure";
        logger.debug("WebMembershipSqlMapDAO insertMembershipProcedure END");
        return getSqlSession().insert(sqlId, paramMap);
    }

    /**
     * 멤버십 정보 수정
     *
     * @param Map
     * @return
     * @throws DataAccessException
     */
    public int updateMembership(HashMap<String, Object> paramMap)
            throws DataAccessException {
        logger.debug("WebMembershipSqlMapDAO updateMembership START");
        String sqlId = "WebMembership.updateMembership";
        logger.debug("WebMembershipSqlMapDAO updateMembership END");
        return getSqlSession().update(sqlId, paramMap);
    }

    /**
     * 멤버십 정보 수정 (배치)
     *
     * @param Map
     * @return
     * @throws DataAccessException
     */
    public int updateMembershipBatch(HashMap<String, Object> paramMap)
            throws DataAccessException {
        logger.debug("WebMembershipSqlMapDAO updateMembershipBatch START");
        String sqlId = "WebMembership.updateMembershipBatch";
        logger.debug("WebMembershipSqlMapDAO updateMembershipBatch END");
        return getSqlSession().update(sqlId, paramMap);
    }

    /**
     * 멤버십 내역 정보 등록
     *
     * @param Map
     * @return
     * @throws DataAccessException
     */
    public int insertMembershipHistory(HashMap<String, Object> paramMap)
            throws DataAccessException {
        logger.debug("WebMembershipSqlMapDAO insertMembershipHistory START");
        String sqlId = "WebMembership.insertMembershipHistory";
        logger.debug("WebMembershipSqlMapDAO insertMembershipHistory END");
        return getSqlSession().insert(sqlId, paramMap);
    }

    /**
     * 멤버십 내역 정보 등록 (배치)
     *
     * @param Map
     * @return
     * @throws DataAccessException
     */
    public int insertMembershipHistoryBatch(HashMap<String, Object> paramMap)
            throws DataAccessException {
        logger.debug("WebMembershipSqlMapDAO insertMembershipHistoryBatch START");
        String sqlId = "WebMembership.insertMembershipHistoryBatch";
        logger.debug("WebMembershipSqlMapDAO insertMembershipHistoryBatch END");
        return getSqlSession().insert(sqlId, paramMap);
    }

    /**
     * 멤버십사용내역 정보 총 갯수 조회 (total count)
     *
     * @param Map
     * @return
     * @throws DataAccessException
     */
    public List<Map<String, Object>> selectTotalUseMembershipCount(HashMap<String, Object> paramMap)
            throws DataAccessException {
        logger.debug("WebMembershipSqlMapDAO selectTotalUseMembershipCount START");
        String sqlId = "WebMembership.selectTotalUseMembershipCount";
        logger.debug("WebMembershipSqlMapDAO selectTotalUseMembershipCount END");
        return getSqlSession().selectList(sqlId, paramMap);
    }

    /**
     * 멤버십사용내역 정보 리스트 조회 (List)
     *
     * @param Map
     * @return
     * @throws DataAccessException
     */
    public List<Map<String, Object>> selectUseMembershipList(HashMap<String, Object> paramMap)
            throws DataAccessException {
        logger.debug("WebMembershipSqlMapDAO selectUseMembershipList START");
        String sqlId = "WebMembership.selectUseMembershipList";
        logger.debug("WebMembershipSqlMapDAO selectUseMembershipList END");
        return getSqlSession().selectList(sqlId, paramMap);
    }
    /**
     * 멤버십사용내역정보 리스트 조회 (List, Excel)
     *
     * @param Map
     * @return
     * @throws DataAccessException
     */
    public List<Map<String, Object>> selectUseMembershipExcel(HashMap<String, Object> paramMap)
            throws DataAccessException {
        logger.debug("WebMembershipSqlMapDAO selectUseMembershipExcel START");
        String sqlId = "WebMembership.selectUseMembershipExcel";
        logger.debug("WebMembershipSqlMapDAO selectUseMembershipExcel END");
        return getSqlSession().selectList(sqlId, paramMap);
    }
    /**
     * 멤버십상품 정보 삭제
     *
     * @param Map
     * @return
     * @throws DataAccessException
     */
    public int deleteMembershipProcedure(HashMap<String, Object> paramMap)
            throws DataAccessException {
        logger.debug("WebMembershipSqlMapDAO deleteMembershipProcedure START");
        String sqlId = "WebMembership.deleteMembershipProcedure";
        logger.debug("WebMembershipSqlMapDAO deleteMembershipProcedure END");
        return getSqlSession().update(sqlId, paramMap);
    }
}
