Merge pull request #12153 from dataease/pr@dev2@fixds

fix: 部分接口请求参数不准确
This commit is contained in:
taojinlong 2024-09-11 15:23:04 +08:00 committed by GitHub
commit 39e267fc2d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 69 additions and 12 deletions

View File

@ -111,6 +111,7 @@ public class DatasourceServer implements DatasourceApi {
public enum UpdateType {
all_scope, add_scope
}
private TypeReference<List<ApiDefinition>> listTypeReference = new TypeReference<List<ApiDefinition>>() {
};
@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<String> getSchema(BusiDsRequest dataSourceDTO) throws DEException {
public List<String> 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);

View File

@ -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 = "校验重复")

View File

@ -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;
}

View File

@ -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;

View File

@ -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;
}