forked from github/dataease
feat(数据集): 数据集支持全连接
This commit is contained in:
parent
58cdbe26c1
commit
9c373bad0f
@ -77,6 +77,8 @@ public class DatasetDataManage {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(DatasetDataManage.class);
|
||||
|
||||
private static final List<String> notFullDs = List.of("mysql", "mariadb", "Excel", "API");
|
||||
|
||||
public List<DatasetTableFieldDTO> getTableFields(DatasetTableDTO datasetTableDTO) throws Exception {
|
||||
List<DatasetTableFieldDTO> list = null;
|
||||
List<TableField> tableFields = null;
|
||||
@ -189,6 +191,9 @@ public class DatasetDataManage {
|
||||
boolean needOrder = Utils.isNeedOrder(dsList);
|
||||
boolean crossDs = Utils.isCrossDs(dsMap);
|
||||
if (!crossDs) {
|
||||
if (notFullDs.contains(dsMap.entrySet().iterator().next().getValue().getType()) && (boolean) sqlMap.get("isFullJoin")) {
|
||||
DEException.throwException(Translator.get("i18n_not_full"));
|
||||
}
|
||||
sql = Utils.replaceSchemaAlias(sql, dsMap);
|
||||
}
|
||||
|
||||
|
@ -36,8 +36,6 @@ import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
import java.util.*;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@ -153,6 +151,7 @@ public class DatasetSQLManage {
|
||||
}
|
||||
}
|
||||
// build sql
|
||||
boolean isFullJoin = false;
|
||||
if (!CollectionUtils.isEmpty(unionList)) {
|
||||
// field
|
||||
StringBuilder field = new StringBuilder();
|
||||
@ -167,6 +166,12 @@ public class DatasetSQLManage {
|
||||
for (UnionParamDTO unionParamDTO : unionList) {
|
||||
// get join type
|
||||
String joinType = convertUnionTypeToSQL(unionParamDTO.getUnionType());
|
||||
// 如果不是全连接则需要校验连接方式
|
||||
if (!isFullJoin) {
|
||||
if (StringUtils.equalsIgnoreCase(unionParamDTO.getUnionType(), "full")) {
|
||||
isFullJoin = true;
|
||||
}
|
||||
}
|
||||
|
||||
SQLObj parentSQLObj = unionParamDTO.getParentSQLObj();
|
||||
SQLObj currentSQLObj = unionParamDTO.getCurrentSQLObj();
|
||||
@ -253,6 +258,7 @@ public class DatasetSQLManage {
|
||||
map.put("field", checkedFields);
|
||||
map.put("join", unionList);
|
||||
map.put("dsMap", dsMap);
|
||||
map.put("isFullJoin", isFullJoin);
|
||||
return map;
|
||||
}
|
||||
|
||||
|
@ -32,6 +32,7 @@ i18n_table_duplicate=Leaf can not duplicated
|
||||
i18n_no_column_permission=No column permission
|
||||
i18n_fetch_error=SQL execute error,please edit again.
|
||||
i18n_no_datasource_permission=No datasource permission
|
||||
i18n_not_full=Full join not support.
|
||||
|
||||
i18n_field_circular_ref=Field has Circular Reference
|
||||
|
||||
|
@ -42,6 +42,7 @@ i18n_table_duplicate=\u76F8\u540C\u8282\u70B9\u9700\u91CD\u65B0\u62D6\u5165\u624
|
||||
i18n_no_column_permission=\u6CA1\u6709\u5217\u6743\u9650
|
||||
i18n_fetch_error=SQL\u6267\u884C\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u8868\u3001\u5B57\u6BB5\u3001\u5173\u8054\u5173\u7CFB\u7B49\u4FE1\u606F\u662F\u5426\u6B63\u786E\u5E76\u91CD\u65B0\u7F16\u8F91\u3002
|
||||
i18n_no_datasource_permission=\u65E0\u6570\u636E\u6E90\u8BBF\u95EE\u6743\u9650
|
||||
i18n_not_full=\u5f53\u524d\u6570\u636e\u6e90\u4e0d\u652f\u6301\u5168\u8fde\u63a5
|
||||
|
||||
i18n_field_circular_ref=\u5B57\u6BB5\u5B58\u5728\u5FAA\u73AF\u5F15\u7528
|
||||
|
||||
|
@ -33,6 +33,7 @@ i18n_table_duplicate=\u76F8\u540C\u7BC0\u9EDE\u9700\u91CD\u65B0\u62D6\u5165\u624
|
||||
i18n_no_column_permission=\u6C92\u6709\u5217\u6B0A\u9650
|
||||
i18n_fetch_error=SQL\u57F7\u884C\u5931\u6557\uFF0C\u8ACB\u6AA2\u67E5\u8868\u3001\u5B57\u6BB5\u3001\u95DC\u806F\u95DC\u7CFB\u7B49\u4FE1\u606F\u662F\u5426\u6B63\u78BA\u4E26\u91CD\u65B0\u7DE8\u8F2F\u3002
|
||||
i18n_no_datasource_permission=\u65E0\u6570\u636E\u6E90\u8BBF\u95EE\u6743\u9650
|
||||
i18n_not_full=\u7576\u524d\u6578\u64da\u6e90\u4e0d\u652f\u6301\u5168\u9023\u63a5
|
||||
|
||||
i18n_field_circular_ref=\u5B57\u6BB5\u5B58\u5728\u5FAA\u74B0\u5F15\u7528
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user