DecideSaveTableManager.java 1.74 KB
package com.sitech.ismp.ice.syslogd;

import java.util.HashMap;
import java.util.Map;

import com.sitech.ismp.pattern.TableProcess;
import com.sitech.util.Formater;

/** 
 * 
 * 
 * @author zhangdj Email:Mirror_Jean@qq.com 
 * @version , Nov 16, 2010 
 * 
 */

public class DecideSaveTableManager  extends TableProcess {

	
	HashMap resultMap = null;
	public void setTable() throws Exception {
		resultMap = new HashMap();
		resultMap.put("UNIT_ID", Formater.fromDBString(rs.getString(1)));
		resultMap.put("PROCESS_ID", Formater.fromDBString(rs.getString(2)));
		resultMap.put("UPDATE_TIME", Formater.fromDBString(rs.getString(3)));
		recordSet.add(resultMap);
	}
	
	public java.util.Vector search(Map params) throws Exception{
		super.setConnection();
		SQL = "select UNIT_ID,PROCESS_ID,UPDATE_TIME from TB_DECIDE_MANAGER where UNIT_ID='"+params.get("UNIT_ID")+"'";
		System.out.println("find SQL = "+SQL);
		exeQuery(SQL);
		super.freeConnection();
		System.out.println("FIND OVER!");
		return recordSet;
	}
	
	public void delete(String UNIT_ID) throws Exception{
		super.setConnection();
		SQL = "delete TB_DECIDE_MANAGER where UNIT_ID='"+UNIT_ID+"'";
		exeUpdateSQL(SQL);
		super.freeConnection();
	}
	
	public void modify(Map params) throws Exception{
		super.setConnection();
		SQL = "update TB_DECIDE_MANAGER set PROCESS_ID='"+params.get("PROCESS_ID")+"',UPDATE_TIME=sysdate where UNIT_ID='"+params.get("UNIT_ID")+"'";
		exeUpdateSQL(SQL);
	}
	
	public boolean add(Map params) throws Exception{
		super.setConnection();
		SQL = "insert into TB_DECIDE_MANAGER(UNIT_ID,PROCESS_ID,UPDATE_TIME) values('"+params.get("UNIT_ID")+"','"+params.get("PROCESS_ID")+"',sysdate)";
		System.out.println("insert SQL = "+SQL);
		exeInsertSQL(SQL);
		super.freeConnection();
		return true;
	}
}