forked from github/dataease
feat: 同步数据集预览数据从doris中取
This commit is contained in:
parent
1a44dd2030
commit
77f5414125
@ -282,52 +282,101 @@ public class DataSetTableService {
|
|||||||
realSize = Integer.parseInt(dataSetTableRequest.getRow()) % pageSize;
|
realSize = Integer.parseInt(dataSetTableRequest.getRow()) % pageSize;
|
||||||
}
|
}
|
||||||
if (StringUtils.equalsIgnoreCase(datasetTable.getType(), "db")) {
|
if (StringUtils.equalsIgnoreCase(datasetTable.getType(), "db")) {
|
||||||
Datasource ds = datasourceMapper.selectByPrimaryKey(dataSetTableRequest.getDataSourceId());
|
if (datasetTable.getMode() == 0) {
|
||||||
if (ObjectUtils.isEmpty(ds)) {
|
Datasource ds = datasourceMapper.selectByPrimaryKey(dataSetTableRequest.getDataSourceId());
|
||||||
throw new RuntimeException(Translator.get("i18n_datasource_delete"));
|
if (ObjectUtils.isEmpty(ds)) {
|
||||||
|
throw new RuntimeException(Translator.get("i18n_datasource_delete"));
|
||||||
|
}
|
||||||
|
DatasourceProvider datasourceProvider = ProviderFactory.getProvider(ds.getType());
|
||||||
|
DatasourceRequest datasourceRequest = new DatasourceRequest();
|
||||||
|
datasourceRequest.setDatasource(ds);
|
||||||
|
String table = dataTableInfoDTO.getTable();
|
||||||
|
QueryProvider qp = ProviderFactory.getQueryProvider(ds.getType());
|
||||||
|
datasourceRequest.setQuery(qp.createQuerySQLWithPage(table, fields, page, pageSize, realSize));
|
||||||
|
try {
|
||||||
|
data.addAll(datasourceProvider.getData(datasourceRequest));
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
datasourceRequest.setQuery(qp.createQueryTableWithLimit(table, fields, Integer.valueOf(dataSetTableRequest.getRow())));
|
||||||
|
dataSetPreviewPage.setTotal(datasourceProvider.getData(datasourceRequest).size());
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// check doris table
|
||||||
|
if (!checkDorisTableIsExists(dataSetTableRequest.getId())) {
|
||||||
|
throw new RuntimeException(Translator.get("i18n_data_not_sync"));
|
||||||
|
}
|
||||||
|
Datasource ds = (Datasource) CommonBeanFactory.getBean("DorisDatasource");
|
||||||
|
JdbcProvider jdbcProvider = CommonBeanFactory.getBean(JdbcProvider.class);
|
||||||
|
DatasourceRequest datasourceRequest = new DatasourceRequest();
|
||||||
|
datasourceRequest.setDatasource(ds);
|
||||||
|
String table = DorisTableUtils.dorisName(dataSetTableRequest.getId());
|
||||||
|
QueryProvider qp = ProviderFactory.getQueryProvider(ds.getType());
|
||||||
|
datasourceRequest.setQuery(qp.createQuerySQLWithPage(table, fields, page, pageSize, realSize));
|
||||||
|
try {
|
||||||
|
data.addAll(jdbcProvider.getData(datasourceRequest));
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
datasourceRequest.setQuery(qp.createQueryCountSQL(table));
|
||||||
|
dataSetPreviewPage.setTotal(Integer.valueOf(jdbcProvider.getData(datasourceRequest).get(0)[0]));
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
DatasourceProvider datasourceProvider = ProviderFactory.getProvider(ds.getType());
|
|
||||||
DatasourceRequest datasourceRequest = new DatasourceRequest();
|
|
||||||
datasourceRequest.setDatasource(ds);
|
|
||||||
|
|
||||||
String table = dataTableInfoDTO.getTable();
|
|
||||||
QueryProvider qp = ProviderFactory.getQueryProvider(ds.getType());
|
|
||||||
datasourceRequest.setQuery(qp.createQuerySQLWithPage(table, fields, page, pageSize, realSize));
|
|
||||||
try {
|
|
||||||
data.addAll(datasourceProvider.getData(datasourceRequest));
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
datasourceRequest.setQuery(qp.createQueryTableWithLimit(table, fields, Integer.valueOf(dataSetTableRequest.getRow())));
|
|
||||||
dataSetPreviewPage.setTotal(datasourceProvider.getData(datasourceRequest).size());
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
} else if (StringUtils.equalsIgnoreCase(datasetTable.getType(), "sql")) {
|
} else if (StringUtils.equalsIgnoreCase(datasetTable.getType(), "sql")) {
|
||||||
Datasource ds = datasourceMapper.selectByPrimaryKey(dataSetTableRequest.getDataSourceId());
|
if (datasetTable.getMode() == 0) {
|
||||||
if (ObjectUtils.isEmpty(ds)) {
|
Datasource ds = datasourceMapper.selectByPrimaryKey(dataSetTableRequest.getDataSourceId());
|
||||||
throw new RuntimeException(Translator.get("i18n_datasource_delete"));
|
if (ObjectUtils.isEmpty(ds)) {
|
||||||
}
|
throw new RuntimeException(Translator.get("i18n_datasource_delete"));
|
||||||
DatasourceProvider datasourceProvider = ProviderFactory.getProvider(ds.getType());
|
}
|
||||||
DatasourceRequest datasourceRequest = new DatasourceRequest();
|
DatasourceProvider datasourceProvider = ProviderFactory.getProvider(ds.getType());
|
||||||
datasourceRequest.setDatasource(ds);
|
DatasourceRequest datasourceRequest = new DatasourceRequest();
|
||||||
|
datasourceRequest.setDatasource(ds);
|
||||||
|
|
||||||
String sql = dataTableInfoDTO.getSql();
|
String sql = dataTableInfoDTO.getSql();
|
||||||
QueryProvider qp = ProviderFactory.getQueryProvider(ds.getType());
|
QueryProvider qp = ProviderFactory.getQueryProvider(ds.getType());
|
||||||
datasourceRequest.setQuery(qp.createQuerySQLAsTmpWithPage(sql, fields, page, pageSize, realSize));
|
datasourceRequest.setQuery(qp.createQuerySQLAsTmpWithPage(sql, fields, page, pageSize, realSize));
|
||||||
System.out.println(datasourceRequest.getQuery());
|
|
||||||
try {
|
|
||||||
data.addAll(datasourceProvider.getData(datasourceRequest));
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
datasourceRequest.setQuery(qp.createQuerySqlWithLimit(sql, fields, Integer.valueOf(dataSetTableRequest.getRow())));
|
|
||||||
System.out.println(datasourceRequest.getQuery());
|
System.out.println(datasourceRequest.getQuery());
|
||||||
dataSetPreviewPage.setTotal(datasourceProvider.getData(datasourceRequest).size());
|
try {
|
||||||
} catch (Exception e) {
|
data.addAll(datasourceProvider.getData(datasourceRequest));
|
||||||
e.printStackTrace();
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
datasourceRequest.setQuery(qp.createQuerySqlWithLimit(sql, fields, Integer.valueOf(dataSetTableRequest.getRow())));
|
||||||
|
dataSetPreviewPage.setTotal(datasourceProvider.getData(datasourceRequest).size());
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// check doris table
|
||||||
|
if (!checkDorisTableIsExists(dataSetTableRequest.getId())) {
|
||||||
|
throw new RuntimeException(Translator.get("i18n_data_not_sync"));
|
||||||
|
}
|
||||||
|
Datasource ds = (Datasource) CommonBeanFactory.getBean("DorisDatasource");
|
||||||
|
JdbcProvider jdbcProvider = CommonBeanFactory.getBean(JdbcProvider.class);
|
||||||
|
DatasourceRequest datasourceRequest = new DatasourceRequest();
|
||||||
|
datasourceRequest.setDatasource(ds);
|
||||||
|
String table = DorisTableUtils.dorisName(dataSetTableRequest.getId());
|
||||||
|
QueryProvider qp = ProviderFactory.getQueryProvider(ds.getType());
|
||||||
|
datasourceRequest.setQuery(qp.createQuerySQLWithPage(table, fields, page, pageSize, realSize));
|
||||||
|
try {
|
||||||
|
data.addAll(jdbcProvider.getData(datasourceRequest));
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
datasourceRequest.setQuery(qp.createQueryCountSQL(table));
|
||||||
|
dataSetPreviewPage.setTotal(Integer.valueOf(jdbcProvider.getData(datasourceRequest).get(0)[0]));
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (StringUtils.equalsIgnoreCase(datasetTable.getType(), "excel")) {
|
} else if (StringUtils.equalsIgnoreCase(datasetTable.getType(), "excel")) {
|
||||||
if (StringUtils.isEmpty(datasetTable.getSyncStatus()) || datasetTable.getSyncStatus().equalsIgnoreCase(JobStatus.Underway.name())) {
|
if (StringUtils.isEmpty(datasetTable.getSyncStatus()) || datasetTable.getSyncStatus().equalsIgnoreCase(JobStatus.Underway.name())) {
|
||||||
@ -363,7 +412,6 @@ public class DataSetTableService {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (StringUtils.equalsIgnoreCase(datasetTable.getType(), "custom")) {
|
} else if (StringUtils.equalsIgnoreCase(datasetTable.getType(), "custom")) {
|
||||||
Datasource ds = (Datasource) CommonBeanFactory.getBean("DorisDatasource");
|
Datasource ds = (Datasource) CommonBeanFactory.getBean("DorisDatasource");
|
||||||
JdbcProvider jdbcProvider = CommonBeanFactory.getBean(JdbcProvider.class);
|
JdbcProvider jdbcProvider = CommonBeanFactory.getBean(JdbcProvider.class);
|
||||||
|
@ -265,4 +265,5 @@ i18n_schema_is_empty=Database schema is empty
|
|||||||
站内消息=Internal Messages
|
站内消息=Internal Messages
|
||||||
所有消息=All Messages
|
所有消息=All Messages
|
||||||
未读消息=Unread Messages
|
未读消息=Unread Messages
|
||||||
已读消息=Read Messages
|
已读消息=Read Messages
|
||||||
|
i18n_data_not_sync=Please sync data first
|
@ -265,3 +265,4 @@ i18n_schema_is_empty=数据库 Schema 为空
|
|||||||
所有消息=所有消息
|
所有消息=所有消息
|
||||||
未读消息=未读消息
|
未读消息=未读消息
|
||||||
已读消息=已读消息
|
已读消息=已读消息
|
||||||
|
i18n_data_not_sync=请先完成数据同步
|
||||||
|
@ -267,4 +267,5 @@ i18n_schema_is_empty=數據庫 Schema 為空
|
|||||||
站内消息=站內消息
|
站内消息=站內消息
|
||||||
所有消息=所有消息
|
所有消息=所有消息
|
||||||
未读消息=未讀消息
|
未读消息=未讀消息
|
||||||
已读消息=已讀消息
|
已读消息=已讀消息
|
||||||
|
i18n_data_not_sync=請先完成數據同步
|
@ -34,7 +34,7 @@
|
|||||||
<span>{{ $t('chart.content_formatter') }}</span>
|
<span>{{ $t('chart.content_formatter') }}</span>
|
||||||
<el-tooltip class="item" effect="dark" placement="bottom">
|
<el-tooltip class="item" effect="dark" placement="bottom">
|
||||||
<div slot="content">
|
<div slot="content">
|
||||||
字符串支持用 \n 换行<br>字符串模板 模板变量有:<br>{a}:系列名。<br>{b}:数据名。<br>{c}:数据值。<br>{d}:百分比(用于饼图等)。
|
字符串模板 模板变量有:<br>{a}:系列名。<br>{b}:数据名。<br>{c}:数据值。<br>{d}:百分比(用于饼图等)。
|
||||||
</div>
|
</div>
|
||||||
<i class="el-icon-info" style="cursor: pointer;" />
|
<i class="el-icon-info" style="cursor: pointer;" />
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-row style="height: 100%;overflow-y: hidden;width: 100%;">
|
<el-row style="height: 100%;overflow-y: hidden;width: 100%;">
|
||||||
<span v-show="false">{{ tableRefresh }}</span>
|
<!-- <span v-show="false">{{ tableRefresh }}</span>-->
|
||||||
<el-row style="height: 26px;">
|
<el-row style="height: 26px;">
|
||||||
<el-popover
|
<el-popover
|
||||||
placement="right-start"
|
placement="right-start"
|
||||||
@ -94,10 +94,10 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
tableRefresh() {
|
// tableRefresh() {
|
||||||
this.initTable(this.param)
|
// this.initTable(this.param)
|
||||||
return this.$store.state.dataset.table
|
// return this.$store.state.dataset.table
|
||||||
}
|
// }
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
'param': function() {
|
'param': function() {
|
||||||
|
Loading…
Reference in New Issue
Block a user