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 ModuleDao {
	private static final String MAPPER = "moduleMapper.";
	private final SqlSession sqlSession;

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

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

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

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

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