Showing
1 changed file
with
87 additions
and
0 deletions
1 | +package com.sitech.database.dao; | ||
2 | + | ||
3 | + | ||
4 | +import com.sitech.ismp.messageObject.TbAtoDynamicThreshold; | ||
5 | + | ||
6 | +import java.util.HashMap; | ||
7 | +import java.util.List; | ||
8 | +import java.util.Map; | ||
9 | +import java.util.regex.Matcher; | ||
10 | +import java.util.regex.Pattern; | ||
11 | + | ||
12 | +/** | ||
13 | + * Created with IntelliJ IDEA. | ||
14 | + * User: dongyj | ||
15 | + * Date: 16-11-1 | ||
16 | + * Time: 上午10:12 | ||
17 | + * To change this template use File | Settings | File Templates. | ||
18 | + */ | ||
19 | +public class TbAtoDynamicThresholdDao extends BaseDao { | ||
20 | + | ||
21 | + @SuppressWarnings("unchecked") | ||
22 | + public List<TbAtoDynamicThreshold> queryDynamicCfgByKpiId(TbAtoDynamicThreshold tbAtoDynamicThreshold) { | ||
23 | + try { | ||
24 | + Map map = new HashMap(); | ||
25 | + map.put("UNIT_ID",tbAtoDynamicThreshold.getUNIT_ID().trim()); | ||
26 | + map.put("EXT_UNIT_ID",getExtUnitId(tbAtoDynamicThreshold.getUNIT_ID().trim())); | ||
27 | + map.put("KPI_ID",tbAtoDynamicThreshold.getKPI_ID().trim()); | ||
28 | + map.put("CLL_TIME",tbAtoDynamicThreshold.getSTART_TIME()); | ||
29 | + map.put("DB_TIME",tbAtoDynamicThreshold.getEND_TIME()); | ||
30 | + return sqlmapClient.queryForList("queryDynamicCfgByKpiId", map); | ||
31 | + } catch (Exception e) { | ||
32 | + error.error("Exception while queryEventCfgByKpiId("+tbAtoDynamicThreshold+")", e); | ||
33 | + return null; | ||
34 | + } | ||
35 | + } | ||
36 | + | ||
37 | + /** | ||
38 | + * 新增动态阀值数据 | ||
39 | + * @param tbAtoDynamicThreshold | ||
40 | + */ | ||
41 | + public void insertTbAtoDynamicThreshold(TbAtoDynamicThreshold tbAtoDynamicThreshold) { | ||
42 | + try { | ||
43 | + sqlmapClient.insert("insertTbAtoDynamicThreshold", tbAtoDynamicThreshold); | ||
44 | + } catch (Exception e) { | ||
45 | + error.error("Exception while insertTbAtoDynamicThreshold.", e); | ||
46 | + } | ||
47 | + } | ||
48 | + | ||
49 | + /** | ||
50 | + * 删除表中所有动态阀值配置 | ||
51 | + * @return | ||
52 | + */ | ||
53 | + public int deleteTbAtoDynamicThresholdAll() { | ||
54 | + try { | ||
55 | + return sqlmapClient.delete("deleteTbAtoDynamicThresholdAll", null); | ||
56 | + } catch (Exception e) { | ||
57 | + error.error("Exception while deleteTbAtoDynamicThresholdAll.", e); | ||
58 | + return -1; | ||
59 | + } | ||
60 | + } | ||
61 | + | ||
62 | + /** | ||
63 | + * 根据guid[]删除动态阀值配置 | ||
64 | + * @param id | ||
65 | + * @return | ||
66 | + */ | ||
67 | + public int deleteTbAtoDynamicThreshold(String[] id) { | ||
68 | + HashMap<String, String[]> params = new HashMap<String, String[]>(); | ||
69 | + params.put("ID", id); | ||
70 | + | ||
71 | + try { | ||
72 | + return sqlmapClient.delete("deleteTbAtoDynamicThreshold", params); | ||
73 | + } catch (Exception e) { | ||
74 | + error.error("Exception while deleteTbAtoDynamicThreshold.", e); | ||
75 | + return -1; | ||
76 | + } | ||
77 | + } | ||
78 | + | ||
79 | + public static String getExtUnitId(String unitId) { | ||
80 | + Matcher platform = Pattern.compile("^(10\\-\\d+\\-\\d++).*:([^\\-]+).*$").matcher(unitId); | ||
81 | + if (platform.find()) { | ||
82 | + return platform.group(1) + ":" + platform.group(2); | ||
83 | + } | ||
84 | + return ""; | ||
85 | + } | ||
86 | + | ||
87 | +} |
-
Please register or login to post a comment