微调
This commit is contained in:
@@ -2,6 +2,7 @@ package com.njcn.influx.base;
|
|||||||
|
|
||||||
|
|
||||||
import com.njcn.influx.ano.Insert;
|
import com.njcn.influx.ano.Insert;
|
||||||
|
import com.njcn.influx.query.InfluxQueryWrapper;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -23,4 +24,12 @@ public interface InfluxDbBaseMapper<T> {
|
|||||||
*/
|
*/
|
||||||
@Insert
|
@Insert
|
||||||
void insertBatch(List<T> entityList);
|
void insertBatch(List<T> entityList);
|
||||||
|
|
||||||
|
/***
|
||||||
|
* 根据查询条件返回
|
||||||
|
* @author hongawen
|
||||||
|
* @param influxQueryWrapper 查询条件
|
||||||
|
* @return T
|
||||||
|
*/
|
||||||
|
List<T> selectByQueryWrapper(InfluxQueryWrapper influxQueryWrapper);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ public class InfluxQueryWrapper {
|
|||||||
/***
|
/***
|
||||||
* 初始化查询语句
|
* 初始化查询语句
|
||||||
*/
|
*/
|
||||||
private void initSql() {
|
public void initSql() {
|
||||||
this.selectColumns.clear();
|
this.selectColumns.clear();
|
||||||
this.conditions.clear();
|
this.conditions.clear();
|
||||||
this.groupColumn.clear();
|
this.groupColumn.clear();
|
||||||
@@ -95,7 +95,8 @@ public class InfluxQueryWrapper {
|
|||||||
* @param fieldsStr 属性值
|
* @param fieldsStr 属性值
|
||||||
* 输出为 select ["influxColumn" as fieldStr]的形式
|
* 输出为 select ["influxColumn" as fieldStr]的形式
|
||||||
*/
|
*/
|
||||||
public <T, R> InfluxQueryWrapper select(ICFunction<T, R>... fieldsStr) {
|
@SafeVarargs
|
||||||
|
public final <T, R> InfluxQueryWrapper select(ICFunction<T, R>... fieldsStr) {
|
||||||
if (ArrayUtil.isNotEmpty(fieldsStr)) {
|
if (ArrayUtil.isNotEmpty(fieldsStr)) {
|
||||||
StringBuilder selectFragment = new StringBuilder();
|
StringBuilder selectFragment = new StringBuilder();
|
||||||
Arrays.stream(fieldsStr).forEach(fieldStr -> {
|
Arrays.stream(fieldsStr).forEach(fieldStr -> {
|
||||||
@@ -339,7 +340,9 @@ public class InfluxQueryWrapper {
|
|||||||
StrPool.COMMA +
|
StrPool.COMMA +
|
||||||
num +
|
num +
|
||||||
InfluxDbSqlConstant.RBK +
|
InfluxDbSqlConstant.RBK +
|
||||||
InfluxDbSqlConstant.AS_VALUE;
|
InfluxDbSqlConstant.AS +
|
||||||
|
this.getColumnName(resultEntity, LambdaUtil.columnToString(columnName)) +
|
||||||
|
StrPool.C_SPACE;
|
||||||
selectColumns.add(selectFragment);
|
selectColumns.add(selectFragment);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
@@ -360,7 +363,9 @@ public class InfluxQueryWrapper {
|
|||||||
StrPool.COMMA +
|
StrPool.COMMA +
|
||||||
num +
|
num +
|
||||||
InfluxDbSqlConstant.RBK +
|
InfluxDbSqlConstant.RBK +
|
||||||
InfluxDbSqlConstant.AS_VALUE;
|
InfluxDbSqlConstant.AS +
|
||||||
|
this.getColumnName(resultEntity, LambdaUtil.columnToString(columnName)) +
|
||||||
|
StrPool.C_SPACE;
|
||||||
selectColumns.add(selectFragment);
|
selectColumns.add(selectFragment);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
@@ -882,8 +887,11 @@ public class InfluxQueryWrapper {
|
|||||||
* @return InfluxQueryWrapper
|
* @return InfluxQueryWrapper
|
||||||
* 输出 columnName
|
* 输出 columnName
|
||||||
*/
|
*/
|
||||||
public <T, R> InfluxQueryWrapper groupBy(ICFunction<T, R> columnName) {
|
@SafeVarargs
|
||||||
groupColumn.add(this.getColumnName(measurement, LambdaUtil.columnToString(columnName)));
|
public final <T, R> InfluxQueryWrapper groupBy(ICFunction<T, R>... columnName) {
|
||||||
|
for (ICFunction<T, R> tricFunction : columnName) {
|
||||||
|
groupColumn.add(this.getColumnName(measurement, LambdaUtil.columnToString(tricFunction)));
|
||||||
|
}
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user