From c3ba6048a3792cdff1da733b3f3080bc5f4414fd Mon Sep 17 00:00:00 2001 From: qianmoQ Date: Fri, 15 Nov 2024 09:48:43 +0800 Subject: [PATCH] refactor(page): refactor source --> metadata --> table export --- .../server/controller/TableController.java | 6 +- .../datacap/service/service/TableService.java | 3 +- .../service/impl/TableServiceImpl.java | 6 +- .../metadata/components/MetadataSidebar.vue | 31 +++--- .../admin/source/components/ColumnCreate.vue | 6 +- .../admin/source/components/TableCreate.vue | 4 +- .../admin/source/components/TableExport.vue | 97 ++++++++----------- 7 files changed, 71 insertions(+), 82 deletions(-) diff --git a/core/datacap-server/src/main/java/io/edurt/datacap/server/controller/TableController.java b/core/datacap-server/src/main/java/io/edurt/datacap/server/controller/TableController.java index e0952911..4b61617c 100644 --- a/core/datacap-server/src/main/java/io/edurt/datacap/server/controller/TableController.java +++ b/core/datacap-server/src/main/java/io/edurt/datacap/server/controller/TableController.java @@ -44,10 +44,10 @@ public class TableController return this.service.fetchData(code, configure); } - @PostMapping(value = "export/{id}") - public CommonResponse exportDataById(@PathVariable Long id, @RequestBody ExportBody configure) + @PostMapping(value = "export/{code}") + public CommonResponse exportDataByCode(@PathVariable String code, @RequestBody ExportBody configure) { - return this.service.exportDataById(id, configure); + return this.service.exportDataByCode(code, configure); } @GetMapping(value = "dataDownload/{username}/{filename}") diff --git a/core/datacap-service/src/main/java/io/edurt/datacap/service/service/TableService.java b/core/datacap-service/src/main/java/io/edurt/datacap/service/service/TableService.java index 7766bc3c..83d03e99 100644 --- a/core/datacap-service/src/main/java/io/edurt/datacap/service/service/TableService.java +++ b/core/datacap-service/src/main/java/io/edurt/datacap/service/service/TableService.java @@ -19,6 +19,7 @@ public interface TableService */ CommonResponse> getAllByDatabase(String code); + /** * Retrieves data from the database based on the provided ID and table filter. * @@ -35,7 +36,7 @@ public interface TableService * @param configure the export configuration * @return the response containing the exported data */ - CommonResponse exportDataById(Long id, ExportBody configure); + CommonResponse exportDataByCode(String code, ExportBody configure); Object dataDownload(String username, String filename); diff --git a/core/datacap-service/src/main/java/io/edurt/datacap/service/service/impl/TableServiceImpl.java b/core/datacap-service/src/main/java/io/edurt/datacap/service/service/impl/TableServiceImpl.java index 5dff86fc..12062fac 100644 --- a/core/datacap-service/src/main/java/io/edurt/datacap/service/service/impl/TableServiceImpl.java +++ b/core/datacap-service/src/main/java/io/edurt/datacap/service/service/impl/TableServiceImpl.java @@ -135,12 +135,12 @@ public class TableServiceImpl } @Override - public CommonResponse exportDataById(Long id, ExportBody configure) + public CommonResponse exportDataByCode(String code, ExportBody configure) { - TableEntity table = this.repository.findById(id) + TableEntity table = this.repository.findByCode(code) .orElse(null); if (table == null) { - return CommonResponse.failure(String.format("Table [ %s ] not found", id)); + return CommonResponse.failure(String.format("Table [ %s ] not found", code)); } SourceEntity source = table.getDatabase().getSource(); diff --git a/core/datacap-ui/src/views/layouts/metadata/components/MetadataSidebar.vue b/core/datacap-ui/src/views/layouts/metadata/components/MetadataSidebar.vue index 3e483ffd..35d5eb51 100644 --- a/core/datacap-ui/src/views/layouts/metadata/components/MetadataSidebar.vue +++ b/core/datacap-ui/src/views/layouts/metadata/components/MetadataSidebar.vue @@ -42,23 +42,18 @@ + + + +
+ + {{ $t('source.common.exportData') }} +
+
+
- - - - - - - - - - - - - - @@ -88,7 +83,11 @@ :info="dataInfo" @close="visibleCreateColumn(false)"/> - + + @@ -255,7 +254,7 @@ export default defineComponent({ { this.columnCreateVisible = opened }, - handlerExportData(opened: boolean) + visibleExportData(opened: boolean) { this.tableExportVisible = opened }, diff --git a/core/datacap-ui/src/views/pages/admin/source/components/ColumnCreate.vue b/core/datacap-ui/src/views/pages/admin/source/components/ColumnCreate.vue index 8c0b0f4b..846e64b4 100644 --- a/core/datacap-ui/src/views/pages/admin/source/components/ColumnCreate.vue +++ b/core/datacap-ui/src/views/pages/admin/source/components/ColumnCreate.vue @@ -1,4 +1,4 @@ - diff --git a/core/datacap-ui/src/views/pages/admin/source/components/TableExport.vue b/core/datacap-ui/src/views/pages/admin/source/components/TableExport.vue index 64ebc95d..167d4691 100644 --- a/core/datacap-ui/src/views/pages/admin/source/components/TableExport.vue +++ b/core/datacap-ui/src/views/pages/admin/source/components/TableExport.vue @@ -1,51 +1,38 @@