Authored by FengRuwei

查询 加字符串

... ... @@ -74,9 +74,9 @@ public class JavaApiStaticsMapper implements IJavaApiStaticsMapper {
public JavaApiStaticsModel selectlatestJavaApiStatics(String influxDBName, JavaApiStatusReq param) {
int api_id = param.getServiceId();
int mobj_id = param.getMObjectId();
String sql = "select * from " + InfluxDBContants.YOMO_TB_JAVAAPI + " where time > now() - 10m ";
sql += " and api_id=" + api_id;
sql += " and mobj_id=" + mobj_id;
String sql = "select * from " + InfluxDBContants.YOMO_TB_JAVAAPI + " where time > now() - 1h ";
sql += " and api_id='" + api_id+"'";
sql += " and mobj_id='" + mobj_id+"'";
sql += " order by time desc limit 1";
Query query = new Query(sql, InfluxDBContants.APP_ALARM);
QueryResult result = null;
... ... @@ -161,8 +161,8 @@ public class JavaApiStaticsMapper implements IJavaApiStaticsMapper {
int api_id = param.getServiceId();
int mobj_id = param.getMObjectId();
sb.append("select api_id,mobj_id,start_time,end_time,is_exception,exception from " + InfluxDBContants.YOMO_TB_JAVAAPI + " where time > now() - 10m ");
sb.append(" and api_id=" + api_id);
sb.append(" and mobj_id=" + mobj_id);
sb.append(" and api_id='" + api_id+"'");
sb.append(" and mobj_id='" + mobj_id+"'");
sb.append(" order by time desc limit 1;");
}
log.info(sb.toString());
... ... @@ -232,10 +232,10 @@ public class JavaApiStaticsMapper implements IJavaApiStaticsMapper {
String sql = "select * from " + InfluxDBContants.YOMO_TB_JAVAAPI;
sql += " where time >= '" + timeStart + "' and time<= '" + timeEnd + "' ";
if (api_id > 0)
sql += " and api_id= " + api_id;
sql += " and api_id= 1" + api_id+"' ";
//有mid 直接使用mid检索 不考虑ip
if (mobj_id > 0) {
sql += " and mobj_id= " + mobj_id;
sql += " and mobj_id= 1" + mobj_id+"' ";
} else if (mIp != null && !mIp.equals("")) {
sql += " and mobj_ip= '" + mIp + "' ";
}
... ... @@ -327,10 +327,10 @@ public class JavaApiStaticsMapper implements IJavaApiStaticsMapper {
String sql = "select count(api_id) from " + InfluxDBContants.YOMO_TB_JAVAAPI;
sql += " where time >= '" + timeStart + "' and time<= '" + timeEnd + "' ";
if (api_id > 0)
sql += " and api_id= " + api_id;
sql += " and api_id= '" + api_id+"'";
//有mid 直接使用mid检索 不考虑ip
if (mobj_id > 0) {
sql += " and mobj_id= " + mobj_id;
sql += " and mobj_id= '" + mobj_id+"'";
} else if (mIp != null && !mIp.equals("")) {
sql += " and mobj_ip= '" + mIp + "' ";
}
... ...