package com.eactive.eai.rms.onl.manage.rule.layout;

import java.util.HashMap;
import java.util.List;

import org.apache.log4j.Logger;
import org.springframework.stereotype.Repository;

import com.eactive.eai.rms.common.base.SqlMapClientTemplateDao;
import com.eactive.eai.rms.onl.manage.rule.layoutsync.LayoutSyncVo;

@Repository("layoutDao")
@SuppressWarnings("unchecked")
public class LayoutDao extends SqlMapClientTemplateDao {

	private static final Logger logger = Logger.getLogger(LayoutDao.class);

	public int selectListCount(HashMap param) throws Exception {
		return (Integer) template.queryForObject("Layout.selectListCount", param);
	}

	public HashMap selectDetail(HashMap param) throws Exception {
		return (HashMap) template.queryForObject("Layout.selectDetail", param);
	}

	public void insert(HashMap paramMap) throws Exception {
		this.template.insert("Layout.insert", paramMap);
	}

	public void update(HashMap paramMap) throws Exception {
		this.template.update("Layout.update", paramMap);
	}

	public void delete(HashMap paramMap) throws Exception {
		this.template.delete("Layout.delete", paramMap);
	}

	public int insertItem(HashMap<String, Object> param) {
		return this.template.update("Layout.insertItem", param);
	}

	public int deleteItemAll(HashMap<String, Object> param) {
		return this.template.update("Layout.deleteItemAll", param);
	}

	public List<HashMap<String, Object>> selectListAll(HashMap<String, Object> param) {
		return this.template.queryForList("Layout.selectListAll", param);
	}

	public List<LayoutSyncVo> getLayoutXMLList(HashMap<String, String> param) {
		return template.queryForList("Layout.selectLayoutXMLList", param);
	}

	public List<LayoutSyncVo> getMigrationLayout(HashMap<String, String> param) {
		return template.queryForList("Layout.selectMigrationLayout", param);
	}

	public List<HashMap<String, String>> getLayoutMappingXMLList(HashMap<String, String> param) {
		return template.queryForList("Layout.selectLayoutMappingXMLList", param);
	}

	public void addLayoutMappingSyncLog(HashMap<String, String> param) {
		template.insert("Layout.insertMappingSyncLog", param);
	}

	public void recvLayoutMappingSyncLog(HashMap<String, String> param) {
		template.insert("Layout.updateMappingSyncLog", param);
	}

	// Layout Popup
	public int selectListCountPop(HashMap param) throws Exception {
		return (Integer) template.queryForObject("Layout.selectListCountPop", param);
	}

	// Layout Popup
	public List selectListPop(HashMap param) throws Exception {
		return template.queryForList("Layout.selectListPop", param);
	}

	public List<HashMap> selectLayout(HashMap params) {
		return template.queryForList("Layout.selectLayout", params);
	}
}
