This commit is contained in:
2023-08-04 14:44:10 +08:00
parent 7ffa3f8c10
commit f331437732

View File

@@ -11,6 +11,7 @@ import org.springframework.stereotype.Service;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Objects;
/** /**
* Description: * Description:
@@ -28,6 +29,14 @@ public class CommonServiceImpl implements CommonService {
@Override @Override
public StatisticalDataDTO getLineRtData(String lineId, String tableName, String columnName, String phasic, String dataType) { public StatisticalDataDTO getLineRtData(String lineId, String tableName, String columnName, String phasic, String dataType) {
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(tableName,StatisticalDataDTO.class); InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(tableName,StatisticalDataDTO.class);
if (Objects.equals(dataType,"M")){
influxQueryWrapper.select(StatisticalDataDTO::getLineId)
.select(StatisticalDataDTO::getPhaseType)
.select(StatisticalDataDTO::getValueType)
.last(columnName)
.eq(InfluxDBTableConstant.LINE_ID,lineId)
.eq(InfluxDBTableConstant.PHASIC_TYPE,phasic);
} else {
influxQueryWrapper.select(StatisticalDataDTO::getLineId) influxQueryWrapper.select(StatisticalDataDTO::getLineId)
.select(StatisticalDataDTO::getPhaseType) .select(StatisticalDataDTO::getPhaseType)
.select(StatisticalDataDTO::getValueType) .select(StatisticalDataDTO::getValueType)
@@ -35,6 +44,7 @@ public class CommonServiceImpl implements CommonService {
.eq(InfluxDBTableConstant.LINE_ID,lineId) .eq(InfluxDBTableConstant.LINE_ID,lineId)
.eq(InfluxDBTableConstant.PHASIC_TYPE,phasic) .eq(InfluxDBTableConstant.PHASIC_TYPE,phasic)
.eq(InfluxDBTableConstant.VALUE_TYPE,dataType); .eq(InfluxDBTableConstant.VALUE_TYPE,dataType);
}
return commonMapper.getLineRtData(influxQueryWrapper); return commonMapper.getLineRtData(influxQueryWrapper);
} }