From f3314377320d63c72b982e3f7904d9e6cf0910c4 Mon Sep 17 00:00:00 2001 From: xuyang <748613696@qq.com> Date: Fri, 4 Aug 2023 14:44:10 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BE=AE=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/CommonServiceImpl.java | 24 +++++++++++++------ 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/pqs-influx/src/main/java/com/njcn/influx/service/impl/CommonServiceImpl.java b/pqs-influx/src/main/java/com/njcn/influx/service/impl/CommonServiceImpl.java index 2f3f7402c..820c13222 100644 --- a/pqs-influx/src/main/java/com/njcn/influx/service/impl/CommonServiceImpl.java +++ b/pqs-influx/src/main/java/com/njcn/influx/service/impl/CommonServiceImpl.java @@ -11,6 +11,7 @@ import org.springframework.stereotype.Service; import java.util.HashMap; import java.util.List; +import java.util.Objects; /** * Description: @@ -28,13 +29,22 @@ public class CommonServiceImpl implements CommonService { @Override public StatisticalDataDTO getLineRtData(String lineId, 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) - .eq(InfluxDBTableConstant.LINE_ID,lineId) - .eq(InfluxDBTableConstant.PHASIC_TYPE,phasic) - .eq(InfluxDBTableConstant.VALUE_TYPE,dataType); + 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) + .select(StatisticalDataDTO::getPhaseType) + .select(StatisticalDataDTO::getValueType) + .last(columnName) + .eq(InfluxDBTableConstant.LINE_ID,lineId) + .eq(InfluxDBTableConstant.PHASIC_TYPE,phasic) + .eq(InfluxDBTableConstant.VALUE_TYPE,dataType); + } return commonMapper.getLineRtData(influxQueryWrapper); }