diff --git a/core/core-backend/src/main/java/io/dataease/datasource/provider/CalciteProvider.java b/core/core-backend/src/main/java/io/dataease/datasource/provider/CalciteProvider.java index 3dad5cc9bd..bae30ca71d 100644 --- a/core/core-backend/src/main/java/io/dataease/datasource/provider/CalciteProvider.java +++ b/core/core-backend/src/main/java/io/dataease/datasource/provider/CalciteProvider.java @@ -117,7 +117,7 @@ public class CalciteProvider { tableDesc.setDatasourceId(datasourceRequest.getDatasource().getId()); tableDesc.setType("db"); tableDesc.setTableName(resultSet.getString(1)); - tableDesc.setName(resultSet.getString(1)); + tableDesc.setName(resultSet.getString(2)); return tableDesc; } @@ -315,6 +315,7 @@ public class CalciteProvider { private String getTableFiledSql(DatasourceRequest datasourceRequest) { String sql = ""; DatasourceConfiguration configuration = null; + String database=""; DatasourceType datasourceType = DatasourceType.valueOf(datasourceRequest.getDatasource().getType()); switch (datasourceType) { case mysql: @@ -324,7 +325,16 @@ public class CalciteProvider { case StarRocks: case doris: configuration = JsonUtil.parseObject(datasourceRequest.getDatasource().getConfiguration(), Mysql.class); - sql = String.format("SELECT COLUMN_NAME,DATA_TYPE,COLUMN_COMMENT FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = '%s' AND TABLE_NAME = '%s'", configuration.getDataBase(), datasourceRequest.getTable()); + if (configuration.getUrlType().equalsIgnoreCase("")) { + database = configuration.getDataBase(); + } else { + Pattern WITH_SQL_FRAGMENT = Pattern.compile("jdbc:mysql://(.*):(\\d+)/(.*)"); + Matcher matcher = WITH_SQL_FRAGMENT.matcher(configuration.getJdbcUrl()); + matcher.find(); + String[] databasePrams = matcher.group(3).split("\\?"); + database = databasePrams[0]; + } + sql = String.format("SELECT COLUMN_NAME,DATA_TYPE,COLUMN_COMMENT FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = '%s' AND TABLE_NAME = '%s'", database, datasourceRequest.getTable()); break; case oracle: configuration = JsonUtil.parseObject(datasourceRequest.getDatasource().getConfiguration(), Oracle.class); @@ -396,6 +406,16 @@ public class CalciteProvider { break; case ck: configuration = JsonUtil.parseObject(datasourceRequest.getDatasource().getConfiguration(), CK.class); + + if (configuration.getUrlType().equalsIgnoreCase("")) { + database = configuration.getDataBase(); + } else { + Pattern WITH_SQL_FRAGMENT = Pattern.compile("jdbc:clickhouse://(.*):(\\d+)/(.*)"); + Matcher matcher = WITH_SQL_FRAGMENT.matcher(configuration.getJdbcUrl()); + matcher.find(); + String[] databasePrams = matcher.group(3).split("\\?"); + database = databasePrams[0]; + } sql = String.format(" SELECT\n" + " name,\n" + " type,\n" + @@ -404,7 +424,7 @@ public class CalciteProvider { " system.columns\n" + "WHERE\n" + " database = '%s' \n" + - " AND table = '%s' ", configuration.getDataBase(), datasourceRequest.getTable()); + " AND table = '%s' ", database, datasourceRequest.getTable()); break; case impala: sql = String.format("DESCRIBE `%s`", datasourceRequest.getTable()); diff --git a/core/core-frontend/src/locales/zh-CN.ts b/core/core-frontend/src/locales/zh-CN.ts index 6cb595fa1c..9646d060cb 100644 --- a/core/core-frontend/src/locales/zh-CN.ts +++ b/core/core-frontend/src/locales/zh-CN.ts @@ -249,7 +249,7 @@ export default { remark: '备注', column_name: '字段名', field_type: '字段类型', - field_description: '字段描述', + field_description: '字段备注', dl: '数据湖', other: '其他', local_file: '本地文件', @@ -393,7 +393,7 @@ export default { no_data_table: '暂无数据表', on_the_left: '请在左侧选择数据源', create_dataset: '创建数据集', - table_description: '表描述', + table_description: '表备注', relational_database: '关系型数据库', data_warehouse_lake: '数仓/数据湖', non_relational_database: '非关系型数据库', diff --git a/core/core-frontend/src/views/visualized/data/datasource/index.vue b/core/core-frontend/src/views/visualized/data/datasource/index.vue index 9d3b907904..501e0d0cba 100644 --- a/core/core-frontend/src/views/visualized/data/datasource/index.vue +++ b/core/core-frontend/src/views/visualized/data/datasource/index.vue @@ -91,7 +91,7 @@ const { width, node } = useMoveLine('DATASOURCE') const dsTableDetail = reactive({ tableName: '', - remark: '' + name: '' }) const rootManage = ref(false) const nickName = ref('') @@ -1356,7 +1356,7 @@ const getMenuList = (val: boolean) => { {{ t('datasource.table_description') }}
- {{ dsTableDetail.remark || '-' }} + {{ dsTableDetail.name || '-' }}