forked from github/dataease
feat(数据集): 关联数据集
This commit is contained in:
parent
408a796e74
commit
4a8bfefac4
@ -281,7 +281,7 @@ public class DataSetTableService {
|
|||||||
DatasourceRequest datasourceRequest = new DatasourceRequest();
|
DatasourceRequest datasourceRequest = new DatasourceRequest();
|
||||||
datasourceRequest.setDatasource(dorisDatasource);
|
datasourceRequest.setDatasource(dorisDatasource);
|
||||||
DDLProvider ddlProvider = ProviderFactory.getDDLProvider(dorisDatasource.getType());
|
DDLProvider ddlProvider = ProviderFactory.getDDLProvider(dorisDatasource.getType());
|
||||||
if (StringUtils.equalsIgnoreCase("custom", table.getType())) {
|
if (StringUtils.equalsIgnoreCase("custom", table.getType()) || StringUtils.equalsIgnoreCase("union", table.getType())) {
|
||||||
datasourceRequest.setQuery(ddlProvider.dropView(dorisTableName));
|
datasourceRequest.setQuery(ddlProvider.dropView(dorisTableName));
|
||||||
jdbcProvider.exec(datasourceRequest);
|
jdbcProvider.exec(datasourceRequest);
|
||||||
datasourceRequest.setQuery(ddlProvider.dropView(DorisTableUtils.dorisTmpName(dorisTableName)));
|
datasourceRequest.setQuery(ddlProvider.dropView(DorisTableUtils.dorisTmpName(dorisTableName)));
|
||||||
@ -1070,7 +1070,7 @@ public class DataSetTableService {
|
|||||||
private Map<String, Object> getUnionSQLDoris(DataTableInfoDTO dataTableInfoDTO) {
|
private Map<String, Object> getUnionSQLDoris(DataTableInfoDTO dataTableInfoDTO) {
|
||||||
List<UnionDTO> union = dataTableInfoDTO.getUnion();
|
List<UnionDTO> union = dataTableInfoDTO.getUnion();
|
||||||
// 所有选中的字段,即select后的查询字段
|
// 所有选中的字段,即select后的查询字段
|
||||||
Map<String, String[]> checkedInfo = new TreeMap<>();
|
Map<String, String[]> checkedInfo = new LinkedHashMap<>();
|
||||||
List<UnionParamDTO> unionList = new ArrayList<>();
|
List<UnionParamDTO> unionList = new ArrayList<>();
|
||||||
List<DatasetTableField> checkedFields = new ArrayList<>();
|
List<DatasetTableField> checkedFields = new ArrayList<>();
|
||||||
String sql = "";
|
String sql = "";
|
||||||
@ -1183,7 +1183,7 @@ public class DataSetTableService {
|
|||||||
|
|
||||||
List<UnionDTO> union = dataTableInfoDTO.getUnion();
|
List<UnionDTO> union = dataTableInfoDTO.getUnion();
|
||||||
// 所有选中的字段,即select后的查询字段
|
// 所有选中的字段,即select后的查询字段
|
||||||
Map<String, String[]> checkedInfo = new TreeMap<>();
|
Map<String, String[]> checkedInfo = new LinkedHashMap<>();
|
||||||
List<UnionParamDTO> unionList = new ArrayList<>();
|
List<UnionParamDTO> unionList = new ArrayList<>();
|
||||||
List<DatasetTableField> checkedFields = new ArrayList<>();
|
List<DatasetTableField> checkedFields = new ArrayList<>();
|
||||||
String sql = "";
|
String sql = "";
|
||||||
@ -1272,12 +1272,12 @@ public class DataSetTableService {
|
|||||||
UnionDTO unionDTO = childrenDs.get(i);
|
UnionDTO unionDTO = childrenDs.get(i);
|
||||||
|
|
||||||
DatasetTable datasetTable = datasetTableMapper.selectByPrimaryKey(unionDTO.getCurrentDs().getId());
|
DatasetTable datasetTable = datasetTableMapper.selectByPrimaryKey(unionDTO.getCurrentDs().getId());
|
||||||
String table = new Gson().fromJson(datasetTable.getInfo(), DataTableInfoDTO.class).getTable();
|
|
||||||
String tableId = unionDTO.getCurrentDs().getId();
|
String tableId = unionDTO.getCurrentDs().getId();
|
||||||
|
|
||||||
if (ObjectUtils.isEmpty(datasetTable)) {
|
if (ObjectUtils.isEmpty(datasetTable)) {
|
||||||
DEException.throwException(Translator.get("i18n_custom_ds_delete") + String.format(":table id [%s]", tableId));
|
DEException.throwException(Translator.get("i18n_custom_ds_delete") + String.format(":table id [%s]", tableId));
|
||||||
}
|
}
|
||||||
|
String table = new Gson().fromJson(datasetTable.getInfo(), DataTableInfoDTO.class).getTable();
|
||||||
|
|
||||||
List<DatasetTableField> fields = dataSetTableFieldsService.getListByIdsEach(unionDTO.getCurrentDsField());
|
List<DatasetTableField> fields = dataSetTableFieldsService.getListByIdsEach(unionDTO.getCurrentDsField());
|
||||||
if (CollectionUtils.isEmpty(fields)) {
|
if (CollectionUtils.isEmpty(fields)) {
|
||||||
DEException.throwException(Translator.get("i18n_cst_ds_tb_or_field_deleted") + String.format(":table id [%s]", tableId));
|
DEException.throwException(Translator.get("i18n_cst_ds_tb_or_field_deleted") + String.format(":table id [%s]", tableId));
|
||||||
@ -1473,7 +1473,11 @@ public class DataSetTableService {
|
|||||||
datasetTableField.setTableId(datasetTable.getId());
|
datasetTableField.setTableId(datasetTable.getId());
|
||||||
datasetTableField.setOriginName(filed.getFieldName());
|
datasetTableField.setOriginName(filed.getFieldName());
|
||||||
datasetTableField.setName(filed.getRemarks());
|
datasetTableField.setName(filed.getRemarks());
|
||||||
datasetTableField.setDataeaseName(DorisTableUtils.columnName(filed.getFieldName()));
|
if (datasetTable.getMode() == 1 && StringUtils.equalsIgnoreCase("union", datasetTable.getType())) {
|
||||||
|
datasetTableField.setDataeaseName(filed.getFieldName());
|
||||||
|
} else {
|
||||||
|
datasetTableField.setDataeaseName(DorisTableUtils.columnName(filed.getFieldName()));
|
||||||
|
}
|
||||||
datasetTableField.setType(filed.getFieldType());
|
datasetTableField.setType(filed.getFieldType());
|
||||||
if (ObjectUtils.isEmpty(ds)) {
|
if (ObjectUtils.isEmpty(ds)) {
|
||||||
datasetTableField.setDeType(transFieldType(filed.getFieldType()));
|
datasetTableField.setDeType(transFieldType(filed.getFieldType()));
|
||||||
|
@ -2,11 +2,11 @@
|
|||||||
<div v-if="unionParam.type" style="height:600px;">
|
<div v-if="unionParam.type" style="height:600px;">
|
||||||
<div class="field-style">
|
<div class="field-style">
|
||||||
<div class="fields">
|
<div class="fields">
|
||||||
<p>{{ unionParam.parent.currentDs.name }}</p>
|
<p :title="unionParam.parent.currentDs.name">{{ unionParam.parent.currentDs.name }}</p>
|
||||||
<union-field-list :field-list="parentField" :node="unionParam.parent" @checkedFields="changeParentFields" />
|
<union-field-list :field-list="parentField" :node="unionParam.parent" @checkedFields="changeParentFields" />
|
||||||
</div>
|
</div>
|
||||||
<div class="fields">
|
<div class="fields">
|
||||||
<p>{{ unionParam.node.currentDs.name }}</p>
|
<p :title="unionParam.parent.currentDs.name">{{ unionParam.node.currentDs.name }}</p>
|
||||||
<union-field-list :field-list="nodeField" :node="unionParam.node" @checkedFields="changeNodeFields" />
|
<union-field-list :field-list="nodeField" :node="unionParam.node" @checkedFields="changeNodeFields" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -81,6 +81,9 @@ export default {
|
|||||||
p{
|
p{
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
margin: 6px 0!important;
|
margin: 6px 0!important;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
overflow: hidden;
|
||||||
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
.el-divider--horizontal {
|
.el-divider--horizontal {
|
||||||
margin: 12px 0;
|
margin: 12px 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user