From 0f67e4a17ade38f245276ebb6ee8ef433cb7b31c Mon Sep 17 00:00:00 2001 From: taojinlong Date: Wed, 11 Sep 2024 15:22:22 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E9=83=A8=E5=88=86=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E8=AF=B7=E6=B1=82=E5=8F=82=E6=95=B0=E4=B8=8D=E5=87=86=E7=A1=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../datasource/server/DatasourceServer.java | 11 ++++--- .../io/dataease/api/ds/DatasourceApi.java | 12 +++----- .../api/ds/vo/BusiCreateFolderRequest.java | 30 +++++++++++++++++++ .../io/dataease/api/ds/vo/BusiDsRequest.java | 2 ++ .../dataease/api/ds/vo/BusiRenameRequest.java | 26 ++++++++++++++++ 5 files changed, 69 insertions(+), 12 deletions(-) create mode 100644 sdk/api/api-base/src/main/java/io/dataease/api/ds/vo/BusiCreateFolderRequest.java create mode 100644 sdk/api/api-base/src/main/java/io/dataease/api/ds/vo/BusiRenameRequest.java diff --git a/core/core-backend/src/main/java/io/dataease/datasource/server/DatasourceServer.java b/core/core-backend/src/main/java/io/dataease/datasource/server/DatasourceServer.java index b2ea0cf6d5..123bbe5362 100644 --- a/core/core-backend/src/main/java/io/dataease/datasource/server/DatasourceServer.java +++ b/core/core-backend/src/main/java/io/dataease/datasource/server/DatasourceServer.java @@ -111,6 +111,7 @@ public class DatasourceServer implements DatasourceApi { public enum UpdateType { all_scope, add_scope } + private TypeReference> listTypeReference = new TypeReference>() { }; @Resource @@ -178,7 +179,7 @@ public class DatasourceServer implements DatasourceApi { @DeLog(id = "#p0.id", ot = LogOT.MODIFY, st = LogST.DATASOURCE) @Transactional - public DatasourceDTO move(BusiDsRequest busiDsRequest) { + public DatasourceDTO move(BusiCreateFolderRequest busiDsRequest) { DatasourceDTO dataSourceDTO = new DatasourceDTO(); BeanUtils.copyBean(dataSourceDTO, busiDsRequest); if (dataSourceDTO.getPid() == null) { @@ -199,7 +200,7 @@ public class DatasourceServer implements DatasourceApi { } @Transactional - public DatasourceDTO reName(BusiDsRequest busiDsRequest) { + public DatasourceDTO reName(BusiRenameRequest busiDsRequest) { DatasourceDTO dataSourceDTO = new DatasourceDTO(); BeanUtils.copyBean(dataSourceDTO, busiDsRequest); if (StringUtils.isEmpty(dataSourceDTO.getName())) { @@ -214,7 +215,7 @@ public class DatasourceServer implements DatasourceApi { @DeLog(id = "#p0.id", pid = "#p0.pid", ot = LogOT.CREATE, st = LogST.DATASOURCE) @Transactional - public DatasourceDTO createFolder(BusiDsRequest busiDsRequest) { + public DatasourceDTO createFolder(BusiCreateFolderRequest busiDsRequest) { DatasourceDTO dataSourceDTO = new DatasourceDTO(); BeanUtils.copyBean(dataSourceDTO, busiDsRequest); dataSourceDTO.setCreateTime(System.currentTimeMillis()); @@ -459,7 +460,9 @@ public class DatasourceServer implements DatasourceApi { } @Override - public List getSchema(BusiDsRequest dataSourceDTO) throws DEException { + public List getSchema(BusiDsRequest busiDsRequest) throws DEException { + DatasourceDTO dataSourceDTO = new DatasourceDTO(); + BeanUtils.copyBean(dataSourceDTO, busiDsRequest); dataSourceDTO.setConfiguration(new String(Base64.getDecoder().decode(dataSourceDTO.getConfiguration()))); CoreDatasource coreDatasource = new CoreDatasource(); BeanUtils.copyBean(coreDatasource, dataSourceDTO); diff --git a/sdk/api/api-base/src/main/java/io/dataease/api/ds/DatasourceApi.java b/sdk/api/api-base/src/main/java/io/dataease/api/ds/DatasourceApi.java index cec95f29d2..e3489db647 100644 --- a/sdk/api/api-base/src/main/java/io/dataease/api/ds/DatasourceApi.java +++ b/sdk/api/api-base/src/main/java/io/dataease/api/ds/DatasourceApi.java @@ -2,10 +2,7 @@ package io.dataease.api.ds; import com.baomidou.mybatisplus.core.metadata.IPage; import com.github.xiaoymin.knife4j.annotations.ApiSupport; -import io.dataease.api.ds.vo.ApiDefinition; -import io.dataease.api.ds.vo.BusiDsRequest; -import io.dataease.api.ds.vo.CoreDatasourceTaskLogDTO; -import io.dataease.api.ds.vo.ExcelFileData; +import io.dataease.api.ds.vo.*; import io.dataease.auth.DeApiPath; import io.dataease.auth.DePermit; import io.dataease.exception.DEException; @@ -47,18 +44,17 @@ public interface DatasourceApi { @Operation(summary = "更新") DatasourceDTO update(@RequestBody BusiDsRequest dataSourceDTO) throws DEException; - @PostMapping("/move") @Operation(summary = "移动") - DatasourceDTO move(@RequestBody BusiDsRequest dataSourceDTO) throws DEException; + DatasourceDTO move(@RequestBody BusiCreateFolderRequest dataSourceDTO) throws DEException; @PostMapping("/reName") @Operation(summary = "重命名") - DatasourceDTO reName(@RequestBody BusiDsRequest dataSourceDTO) throws DEException; + DatasourceDTO reName(@RequestBody BusiRenameRequest dataSourceDTO) throws DEException; @PostMapping("/createFolder") @Operation(summary = "新建文件夹") - DatasourceDTO createFolder(@RequestBody BusiDsRequest dataSourceDTO) throws DEException; + DatasourceDTO createFolder(@RequestBody BusiCreateFolderRequest dataSourceDTO) throws DEException; @PostMapping("/checkRepeat") @Operation(summary = "校验重复") diff --git a/sdk/api/api-base/src/main/java/io/dataease/api/ds/vo/BusiCreateFolderRequest.java b/sdk/api/api-base/src/main/java/io/dataease/api/ds/vo/BusiCreateFolderRequest.java new file mode 100644 index 0000000000..e841ba3cc0 --- /dev/null +++ b/sdk/api/api-base/src/main/java/io/dataease/api/ds/vo/BusiCreateFolderRequest.java @@ -0,0 +1,30 @@ +package io.dataease.api.ds.vo; + +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import io.dataease.extensions.datasource.dto.TaskDTO; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serial; +import java.io.Serializable; + +@Data +public class BusiCreateFolderRequest implements Serializable { + @Serial + private static final long serialVersionUID = 1175287571828910222L; + + @JsonSerialize(using= ToStringSerializer.class) + private Long id; + + @JsonSerialize(using= ToStringSerializer.class) + @Schema(description = "父ID", requiredMode = Schema.RequiredMode.REQUIRED) + private Long pid; + @Schema(description = "名称", requiredMode = Schema.RequiredMode.REQUIRED) + private String name; + @Schema(description = "节点类型", requiredMode = Schema.RequiredMode.REQUIRED) + private String nodeType; + @Schema(description = "操作类型", requiredMode = Schema.RequiredMode.REQUIRED) + private String action; + +} diff --git a/sdk/api/api-base/src/main/java/io/dataease/api/ds/vo/BusiDsRequest.java b/sdk/api/api-base/src/main/java/io/dataease/api/ds/vo/BusiDsRequest.java index 3120d6b76a..77b6cae94a 100644 --- a/sdk/api/api-base/src/main/java/io/dataease/api/ds/vo/BusiDsRequest.java +++ b/sdk/api/api-base/src/main/java/io/dataease/api/ds/vo/BusiDsRequest.java @@ -27,10 +27,12 @@ public class BusiDsRequest implements Serializable { @Schema(description = "操作类型", requiredMode = Schema.RequiredMode.REQUIRED) private String action; private String description; + @Schema(description = "数据源类型", requiredMode = Schema.RequiredMode.REQUIRED) private String type; private String typeAlias; private String catalog; private String catalogDesc; + @Schema(description = "详细信息", requiredMode = Schema.RequiredMode.REQUIRED) private String configuration; private String apiConfigurationStr; private String paramsStr; diff --git a/sdk/api/api-base/src/main/java/io/dataease/api/ds/vo/BusiRenameRequest.java b/sdk/api/api-base/src/main/java/io/dataease/api/ds/vo/BusiRenameRequest.java new file mode 100644 index 0000000000..9af92f2298 --- /dev/null +++ b/sdk/api/api-base/src/main/java/io/dataease/api/ds/vo/BusiRenameRequest.java @@ -0,0 +1,26 @@ +package io.dataease.api.ds.vo; + +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serial; +import java.io.Serializable; + +@Data +public class BusiRenameRequest implements Serializable { + @Serial + private static final long serialVersionUID = 1175287571828910222L; + + @JsonSerialize(using= ToStringSerializer.class) + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED) + private Long id; + @Schema(description = "名称", requiredMode = Schema.RequiredMode.REQUIRED) + private String name; + @Schema(description = "节点类型", requiredMode = Schema.RequiredMode.REQUIRED) + private String nodeType; + @Schema(description = "操作类型", requiredMode = Schema.RequiredMode.REQUIRED) + private String action; + +}