influxdb添加方法

This commit is contained in:
huangzj
2023-06-15 16:12:46 +08:00
parent 4350a2c342
commit e0c4e4b88f
3 changed files with 55 additions and 0 deletions

View File

@@ -58,4 +58,31 @@ public class CommonServiceImpl implements CommonService {
.eq("value_type",dataType);
return commonMapper.getLineRtData(influxQueryWrapper);
}
@Override
public List<StatisticalDataDTO> getDeviceRtData(List<String> lineIds, String tableName, String columnName, String phasic, String dataType) {
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(tableName,StatisticalDataDTO.class);
influxQueryWrapper.select(StatisticalDataDTO::getLineId)
.select(StatisticalDataDTO::getPhaseType)
.select(StatisticalDataDTO::getValueType)
.last(columnName)
.or("line_id",lineIds)
.eq("phasic_type",phasic)
.eq("value_type",dataType).groupBy("line_id");
return commonMapper.getDeviceRtData(influxQueryWrapper);
}
@Override
public List<StatisticalDataDTO> getDeviceRtDataByTime(List<String> lineIds, String tableName, String columnName, String phasic, String dataType, String startTime, String endTime) {
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(tableName,StatisticalDataDTO.class);
influxQueryWrapper.select(StatisticalDataDTO::getLineId)
.select(StatisticalDataDTO::getPhaseType)
.select(StatisticalDataDTO::getValueType)
.select(columnName,"value")
.or("line_id",lineIds)
.eq("phasic_type",phasic)
.between("time", startTime, endTime)
.eq("value_type",dataType).groupBy("line_id");
return commonMapper.getDeviceRtDataByTime(influxQueryWrapper);
}
}