(improvement)(headless) add sql variable for model sql (#740)

Co-authored-by: jolunoluo
This commit is contained in:
LXW
2024-02-23 11:00:06 +08:00
committed by GitHub
parent e95a528219
commit d8043c356f
7 changed files with 222 additions and 0 deletions

View File

@@ -27,6 +27,8 @@ public class ModelDetail {
private List<Field> fields = Lists.newArrayList();
private List<SqlVariable> sqlVariables = Lists.newArrayList();
public String getSqlQuery() {
if (StringUtils.isNotBlank(sqlQuery) && sqlQuery.endsWith(";")) {
sqlQuery = sqlQuery.substring(0, sqlQuery.length() - 1);

View File

@@ -0,0 +1,16 @@
package com.tencent.supersonic.headless.api.pojo;
import com.google.common.collect.Lists;
import com.tencent.supersonic.headless.api.pojo.enums.VariableValueType;
import lombok.Data;
import java.util.List;
@Data
public class SqlVariable {
private String name;
private VariableValueType valueType;
private List<Object> defaultValues = Lists.newArrayList();
}

View File

@@ -0,0 +1,7 @@
package com.tencent.supersonic.headless.api.pojo.enums;
public enum VariableValueType {
STRING,
NUMBER,
EXPR
}