TbTmpInterfaceDao.java 1.34 KB
package com.sitech.database.dao;

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

import com.sitech.database.domain.TbTmpInterface;


public class TbTmpInterfaceDao extends BaseDao {
	public void addTbTmpInterface(TbTmpInterface newIf){		
		try {
			sqlmapClient.insert("addTbTmpInterface", newIf);
		} catch (Exception e) {
			error.error("Exception while addTbTmpInterface.", e);
		}
	}
	
	public void deleteTbTmpInterface(TbTmpInterface newIf){		
		try {
			sqlmapClient.delete("deleteTbTmpInterface", newIf);
		} catch (Exception e) {
			error.error("Exception while deleteTbTmpInterface.", e);
		}
	}
	
	public TbTmpInterface queryTbTmpInterface(String ipAddr, String ifIndex){
		try {
			HashMap<String, String> param = new HashMap<String, String>();
			param.put("IP_ADDR", ipAddr);
			param.put("IF_INDEX", ifIndex);
			List<TbTmpInterface> list = sqlmapClient.queryForList("queryTbTmpInterface", param);
			if (list != null && list.size() > 0) {
				return list.get(0);
			}
		} catch (Exception e) {
			error.error("Exception while queryTbTmpInterface.", e);
		}
		return null;
	}


    public void clean() {
        try {
            int status = sqlmapClient.delete("deleteTbTmpInterfaceAll", null);
            System.out.println(status);
        } catch (Exception e) {
            error.error("Exception while deleteTbTmpInterfaceAll.", e);
        }
    }
}