DowntimeHistoryDao.java
1.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
package com.sitech.ismp.check.downtime;
import com.sitech.database.dao.BaseDao;
import org.apache.log4j.Logger;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
/**
* @author frank zmm@honggroup.com.cn
* @Description: 告警历史dao
* @Package com.sitech.ismp.check.downtime
* @ClassName: com.sitech.ismp.check.downtime.DowntimeHistoryDao
* @date 2017年04月19日 14:06
*/
public class DowntimeHistoryDao extends BaseDao {
private static Logger log=Logger.getLogger(DowntimeHistoryDao.class);
/**
* 添加告警信息
* @param bean
*/
public void addDowntimeHistory(DowntimeHistoryBean bean){
try {
sqlmapClient.insert("addDowntimeHistory", bean);
} catch (SQLException e) {
log.error("Exception while addDowntimeHistory.",e);
}
}
/**
*
* @param deviceIp
* @param createDate
* @return
*/
public List<DowntimeHistoryBean> getDowntimeHistoryByIp(String deviceIp,String createDate){
HashMap<String,String> param=new HashMap<String, String>();
param.put("DEVICE_IP",deviceIp);
param.put("CREATE_DATE",createDate);
List<DowntimeHistoryBean> beanList=new ArrayList<DowntimeHistoryBean>();
try {
beanList=sqlmapClient.queryForList("getDowntimeHistoryByIp", param);
} catch (SQLException e) {
e.printStackTrace();
}
return beanList;
}
/**
* 删除表中的所有数据。
* @return
*/
public int deleteDowntimeHistory(){
try {
return sqlmapClient.delete("deleteDowntimeHistory", null);
} catch (Exception e) {
error.error("Exception while deleteDowntimeHistory.", e);
}
return -1;
}
}