diff --git a/backend/src/main/java/io/dataease/service/dataset/DataSetTableService.java b/backend/src/main/java/io/dataease/service/dataset/DataSetTableService.java index 56d212fcc9..c0355a9e63 100644 --- a/backend/src/main/java/io/dataease/service/dataset/DataSetTableService.java +++ b/backend/src/main/java/io/dataease/service/dataset/DataSetTableService.java @@ -483,7 +483,14 @@ public class DataSetTableService { Map customInfo = new TreeMap<>(); dataTableInfoDTO.getList().forEach(ele -> { String table = DorisTableUtils.dorisName(ele.getTableId()); + DatasetTable datasetTable = datasetTableMapper.selectByPrimaryKey(ele.getTableId()); + if (ObjectUtils.isEmpty(datasetTable)) { + throw new RuntimeException(Translator.get("i18n_custom_ds_delete")); + } List fields = dataSetTableFieldsService.getListByIdsEach(ele.getCheckedFields()); + if (CollectionUtils.isEmpty(fields)) { + throw new RuntimeException(Translator.get("i18n_cst_ds_tb_or_field_deleted")); + } String[] array = fields.stream().map(f -> table + "." + f.getDataeaseName() + " AS " + DorisTableUtils.dorisFieldName(ele.getTableId() + "_" + f.getDataeaseName())).toArray(String[]::new); customInfo.put(table, array); }); @@ -567,7 +574,7 @@ public class DataSetTableService { List list = dataTableInfoDTO.getList(); List fieldList = new ArrayList<>(); list.forEach(ele -> { - List listByIds = dataSetTableFieldsService.getListByIds(ele.getCheckedFields()); + List listByIds = dataSetTableFieldsService.getListByIdsEach(ele.getCheckedFields()); listByIds.forEach(f -> { f.setDataeaseName(DorisTableUtils.dorisFieldName(ele.getTableId() + "_" + f.getDataeaseName())); }); @@ -665,7 +672,7 @@ public class DataSetTableService { } - public void saveIncrementalConfig(DatasetTableIncrementalConfig datasetTableIncrementalConfig) throws Exception{ + public void saveIncrementalConfig(DatasetTableIncrementalConfig datasetTableIncrementalConfig) throws Exception { if (datasetTableIncrementalConfig == null || StringUtils.isEmpty(datasetTableIncrementalConfig.getTableId())) { return; } @@ -700,11 +707,11 @@ public class DataSetTableService { .replace(currentUpdateTime, Long.valueOf(System.currentTimeMillis()).toString()); datasourceRequest.setQuery(sql); List sqlFileds = new ArrayList<>(); - datasourceProvider.fetchResultField(datasourceRequest).stream().map(TableFiled::getFieldName).forEach(filed ->{ + datasourceProvider.fetchResultField(datasourceRequest).stream().map(TableFiled::getFieldName).forEach(filed -> { sqlFileds.add(filed); }); sort(sqlFileds); - if(!originNameFileds.equals(sqlFileds)){ + if (!originNameFileds.equals(sqlFileds)) { throw new Exception(Translator.get("i18n_sql_add_not_matching") + sqlFileds.toString()); } } @@ -713,17 +720,17 @@ public class DataSetTableService { .replace(currentUpdateTime, Long.valueOf(System.currentTimeMillis()).toString()); datasourceRequest.setQuery(sql); List sqlFileds = new ArrayList<>(); - datasourceProvider.fetchResultField(datasourceRequest).stream().map(TableFiled::getFieldName).forEach(filed ->{ + datasourceProvider.fetchResultField(datasourceRequest).stream().map(TableFiled::getFieldName).forEach(filed -> { sqlFileds.add(filed); }); sort(sqlFileds); - if(!originNameFileds.equals(sqlFileds)){ + if (!originNameFileds.equals(sqlFileds)) { throw new Exception(Translator.get("i18n_sql_delete_not_matching") + sqlFileds.toString()); } } } - private void sort(List sqlFileds){ + private void sort(List sqlFileds) { sqlFileds.sort((o1, o2) -> { if (o1 == null) { return -1; @@ -734,6 +741,7 @@ public class DataSetTableService { return o1.compareTo(o2); }); } + private void checkName(DatasetTable datasetTable) { // if (StringUtils.isEmpty(datasetTable.getId()) && StringUtils.equalsIgnoreCase("db", datasetTable.getType())) { // return; diff --git a/backend/src/main/resources/i18n/messages_en_US.properties b/backend/src/main/resources/i18n/messages_en_US.properties index bcd8d9a172..00e10352c2 100644 --- a/backend/src/main/resources/i18n/messages_en_US.properties +++ b/backend/src/main/resources/i18n/messages_en_US.properties @@ -256,4 +256,5 @@ i18n_not_exec_add_sync=There is no completed synchronization task. Incremental s i18n_excel_header_empty=Excel first row can not empty i18n_custom_ds_delete=Custom dataset union data is deleted,can not display i18n_sql_add_not_matching=The data column of incremental SQL does not match the dataset, -i18n_sql_delete_not_matching=The data column of incremental delete SQL does not match the dataset, \ No newline at end of file +i18n_sql_delete_not_matching=The data column of incremental delete SQL does not match the dataset, +i18n_cst_ds_tb_or_field_deleted=Custom dataset union data is deleted or field changed,can not display \ No newline at end of file diff --git a/backend/src/main/resources/i18n/messages_zh_CN.properties b/backend/src/main/resources/i18n/messages_zh_CN.properties index 0d7141b769..2fdd59a2ce 100644 --- a/backend/src/main/resources/i18n/messages_zh_CN.properties +++ b/backend/src/main/resources/i18n/messages_zh_CN.properties @@ -257,4 +257,5 @@ i18n_excel_header_empty=Excel第一行为空 i18n_custom_ds_delete=自定义数据集所关联数据被删除,无法正常显示 i18n_sql_add_not_matching=增量添加 sql 的数据列与数据集不匹配, i18n_sql_delete_not_matching=增量删除 sql 的数据列与数据集不匹配, +i18n_cst_ds_tb_or_field_deleted=自定义数据集所关联数据被删除或字段发生变化,无法正常显示 diff --git a/backend/src/main/resources/i18n/messages_zh_TW.properties b/backend/src/main/resources/i18n/messages_zh_TW.properties index 42a79e08ed..11784fa831 100644 --- a/backend/src/main/resources/i18n/messages_zh_TW.properties +++ b/backend/src/main/resources/i18n/messages_zh_TW.properties @@ -258,4 +258,5 @@ i18n_not_exec_add_sync=沒有已經完成的同步任務,無法進行增量同 i18n_excel_header_empty=Excel第一行為空 i18n_custom_ds_delete=自定義數據集所關聯數據被刪除,無法正常顯示 i18n_sql_add_not_matching=增量添加 sql 的數據列與數據集不匹配, -i18n_sql_delete_not_matching=增量刪除 sql 的數據列與數據集不匹配, \ No newline at end of file +i18n_sql_delete_not_matching=增量刪除 sql 的數據列與數據集不匹配, +i18n_cst_ds_tb_or_field_deleted=自定義數據集所關聯數據被刪除或字段發生變化,無法正常顯示 \ No newline at end of file diff --git a/frontend/src/layout/components/Topbar.vue b/frontend/src/layout/components/Topbar.vue index 56993f6b4a..8826e2dfef 100644 --- a/frontend/src/layout/components/Topbar.vue +++ b/frontend/src/layout/components/Topbar.vue @@ -9,7 +9,7 @@ :active-text-color="variables.topMenuActiveText" :default-active="activeMenu" mode="horizontal" - :style="{'background-color': '#f1f3f8'}" + :style="{'background-color': '#f1f3f8', 'margin-left': '260px', 'position': 'absolute'}" @select="handleSelect" >