添加公共参数和方法

This commit is contained in:
2023-11-13 10:14:17 +08:00
parent ea5001d565
commit e4d1de8dd0
2 changed files with 44 additions and 0 deletions

View File

@@ -131,5 +131,29 @@ public interface InfluxDbSqlConstant {
*/ */
String TIME = "time" + StrPool.C_SPACE; String TIME = "time" + StrPool.C_SPACE;
/**
* 谐波电压含有率前缀
*/
String V = "v_";
/**
* 谐波电流幅值前缀
*/
String I = "i_";
/**
* 有功功率前缀
*/
String P = "p_";
/**
* 无功功率前缀
*/
String Q = "q_";
/**
* 视在功率前缀
*/
String S = "s_";
} }

View File

@@ -924,6 +924,26 @@ public class InfluxQueryWrapper {
return this; return this;
} }
/***
* 批量返回field key较大的百分之N的值。
* @author xuyang
* @param prefix 表字段名
* @param suffix 映射名称
* @return InfluxQueryWrapper
* 输出 percentile(prefix+diffContent+suffix) as prefix+diffContent+suffix
*/
public InfluxQueryWrapper percentileSamePrefixAndSuffix(String prefix, String suffix, List<Object> diffContent, int percent) {
if (CollectionUtil.isEmpty(diffContent)) {
throw new RuntimeException("查询数值集合为空,请校验!");
}
for (Object obj : diffContent) {
String fieldName = prefix + obj + suffix;
this.percentile(fieldName, percent);
}
return this;
}
/**************************自定义查询条件比如between、>、<、=、>=、<=等等**************************/ /**************************自定义查询条件比如between、>、<、=、>=、<=等等**************************/
/*** /***