StringBufferquerysql=newStringBuffer("SELECT createdTime ,equipmentNumber,gatewayId,address,valueLabel,equipmentSpecificName,value FROM indicators_%s WHERE isAlarm='1' and value!='0.0' and gatewayId= %s ORDER BY time desc LIMIT %d OFFSET %d ");
StringBufferquerysqlcount=newStringBuffer("SELECT count(value) FROM indicators_%s WHERE isAlarm='1' and value!='0.0' and gatewayId= %s ");
StringBufferquerysql=newStringBuffer("SELECT createdTime ,gatewayId,address,valueLabel,equipmentSpecificName,value FROM iot_data_%s WHERE isAlarm='1' and value!='0.0' and gatewayId= %s ORDER BY time desc LIMIT %d OFFSET %d ");
StringBufferquerysqlcount=newStringBuffer("SELECT count(value) FROM iot_data_%s WHERE isAlarm='1' and value!='0.0' and gatewayId= %s ");
if(StringUtils.isNotEmpty(equipmentNumber)){
Stringdate=" '%s' and equipmentSpecificName=~/.*%s风机.*/ ";
sql=String.format("SELECT equipmentIndexName, value, frontModule FROM \"indicators_%s\" WHERE equipmentNumber = '%s' and frontModule =~/%s/ and systemType =~/%s/ ",stationBasic.getFanGatewayId(),equipNum,frontModule,systemType);
}else{
sql=String.format("SELECT equipmentIndexName, value, frontModule FROM \"indicators_%s\" WHERE equipmentNumber = '%s' and frontModule =~/%s/",stationBasic.getFanGatewayId(),equipNum,frontModule);
Stringsql=String.format("SELECT equipmentNumber, equipmentIndexName FROM \"indicators_%s\" WHERE equipmentIndexName =~/^正常运行|告警运行|正常停机|故障停机|限功率|待机状态|维护状态|通讯中断$/ and value = 'true'",stationBasic.getFanGatewayId());
Stringsql=String.format("SELECT equipmentNumber, equipmentIndexName FROM \"indicators_%s\" WHERE equipmentIndexName =~/^正常运行|告警运行|正常停机|故障停机|限功率|待机状态|维护状态|通讯中断$/ and value = 'true'",stationBasic.getFanGatewayId());
Stringsql=String.format("SELECT equipmentNumber, equipmentSpecificName, equipmentIndexName FROM \"indicators_%s\" WHERE equipmentNumber = '%s' and value = 'true' order by time desc limit 1",stationBasic.getFanGatewayId(),equipNum);