|
|
@@ -2,16 +2,16 @@ package cn.seecoder.web.controller.sql;
|
|
|
|
|
|
import cn.seecoder.common.exceptions.ServiceException;
|
|
|
import cn.seecoder.web.model.vo.Response;
|
|
|
+import cn.seecoder.web.model.vo.sql.DBInstanceVO;
|
|
|
import cn.seecoder.web.model.vo.sql.SqlExecVO;
|
|
|
import cn.seecoder.web.service.sql.SqlService;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiImplicitParam;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.web.bind.annotation.PostMapping;
|
|
|
-import org.springframework.web.bind.annotation.RequestBody;
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
|
|
|
/**
|
|
|
* @author Chenyz
|
|
|
@@ -33,6 +33,13 @@ public class SqlController {
|
|
|
this.sqlService = sqlService;
|
|
|
}
|
|
|
|
|
|
+ @ApiOperation(value = "获取当前项目的数据库实例", httpMethod = "GET")
|
|
|
+ @GetMapping("/instances")
|
|
|
+ @ApiImplicitParam(name = "projectCreateVO",dataType = "int", paramType = "query")
|
|
|
+ public Response<List<DBInstanceVO>> dbInstances(@RequestParam("projectId") Integer projectId) throws ServiceException {
|
|
|
+ return Response.buildSuccess(sqlService.getDbInstances(projectId));
|
|
|
+ }
|
|
|
+
|
|
|
@ApiOperation(value = "执行sql", httpMethod = "POST")
|
|
|
@PostMapping("/exec")
|
|
|
@ApiImplicitParam(name = "projectCreateVO",dataType = "object", paramType = "body")
|