完胜报表功能需要的方法

This commit is contained in:
hzj
2024-09-18 18:33:31 +08:00
parent 9b91feead6
commit 44347310c1
2 changed files with 37 additions and 7 deletions

View File

@@ -924,6 +924,22 @@ public class InfluxQueryWrapper {
return this;
}
public <T, R> InfluxQueryWrapper percentile(String columnName,String resultName, int percent) {
String selectFragment = InfluxDbSqlConstant.PERCENTILE +
InfluxDbSqlConstant.LBK +
InfluxDbSqlConstant.DQM +
columnName +
InfluxDbSqlConstant.DQM +
StrPool.COMMA +
percent +
InfluxDbSqlConstant.RBK +
InfluxDbSqlConstant.AS +
resultName +
StrPool.C_SPACE;
selectColumns.add(selectFragment);
return this;
}
/***
* 批量返回field key较大的百分之N的值。
* @author xuyang
@@ -1278,6 +1294,7 @@ public class InfluxQueryWrapper {
return this;
}
public <T, R, O> InfluxQueryWrapper or(String columnName, List<O> columnValues) {
if (CollectionUtil.isEmpty(columnValues)) {
throw new RuntimeException("查询数值集合为空,请校验!");
@@ -1346,6 +1363,20 @@ public class InfluxQueryWrapper {
return this;
}
public <T, R> InfluxQueryWrapper regular(String fieldName, List<String> columnValues) {
if (CollectionUtil.isEmpty(columnValues)) {
throw new RuntimeException("查询数值集合为空,请校验!");
}
String columnName = this.getColumnName(measurement, fieldName);
String conditionSql = columnName + InfluxDbSqlConstant.EQ;
String middleSql = String.join(InfluxDbSqlConstant.REGULAR_MIDDLE, columnValues);
conditionSql = conditionSql + InfluxDbSqlConstant.REGULAR_PREFIX
+ middleSql
+ InfluxDbSqlConstant.REGULAR_SUFFIX;
conditions.add(conditionSql);
return this;
}
/********************* [WHERE_clause] [GROUP_BY_clause] [ORDER_BY_clause] [LIMIT_clause] [OFFSET_clause] [SLIMIT_clause] [SOFFSET_clause]*********************/