TbCfgEventDao.java
2.02 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
package com.sitech.database.dao;
import java.util.HashMap;
import java.util.List;
import com.sitech.database.domain.TbCfgEvent;
import com.sitech.ismp.app.event.ExpressionHelper;
public class TbCfgEventDao extends BaseDao{
@SuppressWarnings("unchecked")
public List<TbCfgEvent> queryEventCfgByUnitId(String unitId) {
String condition = ExpressionHelper.genCondition(unitId);
String sql = "select * from TB_CFG_EVENT where ENABLE=1 and (" + condition + ")";
try {
return sqlmapClient.queryForList("queryEventCfgByUnitId", sql);
} catch (Exception e) {
error.error("Exception while queryEventCfgByUnitId("+unitId+")", e);
return null;
}
}
@SuppressWarnings("unchecked")
public List<TbCfgEvent> queryEventCfgByKpiId(String kpiId) {
String sql = "select * from TB_CFG_EVENT where ENABLE=1 and KPI_ID='"
+ kpiId + "'";
try {
return sqlmapClient.queryForList("queryEventCfgByKpiId", sql);
} catch (Exception e) {
error.error("Exception while queryEventCfgByKpiId("+kpiId+")", e);
return null;
}
}
@SuppressWarnings("unchecked")
public List<TbCfgEvent> queryEventCfgAll(){
try {
return (List<TbCfgEvent>) sqlmapClient.queryForList("queryEventCfgAll", null);
} catch (Exception e) {
error.error("Exception while queryEventCfgAll.", e);
return null;
}
}
public int deleteTbCfgEvent(String[] guid) {
HashMap<String, String[]> params = new HashMap<String, String[]>();
params.put("GUID", guid);
try {
return sqlmapClient.delete("deleteTbCfgEvent", params);
} catch (Exception e) {
error.error("Exception while deleteTbCfgEvent.", e);
return -1;
}
}
public int deleteTbCfgEventAll() {
try {
return sqlmapClient.delete("deleteTbCfgEventAll", null);
} catch (Exception e) {
error.error("Exception while deleteTbCfgEvent.", e);
return -1;
}
}
public void insertTbCfgEvent(TbCfgEvent tbCfgEvent) {
try {
sqlmapClient.insert("insertTbCfgEvent", tbCfgEvent);
} catch (Exception e) {
error.error("Exception while insertTbCfgEvent.", e);
}
}
}