|
|
package com.sitech.database.dao;
|
|
|
|
|
|
|
|
|
import com.sitech.ismp.messageObject.TbAtoDynamicThreshold;
|
|
|
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.regex.Matcher;
|
|
|
import java.util.regex.Pattern;
|
|
|
|
|
|
/**
|
|
|
* Created with IntelliJ IDEA.
|
|
|
* User: dongyj
|
|
|
* Date: 16-11-1
|
|
|
* Time: 上午10:12
|
|
|
* To change this template use File | Settings | File Templates.
|
|
|
*/
|
|
|
public class TbAtoDynamicThresholdDao extends BaseDao {
|
|
|
|
|
|
@SuppressWarnings("unchecked")
|
|
|
public List<TbAtoDynamicThreshold> queryDynamicCfgByKpiId(TbAtoDynamicThreshold tbAtoDynamicThreshold) {
|
|
|
try {
|
|
|
Map map = new HashMap();
|
|
|
map.put("UNIT_ID",tbAtoDynamicThreshold.getUNIT_ID().trim());
|
|
|
map.put("EXT_UNIT_ID",getExtUnitId(tbAtoDynamicThreshold.getUNIT_ID().trim()));
|
|
|
map.put("KPI_ID",tbAtoDynamicThreshold.getKPI_ID().trim());
|
|
|
map.put("CLL_TIME",tbAtoDynamicThreshold.getSTART_TIME());
|
|
|
map.put("DB_TIME",tbAtoDynamicThreshold.getEND_TIME());
|
|
|
return sqlmapClient.queryForList("queryDynamicCfgByKpiId", map);
|
|
|
} catch (Exception e) {
|
|
|
error.error("Exception while queryEventCfgByKpiId("+tbAtoDynamicThreshold+")", e);
|
|
|
return null;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 新增动态阀值数据
|
|
|
* @param tbAtoDynamicThreshold
|
|
|
*/
|
|
|
public void insertTbAtoDynamicThreshold(TbAtoDynamicThreshold tbAtoDynamicThreshold) {
|
|
|
try {
|
|
|
sqlmapClient.insert("insertTbAtoDynamicThreshold", tbAtoDynamicThreshold);
|
|
|
} catch (Exception e) {
|
|
|
error.error("Exception while insertTbAtoDynamicThreshold.", e);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 删除表中所有动态阀值配置
|
|
|
* @return
|
|
|
*/
|
|
|
public int deleteTbAtoDynamicThresholdAll() {
|
|
|
try {
|
|
|
return sqlmapClient.delete("deleteTbAtoDynamicThresholdAll", null);
|
|
|
} catch (Exception e) {
|
|
|
error.error("Exception while deleteTbAtoDynamicThresholdAll.", e);
|
|
|
return -1;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 根据guid[]删除动态阀值配置
|
|
|
* @param id
|
|
|
* @return
|
|
|
*/
|
|
|
public int deleteTbAtoDynamicThreshold(String[] id) {
|
|
|
HashMap<String, String[]> params = new HashMap<String, String[]>();
|
|
|
params.put("ID", id);
|
|
|
|
|
|
try {
|
|
|
return sqlmapClient.delete("deleteTbAtoDynamicThreshold", params);
|
|
|
} catch (Exception e) {
|
|
|
error.error("Exception while deleteTbAtoDynamicThreshold.", e);
|
|
|
return -1;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public static String getExtUnitId(String unitId) {
|
|
|
Matcher platform = Pattern.compile("^(10\\-\\d+\\-\\d++).*:([^\\-]+).*$").matcher(unitId);
|
|
|
if (platform.find()) {
|
|
|
return platform.group(1) + ":" + platform.group(2);
|
|
|
}
|
|
|
return "";
|
|
|
}
|
|
|
|
|
|
} |
...
|
...
|
|