package com.madeu.dao.mobile.mobileuserphysical;

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

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

    /**
     * 고객 신체정보 리스트 조회 (List)
     *
     * @param Map
     * @return
     * @throws DataAccessException
     */
    public List<Map<String, Object>> selectUserPhysicalList(HashMap<String, Object> paramMap)
            throws DataAccessException {
        logger.debug("MobileUserPhysicalSqlMapDAO selectUserPhysicalList START");
        String sqlId = "MobileUserPhysical.selectUserPhysicalList";
        logger.debug("MobileUserPhysicalSqlMapDAO selectUserPhysicalList END");
        return getSqlSession().selectList(sqlId, paramMap);
    }
    /**
     * 고객 신체정보 리스트 조회 (List)
     *
     * @param Map
     * @return
     * @throws DataAccessException
     */
    public List<Map<String, Object>> selectRecentUserPhysicalList(HashMap<String, Object> paramMap)
            throws DataAccessException {
        logger.debug("MobileUserPhysicalSqlMapDAO selectRecentUserPhysicalList START");
        String sqlId = "MobileUserPhysical.selectRecentUserPhysicalList";
        logger.debug("MobileUserPhysicalSqlMapDAO selectRecentUserPhysicalList END");
        return getSqlSession().selectList(sqlId, paramMap);
    }

    /**
     * 신체 정보 총 갯수 조회 (total count)
     *
     * @param Map
     * @return
     * @throws DataAccessException
     */
    public Integer selectTotalPhysicalCount(HashMap<String, Object> paramMap)
            throws DataAccessException {
        logger.debug("MobileUserPhysicalSqlMapDAO selectTotalPhysicalCount START");
        String sqlId = "MobileUserPhysical.selectTotalPhysicalCount";
        logger.debug("MobileUserPhysicalSqlMapDAO selectTotalPhysicalCount END");
        return getSqlSession().selectOne(sqlId, paramMap);
    }

}
