Compare commits
3 Commits
c8b9b6f730
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| a6fba7db34 | |||
| 0088ac746d | |||
| 88bf4b215b |
@@ -110,6 +110,7 @@ public interface InfluxDbSqlConstant {
|
||||
String REGULAR_PREFIX="~/^";
|
||||
String REGULAR_SUFFIX="$/";
|
||||
String REGULAR_MIDDLE="|";
|
||||
String DIFFERENCE = "DIFFERENCE";
|
||||
|
||||
/**
|
||||
* “ tz('Asia/Shanghai')”
|
||||
|
||||
@@ -13,7 +13,10 @@ import org.influxdb.annotation.Column;
|
||||
import org.influxdb.annotation.Measurement;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @author hongawen
|
||||
@@ -595,6 +598,25 @@ public class InfluxQueryWrapper {
|
||||
return this;
|
||||
}
|
||||
|
||||
/***
|
||||
* 计算相邻时间点之间的差值
|
||||
* @author xy
|
||||
* @param columnName 表字段名
|
||||
* @return InfluxQueryWrapper
|
||||
* DIFFERENCE("columnName")
|
||||
*/
|
||||
public <T, R> InfluxQueryWrapper difference(String columnName) {
|
||||
String selectFragment = InfluxDbSqlConstant.DIFFERENCE +
|
||||
InfluxDbSqlConstant.LBK +
|
||||
InfluxDbSqlConstant.DQM +
|
||||
columnName +
|
||||
InfluxDbSqlConstant.DQM +
|
||||
InfluxDbSqlConstant.RBK +
|
||||
InfluxDbSqlConstant.AS_VALUE;
|
||||
selectColumns.add(selectFragment);
|
||||
return this;
|
||||
}
|
||||
|
||||
/***
|
||||
* 注:该函数还需调研,暂时不要用
|
||||
* 统计指定字段邻近值的变化率
|
||||
@@ -986,8 +1008,9 @@ public class InfluxQueryWrapper {
|
||||
throw new RuntimeException("查询数值集合为空,请校验!");
|
||||
}
|
||||
for (Object obj : diffContent) {
|
||||
String fieldName = prefix + obj + suffix;
|
||||
this.select(fieldName,fieldName);
|
||||
String fieldName = prefix + obj;
|
||||
String resultName = suffix + obj;
|
||||
this.select(fieldName,resultName);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user