From 067f49cda7ee39e611837eac4489395ad2e5f59a Mon Sep 17 00:00:00 2001 From: guofeihu <3347277866@qq.com> Date: Tue, 3 Sep 2024 14:05:11 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=B8=80=E4=B8=AA=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E6=81=A2=E5=A4=8D=E4=B8=8D=E9=9C=80=E8=A6=81=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=AF=B9=E5=BA=94=E7=9A=84=E6=96=B9=E6=B3=95=E4=BA=86,?= =?UTF-8?q?=E7=9B=B4=E6=8E=A5=E6=9B=B4=E6=94=B9=E9=80=9A=E7=94=A8=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/njcn/influx/service/DataHarmPowerPService.java | 1 - .../njcn/influx/service/impl/CommonServiceImpl.java | 5 ++++- .../influx/service/impl/DataHarmPowerPServiceImpl.java | 10 ---------- 3 files changed, 4 insertions(+), 12 deletions(-) diff --git a/src/main/java/com/njcn/influx/service/DataHarmPowerPService.java b/src/main/java/com/njcn/influx/service/DataHarmPowerPService.java index 642b7d6..14074ea 100644 --- a/src/main/java/com/njcn/influx/service/DataHarmPowerPService.java +++ b/src/main/java/com/njcn/influx/service/DataHarmPowerPService.java @@ -13,5 +13,4 @@ import java.util.List; public interface DataHarmPowerPService { List getHarmonicPowerP(String lineIndex, String startTime, String endTime); - List getNewHarmonicPowerP(String lineIndex, String startTime, String endTime, String phaseType, String valueType); } diff --git a/src/main/java/com/njcn/influx/service/impl/CommonServiceImpl.java b/src/main/java/com/njcn/influx/service/impl/CommonServiceImpl.java index 31f3fa5..72f2621 100644 --- a/src/main/java/com/njcn/influx/service/impl/CommonServiceImpl.java +++ b/src/main/java/com/njcn/influx/service/impl/CommonServiceImpl.java @@ -89,9 +89,12 @@ public class CommonServiceImpl implements CommonService { .select(StatisticalDataDTO::getPhaseType) .select(StatisticalDataDTO::getValueType) .select(commonQueryParam.getColumnName(), InfluxDBTableConstant.VALUE) - .eq(InfluxDBTableConstant.LINE_ID, commonQueryParam.getLineId()) + //查询条件开始和结束时间是必须的 .between(InfluxDBTableConstant.TIME, commonQueryParam.getStartTime(), commonQueryParam.getEndTime()); //此方法和getDeviceRtDataByTime方法逻辑一致,只是在以下条件判断中允许部分查询参数为空,也即可以不带入查询 + if(commonQueryParam.getLineId() != null) { + influxQueryWrapper.eq(InfluxDBTableConstant.LINE_ID, commonQueryParam.getLineId()); + } if(commonQueryParam.getPhasic() != null) { influxQueryWrapper.eq(InfluxDBTableConstant.PHASIC_TYPE, commonQueryParam.getPhasic()); } diff --git a/src/main/java/com/njcn/influx/service/impl/DataHarmPowerPServiceImpl.java b/src/main/java/com/njcn/influx/service/impl/DataHarmPowerPServiceImpl.java index 8540b51..c46456b 100644 --- a/src/main/java/com/njcn/influx/service/impl/DataHarmPowerPServiceImpl.java +++ b/src/main/java/com/njcn/influx/service/impl/DataHarmPowerPServiceImpl.java @@ -30,14 +30,4 @@ public class DataHarmPowerPServiceImpl implements DataHarmPowerPService { return result1; } - @Override - public List getNewHarmonicPowerP(String lineIndex, String startTime, String endTime, String phaseType, String valueType) { - InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataHarmPowerP.class); - influxQueryWrapper.between(DataHarmPowerP::getTime, startTime, endTime); - if(lineIndex != null) influxQueryWrapper.eq(DataHarmPowerP::getLineId, lineIndex); - if(phaseType != null) influxQueryWrapper.eq(DataHarmPowerP::getPhaseType, phaseType); - if(valueType != null) influxQueryWrapper.eq(DataHarmPowerP::getValueType, valueType); - List result1 = dataHarmPowerPMapper.getStatisticsByWraper(influxQueryWrapper); - return result1; - } }