package com.eactive.eai.rms.onl.common.dao;

import java.util.HashMap;

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

import com.eactive.eai.rms.common.base.SqlMapClientTemplateDao;
import com.eactive.eai.rms.common.datasource.DataSourceType;

@Repository("logTableDao")
public class LogTableDao  extends SqlMapClientTemplateDao {

    final Logger logger = Logger.getLogger(LogTableDao.class);
    
    public void clearLogTable(DataSourceType dt, String targetTable, String targetDay) {

    	final HashMap<String, String> paramMap = new HashMap<String, String>();
    	paramMap.put("schemaId", dt.getSchema());
    	paramMap.put("tableName", targetTable);
    	paramMap.put("targetDay", targetDay);

    	this.template.update("LogTable.clearLogTable", paramMap);
    }

	public void truncLogTable(DataSourceType dt, String targetTable) {

    	final HashMap<String, String> paramMap = new HashMap<String, String>();
    	paramMap.put("schemaId", dt.getSchema());
    	paramMap.put("tableName", targetTable);
    	this.template.update("LogTable.truncLogTable", paramMap);
	}
	
	public void clearInboundErrorLogTable(DataSourceType dt, String targetDay) {

    	final HashMap<String, String> paramMap = new HashMap<String, String>();
    	paramMap.put("schemaId", dt.getSchema());    	
    	paramMap.put("targetDay", targetDay);

    	this.template.update("LogTable.clearInboundErrorLogTable", paramMap);
    }
}
