mirror of
https://github.com/CodePhiliaX/Chat2DB.git
synced 2025-07-31 19:52:54 +08:00
Complete the datasource code
This commit is contained in:
@ -198,7 +198,7 @@ public class DataSourceController {
|
||||
@PostMapping("/datasource/create")
|
||||
public DataResult<Long> create(@RequestBody DataSourceCreateRequest request) {
|
||||
DataSourceCreateParam param = dataSourceWebConverter.createReq2param(request);
|
||||
return dataSourceService.create(param);
|
||||
return dataSourceService.createWithPermission(param);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -210,7 +210,7 @@ public class DataSourceController {
|
||||
@RequestMapping(value = "/datasource/update",method = {RequestMethod.POST, RequestMethod.PUT})
|
||||
public ActionResult update(@RequestBody DataSourceUpdateRequest request) {
|
||||
DataSourceUpdateParam param = dataSourceWebConverter.updateReq2param(request);
|
||||
return dataSourceService.update(param);
|
||||
return dataSourceService.updateWithPermission(param);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -232,7 +232,7 @@ public class DataSourceController {
|
||||
*/
|
||||
@DeleteMapping("/datasource/{id}")
|
||||
public ActionResult delete(@PathVariable Long id) {
|
||||
return dataSourceService.delete(id);
|
||||
return dataSourceService.deleteWithPermission(id);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,42 +0,0 @@
|
||||
package ai.chat2db.server.web.api.controller.data.source;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import ai.chat2db.server.tools.base.enums.EnvTypeEnum;
|
||||
import ai.chat2db.server.tools.base.wrapper.result.ListResult;
|
||||
import ai.chat2db.server.web.api.controller.data.source.vo.EnvVO;
|
||||
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 环境打标服务类
|
||||
*
|
||||
* @author moji
|
||||
* @version EnvController.java, v 0.1 2022年09月18日 14:04 moji Exp $
|
||||
* @date 2022/09/18
|
||||
*/
|
||||
@RequestMapping("/api/env")
|
||||
@RestController
|
||||
public class EnvController {
|
||||
|
||||
/**
|
||||
* 查询环境列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public ListResult<EnvVO> list() {
|
||||
List<EnvVO> envVOS = Arrays.stream(EnvTypeEnum.values()).map(envTypeEnum -> {
|
||||
EnvVO envVO = new EnvVO();
|
||||
envVO.setCode(envTypeEnum.getCode());
|
||||
envVO.setName(envTypeEnum.getDescription());
|
||||
return envVO;
|
||||
}).collect(Collectors.toList());
|
||||
return ListResult.of(envVOS);
|
||||
}
|
||||
|
||||
}
|
@ -8,7 +8,6 @@ import jakarta.validation.constraints.NotNull;
|
||||
import ai.chat2db.spi.model.KeyValue;
|
||||
import ai.chat2db.spi.model.SSHInfo;
|
||||
import ai.chat2db.spi.model.SSLInfo;
|
||||
import ai.chat2db.server.tools.base.enums.EnvTypeEnum;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@ -53,12 +52,6 @@ public class DataSourceCreateRequest {
|
||||
@NotNull
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 环境类型
|
||||
* @see EnvTypeEnum
|
||||
*/
|
||||
private String envType;
|
||||
|
||||
/**
|
||||
* host
|
||||
*/
|
||||
@ -106,5 +99,10 @@ public class DataSourceCreateRequest {
|
||||
private DriverConfig driverConfig;
|
||||
|
||||
|
||||
/**
|
||||
* 环境id
|
||||
*/
|
||||
@NotNull
|
||||
private Long environmentId;
|
||||
|
||||
}
|
||||
|
@ -8,7 +8,6 @@ import jakarta.validation.constraints.NotNull;
|
||||
import ai.chat2db.spi.model.KeyValue;
|
||||
import ai.chat2db.spi.model.SSHInfo;
|
||||
import ai.chat2db.spi.model.SSLInfo;
|
||||
import ai.chat2db.server.tools.base.enums.EnvTypeEnum;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
|
Reference in New Issue
Block a user