package com.samsung.embo.kpi.dao;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.session.SqlSession;
import org.springframework.stereotype.Repository;

@Repository
public class ParameterDao {
	private static final String MAPPER = "parameterMapper.";
	private final SqlSession sqlSession;

	public ParameterDao(SqlSession sqlSession) {
		this.sqlSession = sqlSession;
	}

	public List<Map<String, Object>> selectParameter(Map<String, Object> params) {
		return sqlSession.selectList(MAPPER + "selectParameter", params);
	}

	public String insertParameter(Map<String, Object> params) {
		sqlSession.insert(MAPPER + "insertParameter", params);
		return params.get("parameterType").toString();
	}

	public void updateParameter(Map<String, Object> params) {
		sqlSession.update(MAPPER + "updateParameter", params);
	}

	public int deleteParameter(Map<String, Object> params) {
		return sqlSession.delete(MAPPER + "deleteParameter", params);
	}
}
