package com.madeu.dao.web.webmenu;

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 jakarta.annotation.PostConstruct;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Repository
public class WebMenuSqlMapDAO extends SqlSessionDaoSupport{

	@Autowired
	private SqlSessionTemplate sqlSessionTemplate;

	@PostConstruct
	void init() {
		setSqlSessionTemplate(sqlSessionTemplate);
	}
	
	/**
	 * 메뉴 조회 (List)
	 * 
	 * @param Map
	 * @return
	 * @throws DataAccessException 
	 */
	public List<Map<String, Object>> selectListMenu(HashMap<String, Object> paramMap)
			throws DataAccessException {
		logger.debug("WebMenuSqlMapDAO selectListMenu START");
		String sqlId = "WebMenu.selectListMenu";
		logger.debug("WebMenuSqlMapDAO selectListMenu END");
		return getSqlSession().selectList(sqlId, paramMap);
	}
	/**
	 * 메뉴코드 조회 (one)
	 *
	 * @param Map
	 * @return
	 * @throws DataAccessException
	 */
	public String selectMenuCode(HashMap<String, Object> paramMap)
			throws DataAccessException {
		logger.debug("WebMenuSqlMapDAO selectMenuCode START");
		String sqlId = "WebMenu.selectMenuCode";
		logger.debug("WebMenuSqlMapDAO selectMenuCode END");
		return getSqlSession().selectOne(sqlId, paramMap);
	}
	
}
