Merge remote-tracking branch 'origin/master'
# Conflicts: # test-test/src/main/java/com/test/test/service/ITestCaseService.java # test-test/src/main/java/com/test/test/service/impl/TestCaseServiceImpl.java
This commit is contained in:
@@ -61,9 +61,6 @@
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<version>2.5.15</version>
|
||||
<configuration>
|
||||
<fork>true</fork> <!-- 如果没有该配置,devtools不会生效 -->
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
|
||||
@@ -14,12 +14,9 @@ import com.test.common.enums.BusinessType;
|
||||
import com.test.test.domain.TestApi;
|
||||
import com.test.test.service.ITestApiService;
|
||||
import com.test.common.core.page.TableDataInfo;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
/**
|
||||
* 接口Controller
|
||||
*
|
||||
* @author xiaoe
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/test/api")
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
package com.test.test.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.test.common.utils.DateUtils;
|
||||
import com.test.test.domain.qo.IDQO;
|
||||
import com.test.test.domain.qo.TestCaseListQO;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
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 com.test.common.annotation.Log;
|
||||
import com.test.common.core.controller.BaseController;
|
||||
import com.test.common.core.domain.AjaxResult;
|
||||
import com.test.common.enums.BusinessType;
|
||||
import com.test.test.domain.TestCase;
|
||||
import com.test.test.service.ITestCaseService;
|
||||
import com.test.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 用例Controller
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/test/case")
|
||||
public class TestCaseController extends BaseController {
|
||||
@Resource
|
||||
private ITestCaseService testCaseService;
|
||||
|
||||
/**
|
||||
* 查询用例列表
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(@Validated TestCaseListQO qo) {
|
||||
startPage();
|
||||
List<TestCase> list = testCaseService.selectTestCaseList(qo);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用例详细信息
|
||||
*/
|
||||
@PostMapping(value = "/detail")
|
||||
public AjaxResult getInfo(@RequestBody IDQO qo) {
|
||||
return success(testCaseService.selectTestCaseById(qo.getId()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增用例
|
||||
*/
|
||||
@Log(title = "用例", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/add")
|
||||
public AjaxResult add(@RequestBody TestCase testCase) {
|
||||
testCase.setCreateBy(getLoginUser().getUsername());
|
||||
testCase.setCreateTime(DateUtils.getNowDate());
|
||||
testCase.setStatus(1L);
|
||||
return toAjax(testCaseService.insertTestCase(testCase));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用例
|
||||
*/
|
||||
@Log(title = "用例", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/edit")
|
||||
public AjaxResult edit(@RequestBody TestCase testCase) {
|
||||
return toAjax(testCaseService.updateTestCase(testCase));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除用例
|
||||
*/
|
||||
@Log(title = "用例", businessType = BusinessType.DELETE)
|
||||
@PostMapping("/del")
|
||||
public AjaxResult remove(@RequestBody IDQO qo) {
|
||||
return toAjax(testCaseService.deleteTestCaseById(qo.getId()));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
package com.test.test.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.test.test.domain.qo.IDQO;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
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 com.test.common.annotation.Log;
|
||||
import com.test.common.core.controller.BaseController;
|
||||
import com.test.common.core.domain.AjaxResult;
|
||||
import com.test.common.enums.BusinessType;
|
||||
import com.test.test.domain.TestDatasource;
|
||||
import com.test.test.service.ITestDatasourceService;
|
||||
|
||||
/**
|
||||
* 数据源Controller
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/test/datasource")
|
||||
public class TestDatasourceController extends BaseController {
|
||||
@Resource
|
||||
private ITestDatasourceService testDatasourceService;
|
||||
|
||||
/**
|
||||
* 查询数据源列表
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public AjaxResult list() {
|
||||
List<TestDatasource> list = testDatasourceService.selectTestDatasourceList();
|
||||
return success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取数据源详细信息
|
||||
*/
|
||||
@PostMapping(value = "/detail")
|
||||
public AjaxResult getInfo(@RequestBody IDQO qo) {
|
||||
return success(testDatasourceService.selectTestDatasourceById(qo.getId()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增数据源
|
||||
*/
|
||||
@Log(title = "数据源", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/add")
|
||||
public AjaxResult add(@RequestBody TestDatasource testDatasource) {
|
||||
return success(testDatasourceService.insertTestDatasource(testDatasource));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改数据源
|
||||
*/
|
||||
@Log(title = "数据源", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/edit")
|
||||
public AjaxResult edit(@RequestBody TestDatasource testDatasource) {
|
||||
return toAjax(testDatasourceService.updateTestDatasource(testDatasource));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据源
|
||||
*/
|
||||
@Log(title = "数据源", businessType = BusinessType.DELETE)
|
||||
@PostMapping("/del")
|
||||
public AjaxResult remove(@RequestBody IDQO qo) {
|
||||
return toAjax(testDatasourceService.deleteTestDatasourceById(qo.getId()));
|
||||
}
|
||||
}
|
||||
@@ -11,8 +11,6 @@ import jakarta.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/test/group")
|
||||
public class TestGroupController extends BaseController {
|
||||
@@ -20,36 +18,35 @@ public class TestGroupController extends BaseController {
|
||||
private ITestGroupService testGroupService;
|
||||
|
||||
/**
|
||||
* 查询接口节点列表
|
||||
* 查询节点列表
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public AjaxResult list(String type) {
|
||||
List<TestGroup> list = testGroupService.selectTestGroupList(type);
|
||||
return success(list);
|
||||
return success(testGroupService.selectTestGroupList(type));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增接口节点
|
||||
* 新增节点
|
||||
*/
|
||||
@Log(title = "接口节点", businessType = BusinessType.INSERT)
|
||||
@Log(title = "节点", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/add")
|
||||
public AjaxResult add(@RequestBody TestGroup testGroup) {
|
||||
return success(testGroupService.insertTestGroup(testGroup));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改接口节点
|
||||
* 修改节点
|
||||
*/
|
||||
@Log(title = "接口节点", businessType = BusinessType.UPDATE)
|
||||
@Log(title = "节点", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/edit")
|
||||
public AjaxResult edit(@RequestBody TestGroup testGroup) {
|
||||
return toAjax(testGroupService.updateTestGroup(testGroup));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除接口节点
|
||||
* 删除节点
|
||||
*/
|
||||
@Log(title = "接口节点", businessType = BusinessType.DELETE)
|
||||
@Log(title = "节点", businessType = BusinessType.DELETE)
|
||||
@PostMapping("/del")
|
||||
public AjaxResult remove(@RequestBody @Validated GroupDelectQO qo) throws Exception {
|
||||
return toAjax(testGroupService.deleteTestGroupById(qo));
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
package com.test.test.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.test.test.domain.qo.IDQO;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
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 com.test.common.annotation.Log;
|
||||
import com.test.common.core.controller.BaseController;
|
||||
import com.test.common.core.domain.AjaxResult;
|
||||
import com.test.common.enums.BusinessType;
|
||||
import com.test.test.domain.TestHttp;
|
||||
import com.test.test.service.ITestHttpService;
|
||||
|
||||
/**
|
||||
* http服务Controller
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/test/http")
|
||||
public class TestHttpController extends BaseController {
|
||||
@Resource
|
||||
private ITestHttpService testHttpService;
|
||||
|
||||
/**
|
||||
* 查询http服务列表
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public AjaxResult list() {
|
||||
return success(testHttpService.selectTestHttpList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取http服务详细信息
|
||||
*/
|
||||
@PostMapping(value = "/detail")
|
||||
public AjaxResult getInfo(@RequestBody IDQO qo) {
|
||||
return success(testHttpService.selectTestHttpById(qo.getId()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增http服务
|
||||
*/
|
||||
@Log(title = "http服务", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/add")
|
||||
public AjaxResult add(@RequestBody TestHttp testHttp) {
|
||||
return success(testHttpService.insertTestHttp(testHttp));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改http服务
|
||||
*/
|
||||
@Log(title = "http服务", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/edit")
|
||||
public AjaxResult edit(@RequestBody TestHttp testHttp) {
|
||||
return toAjax(testHttpService.updateTestHttp(testHttp));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除http服务
|
||||
*/
|
||||
@Log(title = "http服务", businessType = BusinessType.DELETE)
|
||||
@PostMapping("/del")
|
||||
public AjaxResult remove(@RequestBody IDQO qo) {
|
||||
return toAjax(testHttpService.deleteTestHttpById(qo.getId()));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
package com.test.test.domain;
|
||||
|
||||
import com.test.common.core.domain.BaseEntity;
|
||||
import com.test.common.annotation.Excel;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
||||
/**
|
||||
* 数据源对象 test_datasource
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
public class TestDatasource extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 数据源id
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 数据源名称
|
||||
*/
|
||||
@Excel(name = "数据源名称")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 数据源类型(Mysql:1,redis:2,Oracle:3,MongoDB:4,SQL Server:5,PostgreSQL:6)
|
||||
*/
|
||||
@Excel(name = "数据源类型(Mysql:1,redis:2,Oracle:3,MongoDB:4,SQL Server:5,PostgreSQL:6)")
|
||||
private Long type;
|
||||
|
||||
/**
|
||||
* 主机
|
||||
*/
|
||||
@Excel(name = "主机")
|
||||
private String host;
|
||||
|
||||
/**
|
||||
* 端口
|
||||
*/
|
||||
@Excel(name = "端口")
|
||||
private String port;
|
||||
|
||||
/**
|
||||
* 用户名
|
||||
*/
|
||||
@Excel(name = "用户名")
|
||||
private String username;
|
||||
|
||||
/**
|
||||
* 密码
|
||||
*/
|
||||
@Excel(name = "密码")
|
||||
private String password;
|
||||
|
||||
/**
|
||||
* 库名(Oracle服务名)
|
||||
*/
|
||||
@Excel(name = "库名", readConverterExp = "O=racle服务名")
|
||||
private String dbName;
|
||||
|
||||
/**
|
||||
* mongo认证库名
|
||||
*/
|
||||
@Excel(name = "mongo认证库名")
|
||||
private String authDb;
|
||||
|
||||
/**
|
||||
* redis集群模式
|
||||
*/
|
||||
@Excel(name = "redis集群模式")
|
||||
private Integer cluster;
|
||||
|
||||
/**
|
||||
* redis哨兵模式下输入MasterName
|
||||
*/
|
||||
@Excel(name = "redis哨兵模式下输入MasterName")
|
||||
private String masterName;
|
||||
|
||||
/**
|
||||
* 删除标志(0代表存在 2代表删除)
|
||||
*/
|
||||
private String delFlag;
|
||||
}
|
||||
58
test-test/src/main/java/com/test/test/domain/TestHttp.java
Normal file
58
test-test/src/main/java/com/test/test/domain/TestHttp.java
Normal file
@@ -0,0 +1,58 @@
|
||||
package com.test.test.domain;
|
||||
|
||||
import com.test.common.annotation.Excel;
|
||||
import com.test.common.core.domain.BaseEntity;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
public class TestHttp extends BaseEntity {
|
||||
/**
|
||||
* 服务id
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 服务名
|
||||
*/
|
||||
@Excel(name = "服务名")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 协议(http, https)
|
||||
*/
|
||||
@Excel(name = "协议(http, https)")
|
||||
private String protocol;
|
||||
|
||||
/**
|
||||
* 主机
|
||||
*/
|
||||
@Excel(name = "主机")
|
||||
private String host;
|
||||
|
||||
/**
|
||||
* 端口
|
||||
*/
|
||||
@Excel(name = "端口")
|
||||
private String port;
|
||||
|
||||
/**
|
||||
* 前置路径
|
||||
*/
|
||||
@Excel(name = "前置路径")
|
||||
private String basePath;
|
||||
|
||||
/**
|
||||
* 请求头
|
||||
*/
|
||||
@Excel(name = "请求头")
|
||||
private String header;
|
||||
|
||||
/**
|
||||
* 删除标志(0代表存在 2代表删除)
|
||||
*/
|
||||
private String delFlag;
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
package com.test.test.domain.dto;
|
||||
|
||||
public class SwaggerInfo {
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.test.test.domain.qo;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class TestCaseListQO {
|
||||
@NotNull(message = "父节点id不能为空")
|
||||
private Long groupId;
|
||||
}
|
||||
@@ -1,62 +1,42 @@
|
||||
package com.test.test.mapper;
|
||||
|
||||
import com.test.test.domain.TestCase;
|
||||
import com.test.test.domain.qo.TestCaseListQO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用例Mapper接口
|
||||
*
|
||||
* @author test
|
||||
* @date 2025-02-18
|
||||
*/
|
||||
public interface TestCaseMapper
|
||||
{
|
||||
/**
|
||||
* 查询用例
|
||||
*
|
||||
* @param id 用例主键
|
||||
* @return 用例
|
||||
*/
|
||||
public TestCase selectTestCaseById(Long id);
|
||||
TestCase selectTestCaseById(Long id);
|
||||
|
||||
/**
|
||||
* 查询用例列表
|
||||
*
|
||||
* @param testCase 用例
|
||||
* @return 用例集合
|
||||
*/
|
||||
public List<TestCase> selectTestCaseList(TestCase testCase);
|
||||
List<TestCase> selectTestCaseList(TestCaseListQO qo);
|
||||
|
||||
/**
|
||||
* 新增用例
|
||||
*
|
||||
* @param testCase 用例
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertTestCase(TestCase testCase);
|
||||
int insertTestCase(TestCase testCase);
|
||||
|
||||
/**
|
||||
* 修改用例
|
||||
*
|
||||
* @param testCase 用例
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateTestCase(TestCase testCase);
|
||||
int updateTestCase(TestCase testCase);
|
||||
|
||||
/**
|
||||
* 删除用例
|
||||
*
|
||||
* @param id 用例主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteTestCaseById(Long id);
|
||||
int deleteTestCaseById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除用例
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteTestCaseByIds(Long[] ids);
|
||||
int deleteTestCaseByIds(Long[] ids);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.test.test.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.test.test.domain.TestDatasource;
|
||||
|
||||
/**
|
||||
* 数据源Mapper接口
|
||||
*/
|
||||
public interface TestDatasourceMapper {
|
||||
/**
|
||||
* 查询数据源
|
||||
*/
|
||||
TestDatasource selectTestDatasourceById(Long id);
|
||||
|
||||
/**
|
||||
* 查询数据源列表
|
||||
*/
|
||||
List<TestDatasource> selectTestDatasourceList();
|
||||
|
||||
/**
|
||||
* 新增数据源
|
||||
*/
|
||||
int insertTestDatasource(TestDatasource testDatasource);
|
||||
|
||||
/**
|
||||
* 修改数据源
|
||||
*/
|
||||
int updateTestDatasource(TestDatasource testDatasource);
|
||||
|
||||
/**
|
||||
* 删除数据源
|
||||
*/
|
||||
int deleteTestDatasourceById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除数据源
|
||||
*/
|
||||
int deleteTestDatasourceByIds(Long[] ids);
|
||||
}
|
||||
@@ -33,4 +33,5 @@ public interface TestGroupMapper
|
||||
*/
|
||||
int deleteTestGroupByIds(List<Long> ids);
|
||||
|
||||
TestGroup selectGroup(String name, Long parentId, String type);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.test.test.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.test.test.domain.TestHttp;
|
||||
|
||||
/**
|
||||
* http服务Mapper接口
|
||||
*/
|
||||
public interface TestHttpMapper {
|
||||
/**
|
||||
* 查询http服务
|
||||
*/
|
||||
TestHttp selectTestHttpById(Long id);
|
||||
|
||||
/**
|
||||
* 查询http服务列表
|
||||
*/
|
||||
List<TestHttp> selectTestHttpList();
|
||||
|
||||
/**
|
||||
* 新增http服务
|
||||
*/
|
||||
int insertTestHttp(TestHttp testHttp);
|
||||
|
||||
/**
|
||||
* 修改http服务
|
||||
*/
|
||||
int updateTestHttp(TestHttp testHttp);
|
||||
|
||||
/**
|
||||
* 删除http服务
|
||||
*/
|
||||
int deleteTestHttpById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除http服务
|
||||
*/
|
||||
int deleteTestHttpByIds(Long[] ids);
|
||||
}
|
||||
@@ -1,9 +1,5 @@
|
||||
package com.test.test.service;
|
||||
|
||||
import com.test.test.domain.TestCase;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用例Service接口
|
||||
*
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.test.test.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.test.test.domain.TestDatasource;
|
||||
|
||||
/**
|
||||
* 数据源Service接口
|
||||
*/
|
||||
public interface ITestDatasourceService {
|
||||
/**
|
||||
* 查询数据源
|
||||
*/
|
||||
public TestDatasource selectTestDatasourceById(Long id);
|
||||
|
||||
/**
|
||||
* 查询数据源列表
|
||||
*/
|
||||
List<TestDatasource> selectTestDatasourceList();
|
||||
|
||||
/**
|
||||
* 新增数据源
|
||||
*/
|
||||
TestDatasource insertTestDatasource(TestDatasource testDatasource);
|
||||
|
||||
/**
|
||||
* 修改数据源
|
||||
*/
|
||||
int updateTestDatasource(TestDatasource testDatasource);
|
||||
|
||||
/**
|
||||
* 批量删除数据源
|
||||
*/
|
||||
int deleteTestDatasourceByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除数据源信息
|
||||
*/
|
||||
int deleteTestDatasourceById(Long id);
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.test.test.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.test.test.domain.TestGroup;
|
||||
import com.test.test.domain.qo.GroupDelectQO;
|
||||
|
||||
@@ -9,8 +10,7 @@ import com.test.test.domain.qo.GroupDelectQO;
|
||||
*
|
||||
* @author xiaoe
|
||||
*/
|
||||
public interface ITestGroupService
|
||||
{
|
||||
public interface ITestGroupService {
|
||||
/**
|
||||
* 查询节点(文件夹)列表
|
||||
*/
|
||||
@@ -21,6 +21,11 @@ public interface ITestGroupService
|
||||
*/
|
||||
TestGroup insertTestGroup(TestGroup testGroup);
|
||||
|
||||
/**
|
||||
* 查询节点(文件夹)
|
||||
*/
|
||||
TestGroup selectGroup(String name, Long parentId, String type);
|
||||
|
||||
/**
|
||||
* 修改节点(文件夹)
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.test.test.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.test.test.domain.TestHttp;
|
||||
|
||||
/**
|
||||
* http服务Service接口
|
||||
*/
|
||||
public interface ITestHttpService {
|
||||
/**
|
||||
* 查询http服务
|
||||
*/
|
||||
TestHttp selectTestHttpById(Long id);
|
||||
|
||||
/**
|
||||
* 查询http服务列表
|
||||
*/
|
||||
List<TestHttp> selectTestHttpList();
|
||||
|
||||
/**
|
||||
* 新增http服务
|
||||
*/
|
||||
TestHttp insertTestHttp(TestHttp testHttp);
|
||||
|
||||
/**
|
||||
* 修改http服务
|
||||
*/
|
||||
int updateTestHttp(TestHttp testHttp);
|
||||
|
||||
/**
|
||||
* 批量删除http服务
|
||||
*/
|
||||
int deleteTestHttpByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除http服务信息
|
||||
*/
|
||||
int deleteTestHttpById(Long id);
|
||||
}
|
||||
@@ -1,16 +1,21 @@
|
||||
package com.test.test.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.test.common.utils.DateUtils;
|
||||
import com.test.common.utils.http.HttpUtils;
|
||||
import com.test.test.domain.TestGroup;
|
||||
import com.test.test.domain.qo.TestApiListQO;
|
||||
import com.test.test.service.ITestGroupService;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.test.test.mapper.TestApiMapper;
|
||||
import com.test.test.domain.TestApi;
|
||||
import com.test.test.service.ITestApiService;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* 接口Service业务层处理
|
||||
@@ -22,6 +27,9 @@ public class TestApiServiceImpl implements ITestApiService {
|
||||
@Resource
|
||||
private TestApiMapper testApiMapper;
|
||||
|
||||
@Resource
|
||||
private ITestGroupService testGroupService;
|
||||
|
||||
/**
|
||||
* 查询接口
|
||||
*
|
||||
@@ -57,9 +65,172 @@ public class TestApiServiceImpl implements ITestApiService {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public int importSwaggerApi(String url) {
|
||||
JSONObject json = JSONObject.parse(HttpUtils.sendGet(url));
|
||||
return 0;
|
||||
AtomicInteger count = new AtomicInteger();
|
||||
JSONObject jsonObject = JSONObject.parseObject(HttpUtils.sendGet(url));
|
||||
String title = jsonObject.getJSONObject("info").getString("title");
|
||||
Date createTime = DateUtils.getNowDate();
|
||||
// 设置顶级节点
|
||||
Long parentId = getGroupId(title, 0L);
|
||||
// 获取Schemas
|
||||
JSONObject schemas = jsonObject.getJSONObject("components").getJSONObject("schemas");
|
||||
// 获取所有接口
|
||||
jsonObject.getJSONObject("paths").forEach((uri, pathJson) -> {
|
||||
((JSONObject) pathJson).forEach((method, v) -> {
|
||||
JSONObject json = (JSONObject) v;
|
||||
// 获取接口名
|
||||
String name = json.getString("summary");
|
||||
if (name == null) name = uri;
|
||||
// 获取接口分组
|
||||
String groupName = title;
|
||||
List<String> tags = json.getList("tags", String.class);
|
||||
if (!tags.isEmpty()) {
|
||||
groupName = tags.get(0);
|
||||
}
|
||||
// 获取body
|
||||
String body = "";
|
||||
String contentType = "";
|
||||
if (json.getJSONObject("requestBody") != null) {
|
||||
JSONObject bodyJson = json.getJSONObject("requestBody").getJSONObject("content");
|
||||
if (bodyJson != null) {
|
||||
Set<String> keys = bodyJson.keySet();
|
||||
if (!keys.isEmpty()) {
|
||||
contentType = keys.iterator().next();
|
||||
JSONObject schema = bodyJson.getJSONObject(contentType).getJSONObject("schema");
|
||||
body = JSONObject.toJSONString(parseSchema(schema, schemas));
|
||||
}
|
||||
}
|
||||
}
|
||||
// 获取Param
|
||||
String param = "[]";
|
||||
JSONObject parameters = json.getJSONObject("parameters");
|
||||
if (parameters != null) {
|
||||
JSONObject paramsJson = parseParams(parameters, schemas);
|
||||
JSONArray array = new JSONArray();
|
||||
paramsJson.forEach((key, value) -> {
|
||||
JSONObject object = new JSONObject();
|
||||
object.put("key", key);
|
||||
object.put("value", value);
|
||||
array.add(object);
|
||||
});
|
||||
param = array.toJSONString();
|
||||
}
|
||||
// 获取header
|
||||
String header = "[]";
|
||||
|
||||
TestApi testApi = new TestApi();
|
||||
testApi.setUri(uri);
|
||||
testApi.setMethod(method);
|
||||
testApi.setName(name);
|
||||
testApi.setGroupId(getGroupId(groupName, parentId));
|
||||
testApi.setBody(body);
|
||||
testApi.setParam(param);
|
||||
testApi.setHeader(header);
|
||||
testApi.setCreateTime(createTime);
|
||||
|
||||
count.addAndGet(testApiMapper.insertTestApi(testApi));
|
||||
});
|
||||
});
|
||||
return count.get();
|
||||
}
|
||||
|
||||
private static JSONObject parseSchema(JSONObject schema, JSONObject schemas) {
|
||||
JSONObject result = new JSONObject();
|
||||
|
||||
// 如果 schema 包含 $ref,则解析引用
|
||||
if (schema.containsKey("$ref")) {
|
||||
String ref = schema.getString("$ref");
|
||||
// 去掉 #/components/schemas/ 前缀,获取引用的 schema 名称
|
||||
String schemaName = ref.replace("#/components/schemas/", "");
|
||||
JSONObject referencedSchema = schemas.getJSONObject(schemaName);
|
||||
// 递归解析引用的 schema
|
||||
return parseSchema(referencedSchema, schemas);
|
||||
}
|
||||
|
||||
// 如果 schema 包含 type,则直接根据类型构建结果
|
||||
if (schema.containsKey("type")) {
|
||||
String type = schema.getString("type");
|
||||
switch (type) {
|
||||
case "integer":
|
||||
result.put("value", 0);
|
||||
break;
|
||||
case "string":
|
||||
result.put("value", "string");
|
||||
break;
|
||||
case "boolean":
|
||||
result.put("value", false);
|
||||
break;
|
||||
default:
|
||||
result.put("value", type);
|
||||
}
|
||||
}
|
||||
|
||||
// 如果 schema 有 properties,则遍历 properties 并递归解析
|
||||
if (schema.containsKey("properties")) {
|
||||
JSONObject properties = schema.getJSONObject("properties");
|
||||
for (Map.Entry<String, Object> entry : properties.entrySet()) {
|
||||
String key = entry.getKey();
|
||||
JSONObject propertySchema = (JSONObject) entry.getValue();
|
||||
JSONObject propertyResult = parseSchema(propertySchema, schemas); // 递归解析每个字段
|
||||
result.put(key, propertyResult.get("value")); // 获取解析结果的值
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private static JSONObject parseParams(JSONObject params, JSONObject schemas) {
|
||||
JSONObject result = new JSONObject();
|
||||
|
||||
// 遍历 params 中的每个参数
|
||||
for (String key : params.keySet()) {
|
||||
// 获取当前参数的 schema 定义
|
||||
Object value = params.get(key);
|
||||
|
||||
// 获取 schema
|
||||
JSONObject schema = schemas.getJSONObject(key);
|
||||
|
||||
// 如果 schema 是基础类型,则直接赋值
|
||||
if (schema != null && schema.containsKey("type")) {
|
||||
String type = schema.getString("type");
|
||||
if ("string".equals(type)) {
|
||||
result.put(key, value != null ? value : "string"); // 默认值为 "string"
|
||||
} else if ("integer".equals(type)) {
|
||||
result.put(key, value != null ? value : 0); // 默认值为 0
|
||||
} else if ("boolean".equals(type)) {
|
||||
result.put(key, value != null ? value : false); // 默认值为 false
|
||||
}
|
||||
}
|
||||
// 如果 schema 是引用类型,则递归解析该引用
|
||||
else if (schema != null && schema.containsKey("$ref")) {
|
||||
String ref = schema.getString("$ref");
|
||||
String schemaName = ref.replace("#/components/schemas/", "");
|
||||
JSONObject referencedSchema = schemas.getJSONObject(schemaName);
|
||||
|
||||
// 如果引用的 schema 存在,递归解析该 schema
|
||||
if (referencedSchema != null) {
|
||||
// 递归调用,解析引用的 schema
|
||||
JSONObject nestedResult = parseParams(new JSONObject(), schemas);
|
||||
result.putAll(nestedResult);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private Long getGroupId(String groupName, Long parentId) {
|
||||
TestGroup group = testGroupService.selectGroup(groupName, parentId, "api");
|
||||
if (group == null) {
|
||||
group = new TestGroup();
|
||||
group.setParentId(parentId);
|
||||
group.setName(groupName);
|
||||
group.setType("api");
|
||||
group.setCreateTime(DateUtils.getNowDate());
|
||||
testGroupService.insertTestGroup(group);
|
||||
}
|
||||
return group.getId();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
package com.test.test.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.test.common.utils.DateUtils;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.test.test.mapper.TestDatasourceMapper;
|
||||
import com.test.test.domain.TestDatasource;
|
||||
import com.test.test.service.ITestDatasourceService;
|
||||
|
||||
/**
|
||||
* 数据源Service业务层处理
|
||||
*/
|
||||
@Service
|
||||
public class TestDatasourceServiceImpl implements ITestDatasourceService {
|
||||
@Resource
|
||||
private TestDatasourceMapper testDatasourceMapper;
|
||||
|
||||
/**
|
||||
* 查询数据源
|
||||
*
|
||||
* @param id 数据源主键
|
||||
* @return 数据源
|
||||
*/
|
||||
@Override
|
||||
public TestDatasource selectTestDatasourceById(Long id) {
|
||||
return testDatasourceMapper.selectTestDatasourceById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询数据源列表
|
||||
*/
|
||||
@Override
|
||||
public List<TestDatasource> selectTestDatasourceList() {
|
||||
return testDatasourceMapper.selectTestDatasourceList();
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增数据源
|
||||
*/
|
||||
@Override
|
||||
public TestDatasource insertTestDatasource(TestDatasource testDatasource) {
|
||||
testDatasource.setCreateTime(DateUtils.getNowDate());
|
||||
testDatasourceMapper.insertTestDatasource(testDatasource);
|
||||
return testDatasource;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改数据源
|
||||
*/
|
||||
@Override
|
||||
public int updateTestDatasource(TestDatasource testDatasource) {
|
||||
testDatasource.setUpdateTime(DateUtils.getNowDate());
|
||||
return testDatasourceMapper.updateTestDatasource(testDatasource);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除数据源
|
||||
*/
|
||||
@Override
|
||||
public int deleteTestDatasourceByIds(Long[] ids) {
|
||||
return testDatasourceMapper.deleteTestDatasourceByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据源信息
|
||||
*/
|
||||
@Override
|
||||
public int deleteTestDatasourceById(Long id) {
|
||||
return testDatasourceMapper.deleteTestDatasourceById(id);
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,7 @@ import com.test.common.utils.DateUtils;
|
||||
import com.test.common.utils.StringUtils;
|
||||
import com.test.test.domain.qo.GroupDelectQO;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.test.test.mapper.TestGroupMapper;
|
||||
import com.test.test.domain.TestGroup;
|
||||
@@ -26,6 +27,7 @@ public class TestGroupServiceImpl implements ITestGroupService {
|
||||
private TestGroupMapper testGroupMapper;
|
||||
|
||||
@Resource
|
||||
@Lazy
|
||||
private TestApiServiceImpl testApiServiceImpl;
|
||||
|
||||
/**
|
||||
@@ -46,6 +48,11 @@ public class TestGroupServiceImpl implements ITestGroupService {
|
||||
return testGroup;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TestGroup selectGroup(String name, Long parentId, String type) {
|
||||
return testGroupMapper.selectGroup(name, parentId, type);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改节点(文件夹)
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
package com.test.test.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.test.common.utils.DateUtils;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.test.test.mapper.TestHttpMapper;
|
||||
import com.test.test.domain.TestHttp;
|
||||
import com.test.test.service.ITestHttpService;
|
||||
|
||||
/**
|
||||
* http服务Service业务层处理
|
||||
*/
|
||||
@Service
|
||||
public class TestHttpServiceImpl implements ITestHttpService {
|
||||
@Resource
|
||||
private TestHttpMapper testHttpMapper;
|
||||
|
||||
/**
|
||||
* 查询http服务
|
||||
*/
|
||||
@Override
|
||||
public TestHttp selectTestHttpById(Long id) {
|
||||
return testHttpMapper.selectTestHttpById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询http服务列表
|
||||
*/
|
||||
@Override
|
||||
public List<TestHttp> selectTestHttpList() {
|
||||
return testHttpMapper.selectTestHttpList();
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增http服务
|
||||
*/
|
||||
@Override
|
||||
public TestHttp insertTestHttp(TestHttp testHttp) {
|
||||
testHttp.setCreateTime(DateUtils.getNowDate());
|
||||
testHttpMapper.insertTestHttp(testHttp);
|
||||
return testHttp;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改http服务
|
||||
*/
|
||||
@Override
|
||||
public int updateTestHttp(TestHttp testHttp) {
|
||||
testHttp.setUpdateTime(DateUtils.getNowDate());
|
||||
return testHttpMapper.updateTestHttp(testHttp);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除http服务
|
||||
*/
|
||||
@Override
|
||||
public int deleteTestHttpByIds(Long[] ids) {
|
||||
return testHttpMapper.deleteTestHttpByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除http服务信息
|
||||
*/
|
||||
@Override
|
||||
public int deleteTestHttpById(Long id) {
|
||||
return testHttpMapper.deleteTestHttpById(id);
|
||||
}
|
||||
}
|
||||
@@ -28,11 +28,12 @@
|
||||
<select id="selectTestApiList" parameterType="TestApiListQO" resultMap="TestApiResult">
|
||||
<include refid="selectTestApiVo"/>
|
||||
<where>
|
||||
<if test="groupId != null "> and group_id = #{groupId}</if>
|
||||
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
|
||||
<if test="method != null and method != ''"> and method = #{method}</if>
|
||||
<if test="uri != null and uri != ''"> and uri like concat('%', #{uri}, '%')</if>
|
||||
<if test="groupId != null ">and group_id = #{groupId}</if>
|
||||
<if test="name != null and name != ''">and name like concat('%', #{name}, '%')</if>
|
||||
<if test="method != null and method != ''">and method = #{method}</if>
|
||||
<if test="uri != null and uri != ''">and uri like concat('%', #{uri}, '%')</if>
|
||||
</where>
|
||||
order by create_time desc
|
||||
</select>
|
||||
|
||||
<select id="selectTestApiById" parameterType="Long" resultMap="TestApiResult">
|
||||
|
||||
@@ -1,30 +1,31 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.test.test.mapper.TestCaseLogMapper">
|
||||
|
||||
<resultMap type="TestCaseLog" id="TestCaseLogResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="caseId" column="case_id" />
|
||||
<result property="operType" column="oper_type" />
|
||||
<result property="operDetail" column="oper_detail" />
|
||||
<result property="operUser" column="oper_user" />
|
||||
<result property="operTime" column="oper_time" />
|
||||
<result property="id" column="id"/>
|
||||
<result property="caseId" column="case_id"/>
|
||||
<result property="operType" column="oper_type"/>
|
||||
<result property="operDetail" column="oper_detail"/>
|
||||
<result property="operUser" column="oper_user"/>
|
||||
<result property="operTime" column="oper_time"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectTestCaseLogVo">
|
||||
select id, case_id, oper_type, oper_detail, oper_user, oper_time from test_case_log
|
||||
select id, case_id, oper_type, oper_detail, oper_user, oper_time
|
||||
from test_case_log
|
||||
</sql>
|
||||
|
||||
<select id="selectTestCaseLogList" parameterType="TestCaseLog" resultMap="TestCaseLogResult">
|
||||
<include refid="selectTestCaseLogVo"/>
|
||||
<where>
|
||||
<if test="caseId != null and caseId != ''"> and case_id = #{caseId}</if>
|
||||
<if test="operType != null and operType != ''"> and oper_type = #{operType}</if>
|
||||
<if test="operDetail != null and operDetail != ''"> and oper_detail = #{operDetail}</if>
|
||||
<if test="operUser != null "> and oper_user = #{operUser}</if>
|
||||
<if test="operTime != null "> and oper_time = #{operTime}</if>
|
||||
<if test="caseId != null and caseId != ''">and case_id = #{caseId}</if>
|
||||
<if test="operType != null and operType != ''">and oper_type = #{operType}</if>
|
||||
<if test="operDetail != null and operDetail != ''">and oper_detail = #{operDetail}</if>
|
||||
<if test="operUser != null ">and oper_user = #{operUser}</if>
|
||||
<if test="operTime != null ">and oper_time = #{operTime}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
@@ -41,14 +42,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="operDetail != null">oper_detail,</if>
|
||||
<if test="operUser != null">oper_user,</if>
|
||||
<if test="operTime != null">oper_time,</if>
|
||||
</trim>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="caseId != null">#{caseId},</if>
|
||||
<if test="operType != null">#{operType},</if>
|
||||
<if test="operDetail != null">#{operDetail},</if>
|
||||
<if test="operUser != null">#{operUser},</if>
|
||||
<if test="operTime != null">#{operTime},</if>
|
||||
</trim>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateTestCaseLog" parameterType="TestCaseLog">
|
||||
@@ -64,7 +65,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</update>
|
||||
|
||||
<delete id="deleteTestCaseLogById" parameterType="Long">
|
||||
delete from test_case_log where id = #{id}
|
||||
delete
|
||||
from test_case_log
|
||||
where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteTestCaseLogByIds" parameterType="String">
|
||||
|
||||
@@ -1,36 +1,44 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.test.test.mapper.TestCaseMapper">
|
||||
|
||||
<resultMap type="TestCase" id="TestCaseResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="groupId" column="group_id" />
|
||||
<result property="projectId" column="project_id" />
|
||||
<result property="name" column="name" />
|
||||
<result property="importance" column="importance" />
|
||||
<result property="status" column="status" />
|
||||
<result property="delFlag" column="del_flag" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="id" column="id"/>
|
||||
<result property="groupId" column="group_id"/>
|
||||
<result property="projectId" column="project_id"/>
|
||||
<result property="name" column="name"/>
|
||||
<result property="importance" column="importance"/>
|
||||
<result property="status" column="status"/>
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectTestCaseVo">
|
||||
select id, group_id, project_id, name, importance, status, del_flag, create_by, create_time, update_by, update_time from test_case
|
||||
select id,
|
||||
group_id,
|
||||
project_id,
|
||||
name,
|
||||
importance,
|
||||
status,
|
||||
del_flag,
|
||||
create_by,
|
||||
create_time,
|
||||
update_by,
|
||||
update_time
|
||||
from test_case
|
||||
</sql>
|
||||
|
||||
<select id="selectTestCaseList" parameterType="TestCase" resultMap="TestCaseResult">
|
||||
<select id="selectTestCaseList" parameterType="TestCaseListQO" resultMap="TestCaseResult">
|
||||
<include refid="selectTestCaseVo"/>
|
||||
<where>
|
||||
<if test="groupId != null "> and group_id = #{groupId}</if>
|
||||
<if test="projectId != null "> and project_id = #{projectId}</if>
|
||||
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
|
||||
<if test="importance != null "> and importance = #{importance}</if>
|
||||
<if test="status != null "> and status = #{status}</if>
|
||||
group_id = #{groupId}
|
||||
</where>
|
||||
order by create_time desc
|
||||
</select>
|
||||
|
||||
<select id="selectTestCaseById" parameterType="Long" resultMap="TestCaseResult">
|
||||
@@ -51,7 +59,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
</trim>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="groupId != null">#{groupId},</if>
|
||||
<if test="projectId != null">#{projectId},</if>
|
||||
@@ -63,7 +71,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
</trim>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateTestCase" parameterType="TestCase">
|
||||
@@ -84,7 +92,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</update>
|
||||
|
||||
<delete id="deleteTestCaseById" parameterType="Long">
|
||||
delete from test_case where id = #{id}
|
||||
delete
|
||||
from test_case
|
||||
where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteTestCaseByIds" parameterType="String">
|
||||
|
||||
@@ -1,71 +1,100 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.test.test.mapper.TestCaseStepMapper">
|
||||
|
||||
<resultMap type="TestCaseStep" id="TestCaseStepResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="parentId" column="parent_id" />
|
||||
<result property="caseId" column="case_id" />
|
||||
<result property="name" column="name" />
|
||||
<result property="stepNum" column="step_num" />
|
||||
<result property="type" column="type" />
|
||||
<result property="requestMethod" column="request_method" />
|
||||
<result property="requestUrl" column="request_url" />
|
||||
<result property="requestBody" column="request_body" />
|
||||
<result property="requestHeader" column="request_header" />
|
||||
<result property="requestParams" column="request_params" />
|
||||
<result property="apiHttpId" column="api_http_id" />
|
||||
<result property="apiHost" column="api_host" />
|
||||
<result property="apiPort" column="api_port" />
|
||||
<result property="apiProtocol" column="api_protocol" />
|
||||
<result property="sqlCommand" column="sql_command" />
|
||||
<result property="count" column="count" />
|
||||
<result property="async" column="async" />
|
||||
<result property="interval" column="interval" />
|
||||
<result property="breakError" column="break_error" />
|
||||
<result property="preScript" column="pre_script" />
|
||||
<result property="postScript" column="post_script" />
|
||||
<result property="assignment" column="assignment" />
|
||||
<result property="assertion" column="assertion" />
|
||||
<result property="delFlag" column="del_flag" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="id" column="id"/>
|
||||
<result property="parentId" column="parent_id"/>
|
||||
<result property="caseId" column="case_id"/>
|
||||
<result property="name" column="name"/>
|
||||
<result property="stepNum" column="step_num"/>
|
||||
<result property="type" column="type"/>
|
||||
<result property="requestMethod" column="request_method"/>
|
||||
<result property="requestUrl" column="request_url"/>
|
||||
<result property="requestBody" column="request_body"/>
|
||||
<result property="requestHeader" column="request_header"/>
|
||||
<result property="requestParams" column="request_params"/>
|
||||
<result property="apiHttpId" column="api_http_id"/>
|
||||
<result property="apiHost" column="api_host"/>
|
||||
<result property="apiPort" column="api_port"/>
|
||||
<result property="apiProtocol" column="api_protocol"/>
|
||||
<result property="sqlCommand" column="sql_command"/>
|
||||
<result property="count" column="count"/>
|
||||
<result property="async" column="async"/>
|
||||
<result property="interval" column="interval"/>
|
||||
<result property="breakError" column="break_error"/>
|
||||
<result property="preScript" column="pre_script"/>
|
||||
<result property="postScript" column="post_script"/>
|
||||
<result property="assignment" column="assignment"/>
|
||||
<result property="assertion" column="assertion"/>
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectTestCaseStepVo">
|
||||
select id, parent_id, case_id, name, step_num, type, request_method, request_url, request_body, request_header, request_params, api_http_id, api_host, api_port, api_protocol, sql_command, count, async, interval, break_error, pre_script, post_script, assignment, assertion, del_flag, create_by, create_time, update_by, update_time from test_case_step
|
||||
select id,
|
||||
parent_id,
|
||||
case_id,
|
||||
name,
|
||||
step_num,
|
||||
type,
|
||||
request_method,
|
||||
request_url,
|
||||
request_body,
|
||||
request_header,
|
||||
request_params,
|
||||
api_http_id,
|
||||
api_host,
|
||||
api_port,
|
||||
api_protocol,
|
||||
sql_command,
|
||||
count,
|
||||
async,
|
||||
interval,
|
||||
break_error,
|
||||
pre_script,
|
||||
post_script,
|
||||
assignment,
|
||||
assertion,
|
||||
del_flag,
|
||||
create_by,
|
||||
create_time,
|
||||
update_by,
|
||||
update_time
|
||||
from test_case_step
|
||||
</sql>
|
||||
|
||||
<select id="selectTestCaseStepList" parameterType="TestCaseStep" resultMap="TestCaseStepResult">
|
||||
<include refid="selectTestCaseStepVo"/>
|
||||
<where>
|
||||
<if test="parentId != null "> and parent_id = #{parentId}</if>
|
||||
<if test="caseId != null "> and case_id = #{caseId}</if>
|
||||
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
|
||||
<if test="stepNum != null "> and step_num = #{stepNum}</if>
|
||||
<if test="type != null "> and type = #{type}</if>
|
||||
<if test="requestMethod != null and requestMethod != ''"> and request_method = #{requestMethod}</if>
|
||||
<if test="requestUrl != null and requestUrl != ''"> and request_url = #{requestUrl}</if>
|
||||
<if test="requestBody != null and requestBody != ''"> and request_body = #{requestBody}</if>
|
||||
<if test="requestHeader != null and requestHeader != ''"> and request_header = #{requestHeader}</if>
|
||||
<if test="requestParams != null and requestParams != ''"> and request_params = #{requestParams}</if>
|
||||
<if test="apiHttpId != null "> and api_http_id = #{apiHttpId}</if>
|
||||
<if test="apiHost != null and apiHost != ''"> and api_host = #{apiHost}</if>
|
||||
<if test="apiPort != null "> and api_port = #{apiPort}</if>
|
||||
<if test="apiProtocol != null and apiProtocol != ''"> and api_protocol = #{apiProtocol}</if>
|
||||
<if test="sqlCommand != null and sqlCommand != ''"> and sql_command = #{sqlCommand}</if>
|
||||
<if test="count != null "> and count = #{count}</if>
|
||||
<if test="async != null "> and async = #{async}</if>
|
||||
<if test="interval != null "> and interval = #{interval}</if>
|
||||
<if test="breakError != null and breakError != ''"> and break_error = #{breakError}</if>
|
||||
<if test="preScript != null and preScript != ''"> and pre_script = #{preScript}</if>
|
||||
<if test="postScript != null and postScript != ''"> and post_script = #{postScript}</if>
|
||||
<if test="assignment != null and assignment != ''"> and assignment = #{assignment}</if>
|
||||
<if test="assertion != null and assertion != ''"> and assertion = #{assertion}</if>
|
||||
<if test="parentId != null ">and parent_id = #{parentId}</if>
|
||||
<if test="caseId != null ">and case_id = #{caseId}</if>
|
||||
<if test="name != null and name != ''">and name like concat('%', #{name}, '%')</if>
|
||||
<if test="stepNum != null ">and step_num = #{stepNum}</if>
|
||||
<if test="type != null ">and type = #{type}</if>
|
||||
<if test="requestMethod != null and requestMethod != ''">and request_method = #{requestMethod}</if>
|
||||
<if test="requestUrl != null and requestUrl != ''">and request_url = #{requestUrl}</if>
|
||||
<if test="requestBody != null and requestBody != ''">and request_body = #{requestBody}</if>
|
||||
<if test="requestHeader != null and requestHeader != ''">and request_header = #{requestHeader}</if>
|
||||
<if test="requestParams != null and requestParams != ''">and request_params = #{requestParams}</if>
|
||||
<if test="apiHttpId != null ">and api_http_id = #{apiHttpId}</if>
|
||||
<if test="apiHost != null and apiHost != ''">and api_host = #{apiHost}</if>
|
||||
<if test="apiPort != null ">and api_port = #{apiPort}</if>
|
||||
<if test="apiProtocol != null and apiProtocol != ''">and api_protocol = #{apiProtocol}</if>
|
||||
<if test="sqlCommand != null and sqlCommand != ''">and sql_command = #{sqlCommand}</if>
|
||||
<if test="count != null ">and count = #{count}</if>
|
||||
<if test="async != null ">and async = #{async}</if>
|
||||
<if test="interval != null ">and interval = #{interval}</if>
|
||||
<if test="breakError != null and breakError != ''">and break_error = #{breakError}</if>
|
||||
<if test="preScript != null and preScript != ''">and pre_script = #{preScript}</if>
|
||||
<if test="postScript != null and postScript != ''">and post_script = #{postScript}</if>
|
||||
<if test="assignment != null and assignment != ''">and assignment = #{assignment}</if>
|
||||
<if test="assertion != null and assertion != ''">and assertion = #{assertion}</if>
|
||||
</where>
|
||||
ORDER BY step_num
|
||||
</select>
|
||||
@@ -106,7 +135,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
</trim>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="parentId != null">#{parentId},</if>
|
||||
<if test="caseId != null">#{caseId},</if>
|
||||
@@ -136,7 +165,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
</trim>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateTestCaseStep" parameterType="TestCaseStep">
|
||||
@@ -175,7 +204,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</update>
|
||||
|
||||
<delete id="deleteTestCaseStepById" parameterType="Long">
|
||||
delete from test_case_step where id = #{id}
|
||||
delete
|
||||
from test_case_step
|
||||
where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteTestCaseStepByIds" parameterType="String">
|
||||
|
||||
@@ -0,0 +1,109 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.test.test.mapper.TestDatasourceMapper">
|
||||
|
||||
<resultMap type="TestDatasource" id="TestDatasourceResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="name" column="name" />
|
||||
<result property="type" column="type" />
|
||||
<result property="host" column="host" />
|
||||
<result property="port" column="port" />
|
||||
<result property="username" column="username" />
|
||||
<result property="password" column="password" />
|
||||
<result property="dbName" column="db_name" />
|
||||
<result property="authDb" column="auth_db" />
|
||||
<result property="cluster" column="cluster" />
|
||||
<result property="masterName" column="master_name" />
|
||||
<result property="delFlag" column="del_flag" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectTestDatasourceVo">
|
||||
select id, name, type, host, port, username, password, db_name, auth_db, cluster, master_name, del_flag, create_by, create_time, update_by, update_time from test_datasource
|
||||
</sql>
|
||||
|
||||
<select id="selectTestDatasourceList" resultMap="TestDatasourceResult">
|
||||
<include refid="selectTestDatasourceVo"/>
|
||||
</select>
|
||||
|
||||
<select id="selectTestDatasourceById" parameterType="Long" resultMap="TestDatasourceResult">
|
||||
<include refid="selectTestDatasourceVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertTestDatasource" parameterType="TestDatasource" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into test_datasource
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="name != null">name,</if>
|
||||
<if test="type != null">type,</if>
|
||||
<if test="host != null">host,</if>
|
||||
<if test="port != null">port,</if>
|
||||
<if test="username != null">username,</if>
|
||||
<if test="password != null">password,</if>
|
||||
<if test="dbName != null">db_name,</if>
|
||||
<if test="authDb != null">auth_db,</if>
|
||||
<if test="cluster != null">cluster,</if>
|
||||
<if test="masterName != null">master_name,</if>
|
||||
<if test="delFlag != null">del_flag,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="name != null">#{name},</if>
|
||||
<if test="type != null">#{type},</if>
|
||||
<if test="host != null">#{host},</if>
|
||||
<if test="port != null">#{port},</if>
|
||||
<if test="username != null">#{username},</if>
|
||||
<if test="password != null">#{password},</if>
|
||||
<if test="dbName != null">#{dbName},</if>
|
||||
<if test="authDb != null">#{authDb},</if>
|
||||
<if test="cluster != null">#{cluster},</if>
|
||||
<if test="masterName != null">#{masterName},</if>
|
||||
<if test="delFlag != null">#{delFlag},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateTestDatasource" parameterType="TestDatasource">
|
||||
update test_datasource
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="name != null">name = #{name},</if>
|
||||
<if test="type != null">type = #{type},</if>
|
||||
<if test="host != null">host = #{host},</if>
|
||||
<if test="port != null">port = #{port},</if>
|
||||
<if test="username != null">username = #{username},</if>
|
||||
<if test="password != null">password = #{password},</if>
|
||||
<if test="dbName != null">db_name = #{dbName},</if>
|
||||
<if test="authDb != null">auth_db = #{authDb},</if>
|
||||
<if test="cluster != null">cluster = #{cluster},</if>
|
||||
<if test="masterName != null">master_name = #{masterName},</if>
|
||||
<if test="delFlag != null">del_flag = #{delFlag},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteTestDatasourceById" parameterType="Long">
|
||||
delete from test_datasource where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteTestDatasourceByIds" parameterType="String">
|
||||
delete from test_datasource where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
@@ -5,19 +5,28 @@
|
||||
<mapper namespace="com.test.test.mapper.TestGroupMapper">
|
||||
|
||||
<resultMap type="TestGroup" id="TestGroupResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="parentId" column="parent_id" />
|
||||
<result property="type" column="type" />
|
||||
<result property="name" column="name" />
|
||||
<result property="delFlag" column="del_flag" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="id" column="id"/>
|
||||
<result property="parentId" column="parent_id"/>
|
||||
<result property="type" column="type"/>
|
||||
<result property="name" column="name"/>
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectTestGroupVo">
|
||||
select id, parent_id, type, name, del_flag, create_by, create_time, update_by, update_time from test_group
|
||||
select id,
|
||||
parent_id,
|
||||
type,
|
||||
name,
|
||||
del_flag,
|
||||
create_by,
|
||||
create_time,
|
||||
update_by,
|
||||
update_time
|
||||
from test_group
|
||||
</sql>
|
||||
|
||||
<select id="selectTestGroupList" parameterType="String" resultMap="TestGroupResult">
|
||||
@@ -37,6 +46,13 @@
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectGroup" parameterType="String" resultMap="TestGroupResult">
|
||||
<include refid="selectTestGroupVo"/>
|
||||
<where>
|
||||
name = #{name} and type = #{type} and parent_id = #{parentId}
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<insert id="insertTestGroup" parameterType="TestGroup" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into test_group
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
|
||||
107
test-test/src/main/resources/mapper/test/TestHttpMapper.xml
Normal file
107
test-test/src/main/resources/mapper/test/TestHttpMapper.xml
Normal file
@@ -0,0 +1,107 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.test.test.mapper.TestHttpMapper">
|
||||
|
||||
<resultMap type="TestHttp" id="TestHttpResult">
|
||||
<result property="id" column="id"/>
|
||||
<result property="name" column="name"/>
|
||||
<result property="protocol" column="protocol"/>
|
||||
<result property="host" column="host"/>
|
||||
<result property="port" column="port"/>
|
||||
<result property="basePath" column="basePath"/>
|
||||
<result property="header" column="header"/>
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectTestHttpVo">
|
||||
select id,
|
||||
name,
|
||||
protocol,
|
||||
host,
|
||||
port,
|
||||
basePath,
|
||||
header,
|
||||
del_flag,
|
||||
create_by,
|
||||
create_time,
|
||||
update_by,
|
||||
update_time
|
||||
from test_http
|
||||
</sql>
|
||||
|
||||
<select id="selectTestHttpList" resultMap="TestHttpResult">
|
||||
<include refid="selectTestHttpVo"/>
|
||||
</select>
|
||||
|
||||
<select id="selectTestHttpById" parameterType="Long" resultMap="TestHttpResult">
|
||||
<include refid="selectTestHttpVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertTestHttp" parameterType="TestHttp" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into test_http
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="name != null">name,</if>
|
||||
<if test="protocol != null">protocol,</if>
|
||||
<if test="host != null">host,</if>
|
||||
<if test="port != null">port,</if>
|
||||
<if test="basePath != null">basePath,</if>
|
||||
<if test="header != null">header,</if>
|
||||
<if test="delFlag != null">del_flag,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="name != null">#{name},</if>
|
||||
<if test="protocol != null">#{protocol},</if>
|
||||
<if test="host != null">#{host},</if>
|
||||
<if test="port != null">#{port},</if>
|
||||
<if test="basePath != null">#{basePath},</if>
|
||||
<if test="header != null">#{header},</if>
|
||||
<if test="delFlag != null">#{delFlag},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateTestHttp" parameterType="TestHttp">
|
||||
update test_http
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="name != null">name = #{name},</if>
|
||||
<if test="protocol != null">protocol = #{protocol},</if>
|
||||
<if test="host != null">host = #{host},</if>
|
||||
<if test="port != null">port = #{port},</if>
|
||||
<if test="basePath != null">basePath = #{basePath},</if>
|
||||
<if test="header != null">header = #{header},</if>
|
||||
<if test="delFlag != null">del_flag = #{delFlag},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteTestHttpById" parameterType="Long">
|
||||
delete
|
||||
from test_http
|
||||
where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteTestHttpByIds" parameterType="String">
|
||||
delete from test_http where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
@@ -39,8 +39,16 @@ export function updateApi(data) {
|
||||
// 删除接口
|
||||
export function delApi(id) {
|
||||
return request({
|
||||
url: '/test/api/del/',
|
||||
url: '/test/api/del',
|
||||
method: 'post',
|
||||
params: {id}
|
||||
data: {id}
|
||||
})
|
||||
}
|
||||
|
||||
export function importApi(url) {
|
||||
return request({
|
||||
url: '/test/api/import/swagger',
|
||||
method: 'post',
|
||||
params: url
|
||||
})
|
||||
}
|
||||
|
||||
46
test-ui/src/api/test/case.js
Normal file
46
test-ui/src/api/test/case.js
Normal file
@@ -0,0 +1,46 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询用例列表
|
||||
export function listCase(query) {
|
||||
return request({
|
||||
url: '/test/case/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询用例详细
|
||||
export function getCase(id) {
|
||||
return request({
|
||||
url: '/test/case/detail',
|
||||
method: 'post',
|
||||
data: {id}
|
||||
})
|
||||
}
|
||||
|
||||
// 新增用例
|
||||
export function addCase(data) {
|
||||
return request({
|
||||
url: '/test/case/add',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改用例
|
||||
export function updateCase(data) {
|
||||
return request({
|
||||
url: '/test/case/edit',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除用例
|
||||
export function delCase(id) {
|
||||
return request({
|
||||
url: '/test/case/del',
|
||||
method: 'post',
|
||||
data: {id}
|
||||
})
|
||||
}
|
||||
45
test-ui/src/api/test/database.js
Normal file
45
test-ui/src/api/test/database.js
Normal file
@@ -0,0 +1,45 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询数据源列表
|
||||
export function listDatasource() {
|
||||
return request({
|
||||
url: '/test/datasource/list',
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 查询数据源详细
|
||||
export function getDatasource(id) {
|
||||
return request({
|
||||
url: '/test/datasource/detail',
|
||||
method: 'post',
|
||||
data: {id}
|
||||
})
|
||||
}
|
||||
|
||||
// 新增数据源
|
||||
export function addDatasource(data) {
|
||||
return request({
|
||||
url: '/test/datasource/add',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改数据源
|
||||
export function updateDatasource(data) {
|
||||
return request({
|
||||
url: '/test/datasource/edit',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除数据源
|
||||
export function delDatasource(id) {
|
||||
return request({
|
||||
url: '/test/datasource/del',
|
||||
method: 'post',
|
||||
data: {id}
|
||||
})
|
||||
}
|
||||
45
test-ui/src/api/test/http.js
Normal file
45
test-ui/src/api/test/http.js
Normal file
@@ -0,0 +1,45 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询http服务列表
|
||||
export function listHttp() {
|
||||
return request({
|
||||
url: '/test/http/list',
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 查询http服务详细
|
||||
export function getHttp(id) {
|
||||
return request({
|
||||
url: '/test/http/detail',
|
||||
method: 'post',
|
||||
data: {id}
|
||||
})
|
||||
}
|
||||
|
||||
// 新增http服务
|
||||
export function addHttp(data) {
|
||||
return request({
|
||||
url: '/test/http/add',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改http服务
|
||||
export function updateHttp(data) {
|
||||
return request({
|
||||
url: '/test/http/edit',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除http服务
|
||||
export function delHttp(id) {
|
||||
return request({
|
||||
url: '/test/http/del',
|
||||
method: 'post',
|
||||
data: {id}
|
||||
})
|
||||
}
|
||||
50
test-ui/src/assets/icons/svg/1.svg
Normal file
50
test-ui/src/assets/icons/svg/1.svg
Normal file
@@ -0,0 +1,50 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="32px" height="32px" viewBox="0 0 32 32" enable-background="new 0 0 32 32" xml:space="preserve"> <image id="image0" width="32" height="32" x="0" y="0"
|
||||
xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAIGNIUk0AAHomAACAhAAA+gAAAIDo
|
||||
AAB1MAAA6mAAADqYAAAXcJy6UTwAAAAGYktHRAD/AP8A/6C9p5MAAAAJcEhZcwAADsIAAA7CARUo
|
||||
SoAAAAj4SURBVFjDhZfJklxHFYa/HO69NXVVdXf1J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|
||||
FgaqotZWGKKQBIKH2tvfnvziJ//6D2LX4kcS25rNAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDI1LTAy
|
||||
LTE5VDA5OjA5OjM4KzAwOjAwr5w6+AAAACV0RVh0ZGF0ZTptb2RpZnkAMjAyNS0wMi0xOVQwOTow
|
||||
OTozOCswMDowMN7BgkQAAAAodEVYdGRhdGU6dGltZXN0YW1wADIwMjUtMDItMTlUMDk6MDk6Mzgr
|
||||
MDA6MDCJ1KObAAAAAElFTkSuQmCC" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 3.9 KiB |
49
test-ui/src/assets/icons/svg/2.svg
Normal file
49
test-ui/src/assets/icons/svg/2.svg
Normal file
@@ -0,0 +1,49 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="32px" height="32px" viewBox="0 0 32 32" enable-background="new 0 0 32 32" xml:space="preserve"> <image id="image0" width="32" height="32" x="0" y="0"
|
||||
xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAIGNIUk0AAHomAACAhAAA+gAAAIDo
|
||||
AAB1MAAA6mAAADqYAAAXcJy6UTwAAAAGYktHRAD/AP8A/6C9p5MAAAAJcEhZcwAADsIAAA7CARUo
|
||||
SoAAAAi9SURBVFjDpZfJkhxHcoY/94hcqqoXoNELAJJokFhJkENJZtp1103PpvfQE+ikgy5jY2Mi
|
||||
hkaQg4UNAmig0Qt6raqszIxw16EKFG1MssGMwiwPaekR/vv/u4enC3/m+uHKleWxjje1t5FP+67t
|
||||
OP5XePdvkP+Uc+RDjP5je7veGvhl79s1ZtOlftpdikW1rutXNsutzZGWgy7PJsf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Width: | Height: | Size: 3.8 KiB |
23
test-ui/src/assets/icons/svg/3.svg
Normal file
23
test-ui/src/assets/icons/svg/3.svg
Normal file
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="32px" height="32px" viewBox="0 0 32 32" enable-background="new 0 0 32 32" xml:space="preserve"> <image id="image0" width="32" height="32" x="0" y="0"
|
||||
xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAAAIGNIUk0AAHomAACAhAAA+gAAAIDo
|
||||
AAB1MAAA6mAAADqYAAAXcJy6UTwAAAFBUExURQAAAP8AAORXROVWQ+RXRORXQ+VXQ+RXQ+VXQuVX
|
||||
Q+FVROVYReVYQ+RYQ+RXROVXRORXQ+RYQ+RYRORXQuRYQ+dXQ+dWQuRXQ+RXQ+NXRP9VVeNWQ+RY
|
||||
Q+ZWQapVVeRYQ+VYQ99PP+9fP+NXRORYQ/8AAORYROVYQ+VZP+ZUPORXRONWQeVYQ+RYReVXROVX
|
||||
Q+VXQ+JUOORQQ+RYQ+RXRORYQ+RXQ+VXQ+VXQ+VYROVYQ/8/P+RYQ+RXQ+VXRORWQ+RXQuRXQ+VX
|
||||
QwAAAOVXROVWQ+NWQ+RYROJURuRXQuRYROVXQ+JUOOVWQuRXQv9mM+RYQ+RXQ+VYQ+ZZQ+NWQudX
|
||||
Q+NYQuVXQ+RYRORXQ+RXROVMTOVYRORXQ+RYQuVWQuRXQ+VXQ+RXQ78/P+dWReNXQuVXQ+JWQuJU
|
||||
Q+VYRP///2kLViUAAABpdFJOUwABQ5bN6e7NPc88dvz8dHjqtqSk6nVB/d5SA1PePgPWxRAQxtMC
|
||||
TucUFehKomtsntsSE/ng4fT92Nn5BPXlu0S3cr0Bvm158xJ+/owJjXsFxOaLU0FAVObCy8oKmf6Z
|
||||
MvHxowQsSU9QLWGOosQAAAABYktHRGolYpUOAAAACXBIWXMAAA7CAAAOwgEVKEqAAAAAB3RJTUUH
|
||||
6QITCQoNTnzkQwAAARVJREFUOMtjYBg+gJGJmYWVDQmwsjMzMSLkOTgzsQBOLpg8N08mVsDLB5Hn
|
||||
B/MEBIWE4UBIUAQsKAqSFxMHsiQkpVBdJSUtAxQWl2VgkJMHMhQUMR2upAyUUFFlUANS6hrYvKap
|
||||
BZTSZtABkrrYPa8HlNJnMADaZIhdgRHQdfIMxpmZJrjCzzQz04zBPDPTApcCy8xMKwagh82ksMtb
|
||||
22Rm2jLYAV3ChF2BPVDKgcERSDo5Y41BF6CUK4OGGZDix6bADSjh7sHA4Amkvbx90KV9fEGR4Qdk
|
||||
+QeAWIFBwSGhcBASFhQOEo2wBodHZCYOEOUBMS06xhybdGxcNNzCeJ0EdOnEpHgUNyWnpKalI4B2
|
||||
hjXDEAIA6Gtt2UiJwB0AAAAldEVYdGRhdGU6Y3JlYXRlADIwMjUtMDItMTlUMDk6MTA6MTMrMDA6
|
||||
MDDSJZ11AAAAJXRFWHRkYXRlOm1vZGlmeQAyMDI1LTAyLTE5VDA5OjEwOjEzKzAwOjAwo3glyQAA
|
||||
ACh0RVh0ZGF0ZTp0aW1lc3RhbXAAMjAyNS0wMi0xOVQwOToxMDoxMyswMDowMPRtBBYAAAAASUVO
|
||||
RK5CYII=" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.8 KiB |
29
test-ui/src/assets/icons/svg/4.svg
Normal file
29
test-ui/src/assets/icons/svg/4.svg
Normal file
@@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="32px" height="32px" viewBox="0 0 32 32" enable-background="new 0 0 32 32" xml:space="preserve"> <image id="image0" width="32" height="32" x="0" y="0"
|
||||
xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAAAIGNIUk0AAHomAACAhAAA+gAAAIDo
|
||||
AAB1MAAA6mAAADqYAAAXcJy6UTwAAAHmUExURQAAAAAcKgAeKwAfLQAdKgAbKQAeKwAdLAAdKwAc
|
||||
KwAdKgAZMwAdKgAeKQAeKAAeKwAZJgAgLgAeKQAeKAAgKQAcKQAcKwAdLQAeKQAeKAASJAAcKwAc
|
||||
KgAeKwAeLQAeKgAeKAAeKwAdKwAeKgAeKgAeLQAeKQAeKgAdKgAaKQAeKAAeKwAeKwAbKgAeKwAe
|
||||
LQAbKwASNgAdKwAcLQAfLQAeKgAYMAAcKwAbKQAfLAAbKgAgLQAgLgAfLQAfLAAeKwAcKgAfKwAb
|
||||
KgAYKQCQSwAdKwARKABlPgDzZgAUKQBMOADeYAD0ZgApLgC/VwD5ZwDtZAAdKgAVKAB+RgD3ZwDu
|
||||
ZAAZKgAvMADNWwD2ZgATKABwQgDyZQDvZQAcKwCxVADrZADqYwCwUwAXKQAzMQDvZADgYADaXwD3
|
||||
ZgDJWgAwMAAUKABGNgDdXwDUXQDwZQDYXgBANAAVKQDdYADzZQDxZQDJWQC5VgBINgC9VgCoUQDy
|
||||
ZgDZXgBBNAAWKQA9MwDVXgD1ZgCyVACaTQDSXAA4MgD6ZwCUTAARJwB6RACgTwCPSgB7RAA1MQDO
|
||||
XACXTQCKSQBpQABmUAD5aAAgKwCpUQD/agD/awAsLwC3VQC1VAAqLgAjLQAoLgAPJwAOJwAxMP//
|
||||
/6NZ1FYAAAA7dFJOUwAkXZPA3es0nt+dFIn19IgUN8vKNz7gPePjD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xMDoyMCswMDowMBwfOLcAAAAodEVY
|
||||
dGRhdGU6dGltZXN0YW1wADIwMjUtMDItMTlUMDk6MTA6MjArMDA6MDBLChloAAAAAElFTkSuQmCC" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 2.4 KiB |
12
test-ui/src/assets/icons/svg/5.svg
Normal file
12
test-ui/src/assets/icons/svg/5.svg
Normal file
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="32px" height="32px" viewBox="0 0 32 32" enable-background="new 0 0 32 32" xml:space="preserve"> <image id="image0" width="32" height="32" x="0" y="0"
|
||||
xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgBAMAAACBVGfHAAAAIGNIUk0AAHomAACAhAAA+gAAAIDo
|
||||
AAB1MAAA6mAAADqYAAAXcJy6UTwAAAAtUExURQAAAPJQIvROI328AH+6APZOHvlMH3u8AH26AACm
|
||||
8wCm9/+5AACk7wCk8////zYaLMIAAAABdFJOUwBA5thmAAAAAWJLR0QOb70wTwAAAAlwSFlzAAAO
|
||||
wgAADsIBFShKgAAAAAd0SU1FB+kCEwkKGs2vYYQAAAAsSURBVCjPYxCEAAVmFwhgGNYCoRCQwN4B
|
||||
AQyEwUwIWMC9GwIYzkDAhREhAAA59dSGAqm/4gAAACV0RVh0ZGF0ZTpjcmVhdGUAMjAyNS0wMi0x
|
||||
OVQwOToxMDoyNiswMDowMA6StTEAAAAldEVYdGRhdGU6bW9kaWZ5ADIwMjUtMDItMTlUMDk6MTA6
|
||||
MjYrMDA6MDB/zw2NAAAAKHRFWHRkYXRlOnRpbWVzdGFtcAAyMDI1LTAyLTE5VDA5OjEwOjI2KzAw
|
||||
OjAwKNosUgAAAABJRU5ErkJggg==" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.0 KiB |
17
test-ui/src/assets/icons/svg/6.svg
Normal file
17
test-ui/src/assets/icons/svg/6.svg
Normal file
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="32px" height="32px" viewBox="0 0 32 32" enable-background="new 0 0 32 32" xml:space="preserve"> <image id="image0" width="32" height="32" x="0" y="0"
|
||||
xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgBAMAAACBVGfHAAAAIGNIUk0AAHomAACAhAAA+gAAAIDo
|
||||
AAB1MAAA6mAAADqYAAAXcJy6UTwAAAAkUExURQAAAAAAAD8/P39/f7+/v////7///3+/v39/vz9/
|
||||
vz9/f7+//2rYyu0AAAABdFJOUwBA5thmAAAAAWJLR0QF+G/pxwAAAAlwSFlzAAAOwgAADsIBFShK
|
||||
gAAAAAd0SU1FB+kCEwkKH73FlQsAAAFNSURBVCjPfZE/T8JQFMUf8gVawMkF0A+gxujgVHimBicS
|
||||
irGbhkFwrTZ0M1YjdQWGzqV/bjeNidEv57mvqLB4k7Ynv96envuuEELouEq60BssILdlu1k5kLIv
|
||||
B/saQM2cPDvWOPN7RHd7aDCJKPnk25BIamKjA/1EXI8hRbuiFkB+KJCOiAyxydJWgCRRV4GkU4DF
|
||||
T0c0dkM8pideugQ37jVRdu54CUzxLvfmDj50/SCqizL+EgUUs1MeLjRR7igAv2yUhz6CIWQeMqBh
|
||||
FLQQ3f4FfjQxAI4U8AHiqV/HtDvw8OiUo385PD4HuSjCv7/yAVU9oltHhZ8Zula4Xh32GZz1rK5y
|
||||
jZvHOVoym15wZGIreJPeDCC1rBa7lmRDyjac0nu2UGuoNKsYCaP+lZqx/i+AR6ytAN7GYg1gBQ9i
|
||||
tUxKL9dAbdDT1kBpGeobWSq3/gtmVIYAAAAldEVYdGRhdGU6Y3JlYXRlADIwMjUtMDItMTlUMDk6
|
||||
MTA6MzErMDA6MDAHn4shAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDI1LTAyLTE5VDA5OjEwOjMxKzAw
|
||||
OjAwdsIznQAAACh0RVh0ZGF0ZTp0aW1lc3RhbXAAMjAyNS0wMi0xOVQwOToxMDozMSswMDowMCHX
|
||||
EkIAAAAASUVORK5CYII=" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.4 KiB |
@@ -187,6 +187,7 @@ export default {
|
||||
}
|
||||
});
|
||||
this.getGroup(openList);
|
||||
this.$emit('click', res.data.id);
|
||||
});
|
||||
} else {
|
||||
updateGroup({
|
||||
|
||||
@@ -117,16 +117,16 @@ export const constantRoutes = [
|
||||
]
|
||||
},
|
||||
{
|
||||
path: '/api/import',
|
||||
path: '/case/detail',
|
||||
component: Layout,
|
||||
hidden: true,
|
||||
children: [
|
||||
{
|
||||
path: '',
|
||||
component: () => import('@/views/test/api/import'),
|
||||
name: 'ApiImport',
|
||||
component: () => import('@/views/test/case/detail'),
|
||||
name: 'CaseDetail',
|
||||
noCache: true,
|
||||
meta: { title: '导入接口', activeMenu: '/api' }
|
||||
meta: { title: '用例详情', activeMenu: '/case' }
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
@@ -143,7 +143,7 @@ export default {
|
||||
this.form.header.splice(scope.$index, 1)
|
||||
},
|
||||
cancel() {
|
||||
this.$tab.closeOpenPage({ path: "/api" });
|
||||
this.$tab.closeOpenPage({path: "/api"});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -158,9 +158,11 @@ export default {
|
||||
::v-deep .el-collapse-item__wrap {
|
||||
padding: 0 16px;
|
||||
}
|
||||
|
||||
::v-deep.el-select {
|
||||
width: 130px;
|
||||
}
|
||||
|
||||
.input-with-select ::v-deep .el-input-group__prepend {
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
@@ -139,7 +139,7 @@ export default {
|
||||
contentType: this.form.contentType,
|
||||
body: this.form.body,
|
||||
}).then(res => {
|
||||
this.$message.success("新增成功");
|
||||
this.$message.success("修改成功");
|
||||
this.cancel();
|
||||
})
|
||||
},
|
||||
@@ -165,7 +165,7 @@ export default {
|
||||
this.form.header.splice(scope.$index, 1)
|
||||
},
|
||||
cancel() {
|
||||
this.$tab.closeOpenPage({ path: "/api" });
|
||||
this.$tab.closeOpenPage({path: "/api"});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -180,9 +180,11 @@ export default {
|
||||
::v-deep .el-collapse-item__wrap {
|
||||
padding: 0 16px;
|
||||
}
|
||||
|
||||
::v-deep.el-select {
|
||||
width: 130px;
|
||||
}
|
||||
|
||||
.input-with-select ::v-deep .el-input-group__prepend {
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
import
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "ApiImport",
|
||||
dicts: ['http_method'],
|
||||
created () {
|
||||
console.log(this.$route.query.groupId)
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
||||
</style>
|
||||
@@ -1,47 +1,63 @@
|
||||
<template>
|
||||
<folder-page type="api" @click="folderHandleSelected">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="接口名称" prop="name">
|
||||
<el-input v-model="queryParams.name" placeholder="请输入接口名称" clearable @keyup.enter.native="handleQuery"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="请求类型" prop="method">
|
||||
<el-select v-model="queryParams.method" placeholder="请输入接口请求类型" clearable @keyup.enter.native="handleQuery">
|
||||
<el-option v-for="dict in dict.type.http_method" :key="dict.value" :label="dict.label" :value="dict.value"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="接口路径" prop="uri">
|
||||
<el-input v-model="queryParams.uri" placeholder="请输入接口路径" clearable @keyup.enter.native="handleQuery"/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd">新增</el-button>
|
||||
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleImport">导入</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
<el-table v-loading="loading" :data="apiList">
|
||||
<el-table-column label="接口名称" align="center" prop="name"/>
|
||||
<el-table-column label="接口请求类型" align="center" prop="method"/>
|
||||
<el-table-column label="接口路径" align="center" prop="uri"/>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)">修改</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination v-show="total>0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList"/>
|
||||
<folder-page type="api" @click="folderHandleSelected" ref="folder">
|
||||
<div v-if="queryParams.groupId && queryParams.groupId !== 0">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="接口名称" prop="name">
|
||||
<el-input v-model="queryParams.name" placeholder="请输入接口名称" clearable @keyup.enter.native="handleQuery"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="请求类型" prop="method">
|
||||
<el-select v-model="queryParams.method" placeholder="请输入接口请求类型" clearable @keyup.enter.native="handleQuery">
|
||||
<el-option v-for="dict in dict.type.http_method" :key="dict.value" :label="dict.label" :value="dict.value"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="接口路径" prop="uri">
|
||||
<el-input v-model="queryParams.uri" placeholder="请输入接口路径" clearable @keyup.enter.native="handleQuery"/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd">新增</el-button>
|
||||
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleImport">导入</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
<el-table v-loading="loading" :data="apiList">
|
||||
<el-table-column label="接口名称" align="center" prop="name"/>
|
||||
<el-table-column label="接口请求类型" align="center" prop="method"/>
|
||||
<el-table-column label="接口路径" align="center" prop="uri"/>
|
||||
<el-table-column label="创建时间" align="center" prop="createTime"/>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)">修改</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<pagination v-show="total>0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList"/>
|
||||
</div>
|
||||
<el-empty v-else>
|
||||
<el-button type="primary" plain icon="el-icon-plus" @click="handleImport">导入</el-button>
|
||||
</el-empty>
|
||||
<el-dialog title="导入接口" :visible.sync="dialogVisible" :close-on-click-modal="false" destroy-on-close>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="swagger" prop="url">
|
||||
<el-input v-model="form.url" placeholder="请输入swagger文档链接"/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</folder-page>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {listApi, delApi} from "@/api/test/api";
|
||||
import {listApi, delApi, importApi} from "@/api/test/api";
|
||||
import FolderPage from "@/components/FolderPage/index.vue";
|
||||
|
||||
export default {
|
||||
@@ -62,6 +78,11 @@ export default {
|
||||
method: null,
|
||||
uri: null,
|
||||
},
|
||||
dialogVisible: false,
|
||||
form: {},
|
||||
rules: {
|
||||
url: [{required: true, message: "swagger文档链接不能为空", trigger: "blur"}]
|
||||
}
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
@@ -73,7 +94,6 @@ export default {
|
||||
this.apiList = [];
|
||||
}
|
||||
},
|
||||
/** 查询接口列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listApi(this.queryParams).then(response => {
|
||||
@@ -82,37 +102,52 @@ export default {
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.$tab.openPage("添加接口", "/api/add", {groupId: this.queryParams.groupId});
|
||||
},
|
||||
handleImport() {
|
||||
this.$tab.openPage("导入接口", "/api/import", {groupId: this.queryParams.groupId});
|
||||
this.dialogVisible = true;
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.$tab.openPage("修改接口", "/api/edit", {id: row.id});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
this.$modal.confirm('是否确认删除接口编号为"' + row.id + '"的数据项?').then(function () {
|
||||
this.$modal.confirm('是否确认删除接口?').then(function () {
|
||||
return delApi(row.id);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {
|
||||
});
|
||||
},
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
const loading = this.$loading({
|
||||
lock: true,
|
||||
text: 'Loading',
|
||||
spinner: 'el-icon-loading',
|
||||
background: 'rgba(0, 0, 0, 0.7)'
|
||||
});
|
||||
importApi({url: this.form.url}).then((res) => {
|
||||
loading.close();
|
||||
this.$message.success("导入成功")
|
||||
this.$refs.folder.getGroup();
|
||||
this.cancel();
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
cancel() {
|
||||
this.dialogVisible = false
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
16
test-ui/src/views/test/case/detail.vue
Normal file
16
test-ui/src/views/test/case/detail.vue
Normal file
@@ -0,0 +1,16 @@
|
||||
<template>
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "test",
|
||||
created() {
|
||||
console.log(this.$route.query.id);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
||||
</style>
|
||||
@@ -1,30 +1,102 @@
|
||||
<template>
|
||||
<folder-page type="case" @click="folderHandleSelected">
|
||||
case
|
||||
<div v-if="queryParams.groupId && queryParams.groupId !== 0">
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd">新建用例</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
<el-table v-loading="loading" :data="dataList" @row-click="handleRowClick">
|
||||
<el-table-column label="用例名称" align="center" prop="name"/>
|
||||
<el-table-column label="创建人" align="center" prop="createBy"/>
|
||||
<el-table-column label="用例状态" align="center" prop="status" :formatter="row => ['','草稿', '通过', '不通过'][row.status]"/>
|
||||
<el-table-column label="创建时间" align="center" prop="createTime"/>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row.id)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<pagination v-show="total>0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList"/>
|
||||
</div>
|
||||
<el-empty v-else/>
|
||||
</folder-page>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import FolderPage from "@/components/FolderPage/index.vue";
|
||||
import {addCase, delCase, listCase} from "@/api/test/case";
|
||||
|
||||
export default {
|
||||
name: "Case",
|
||||
components: {FolderPage},
|
||||
data() {
|
||||
return {
|
||||
|
||||
loading: false,
|
||||
showSearch: true,
|
||||
total: 0,
|
||||
dataList: [],
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
groupId: null,
|
||||
},
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
folderHandleSelected(id) {
|
||||
console.log(id)
|
||||
if (id) {
|
||||
this.queryParams.groupId = id;
|
||||
this.getList();
|
||||
} else {
|
||||
this.dataList = [];
|
||||
}
|
||||
},
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listCase(this.queryParams).then(response => {
|
||||
this.dataList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
handleAdd() {
|
||||
this.$prompt('请输入名称', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
inputPattern: /^(?!\s*$).+/,
|
||||
inputErrorMessage: '名称不能为空'
|
||||
}).then(({value}) => {
|
||||
if (value) {
|
||||
addCase({
|
||||
groupId: this.queryParams.groupId,
|
||||
name: value
|
||||
}).then(res => {
|
||||
this.$message.success("添加成功")
|
||||
this.getList()
|
||||
})
|
||||
}
|
||||
});
|
||||
},
|
||||
handleRowClick(row) {
|
||||
this.$tab.openPage("用例 - " + row.name, "/case/detail", {id: row.id});
|
||||
},
|
||||
handleDelete(id) {
|
||||
this.$modal.confirm('是否确认删除用例?').then(function () {
|
||||
return delCase(id);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
||||
::v-deep .el-table__row {
|
||||
cursor: pointer;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
@@ -1,69 +1,221 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd">新增</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
</div>
|
||||
<el-container>
|
||||
<el-aside style="width: 180px; padding: 0">
|
||||
<div class="header">
|
||||
<div>Database</div>
|
||||
<div>
|
||||
<el-dropdown trigger="click" @command="handleAdd">
|
||||
<el-button type="primary" icon="el-icon-plus" size="mini" circle/>
|
||||
<el-dropdown-menu slot="dropdown">
|
||||
<el-dropdown-item command="1"><svg-icon icon-class="1"/> Mysql</el-dropdown-item>
|
||||
<el-dropdown-item command="2"><svg-icon icon-class="2"/> Redis</el-dropdown-item>
|
||||
<el-dropdown-item command="3"><svg-icon icon-class="3"/> Oracle</el-dropdown-item>
|
||||
<el-dropdown-item command="4"><svg-icon icon-class="4"/> MongoDB</el-dropdown-item>
|
||||
<el-dropdown-item command="5"><svg-icon icon-class="5"/> SQL Server</el-dropdown-item>
|
||||
<el-dropdown-item command="6"><svg-icon icon-class="6"/> PostgreSQL</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
</div>
|
||||
</div>
|
||||
<div class="list" v-if="list && list.length > 0">
|
||||
<div v-for="item in list" :key="item.id" :class="'item'+(selectedKey === item.id ? ' is-active' : '')" @click="handleListClick(item)">
|
||||
<svg-icon :icon-class="item.type.toString()"/>
|
||||
{{ item.name }}
|
||||
</div>
|
||||
</div>
|
||||
<el-empty v-else description="暂无数据" :image-size="100"/>
|
||||
</el-aside>
|
||||
<el-main>
|
||||
<div v-if="selectedKey">
|
||||
<el-form :model="form" ref="form">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="24">
|
||||
<el-form-item label="数据源名称" prop="name">
|
||||
<el-input v-model="form.name" placeholder="请输入HTTP Server名称"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="16">
|
||||
<el-form-item label="主机" prop="host">
|
||||
<el-input v-model="form.host" placeholder="请输入主机地址"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="端口" prop="port">
|
||||
<el-input v-model="form.port" placeholder="请输入端口号"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24" v-if="form.type !== 3">
|
||||
<el-form-item label="库名" prop="dbName">
|
||||
<el-input v-model="form.dbName" placeholder="请输入库名"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24" v-if="form.type === 3">
|
||||
<el-form-item label="服务名" prop="dbName">
|
||||
<el-input v-model="form.dbName" placeholder="请输入服务名"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24" v-if="form.type === 4">
|
||||
<el-form-item label="认证库名" prop="authDb">
|
||||
<el-input v-model="form.authDb" placeholder="请输入认证库名"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="用户名" prop="username">
|
||||
<el-input v-model="form.username" placeholder="请输入用户名"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="密码" prop="password">
|
||||
<el-input v-model="form.password" show-password placeholder="请输入密码"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24" v-if="form.type === 2">
|
||||
<el-form-item label="集群模式" prop="cluster">
|
||||
<el-switch v-model="form.cluster" active-color="#13ce66" inactive-color="#ff4949" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24" v-if="form.type === 2">
|
||||
<el-form-item label="MasterName" prop="masterName">
|
||||
<el-input v-model="form.masterName" placeholder="哨兵模式下,请输入MasterName"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<div class="footer">
|
||||
<el-button type="primary" @click="save">保 存</el-button>
|
||||
<el-button type="danger" @click="del">删除</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<el-empty v-else description="暂无数据"/>
|
||||
</el-main>
|
||||
</el-container>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import {listApi} from "@/api/test/api";
|
||||
import {addDatasource, delDatasource, getDatasource, listDatasource, updateDatasource} from "@/api/test/database";
|
||||
|
||||
export default {
|
||||
name: "Database",
|
||||
name: 'Database',
|
||||
dicts: ["http_protocol"],
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
showSearch: true,
|
||||
total: 0,
|
||||
dataList: [],
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
name: null,
|
||||
method: null,
|
||||
uri: null,
|
||||
},
|
||||
};
|
||||
list: [],
|
||||
selectedKey: "",
|
||||
form: {},
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getData();
|
||||
this.$nextTick(() => {
|
||||
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
/** 查询接口列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listApi(this.queryParams).then(response => {
|
||||
this.dataList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
getData(selectedKey) {
|
||||
const loading = this.setLoading();
|
||||
listDatasource().then(res => {
|
||||
this.list = res.data;
|
||||
if (selectedKey) {
|
||||
this.handleListClick({id: selectedKey})
|
||||
} else if (this.list && this.list.length > 0) {
|
||||
this.handleListClick({id: this.list[0].id})
|
||||
}
|
||||
loading.close();
|
||||
})
|
||||
},
|
||||
handleListClick(item) {
|
||||
const loading = this.setLoading();
|
||||
this.selectedKey = item.id;
|
||||
getDatasource(item.id).then(res => {
|
||||
this.form = res.data;
|
||||
if (!this.form.header) {
|
||||
this.form.header = []
|
||||
} else {
|
||||
this.form.header = JSON.parse(this.form.header);
|
||||
}
|
||||
this.form.header.push({
|
||||
key: "",
|
||||
value: ""
|
||||
})
|
||||
})
|
||||
loading.close();
|
||||
},
|
||||
handleAdd(type) {
|
||||
this.$prompt('请输入名称', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
inputPattern: /^(?!\s*$).+/,
|
||||
inputErrorMessage: '名称不能为空'
|
||||
}).then(({value}) => {
|
||||
if (value) {
|
||||
const loading = this.setLoading();
|
||||
addDatasource({
|
||||
name: value,
|
||||
type: type
|
||||
}).then(res => {
|
||||
this.$message.success("添加成功")
|
||||
this.getData(res.data.id);
|
||||
loading.close();
|
||||
})
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
save() {
|
||||
updateDatasource(this.form).then(res => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.getData();
|
||||
})
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
del() {
|
||||
this.$modal.confirm('是否确认删除?').then(() => {
|
||||
return delDatasource(this.selectedKey);
|
||||
}).then(() => {
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
this.selectedKey = "";
|
||||
this.getData();
|
||||
})
|
||||
},
|
||||
handleAdd() {
|
||||
|
||||
setLoading() {
|
||||
return this.$loading({
|
||||
lock: true,
|
||||
text: 'Loading',
|
||||
spinner: 'el-icon-loading',
|
||||
background: 'rgba(0, 0, 0, 0.7)'
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.footer {
|
||||
text-align: right;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.header {
|
||||
font-weight: bold;
|
||||
line-height: 45px;
|
||||
border-bottom: 1px solid #eee;
|
||||
margin-bottom: 5px;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
padding-left: 10px;
|
||||
}
|
||||
|
||||
.list {
|
||||
.item {
|
||||
padding: 0 20px;
|
||||
cursor: pointer;
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
border-right: 2px solid #eee;
|
||||
}
|
||||
|
||||
.item.is-active {
|
||||
color: var(--current-color);
|
||||
border-right: 2px solid var(--current-color);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
222
test-ui/src/views/test/resource/http.vue
Normal file
222
test-ui/src/views/test/resource/http.vue
Normal file
@@ -0,0 +1,222 @@
|
||||
<template>
|
||||
<el-container>
|
||||
<el-aside style="width: 180px; padding: 0">
|
||||
<div class="header">
|
||||
<div>HTTP Server</div>
|
||||
<div>
|
||||
<el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAdd" circle/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="list" v-if="list && list.length > 0">
|
||||
<div v-for="item in list" :key="item.id" :class="'item'+(selectedKey === item.id ? ' is-active' : '')" @click="handleListClick(item)">{{ item.name }}</div>
|
||||
</div>
|
||||
<el-empty v-else description="暂无数据" :image-size="100"/>
|
||||
</el-aside>
|
||||
<el-main>
|
||||
<div v-if="selectedKey">
|
||||
<el-form :model="form" ref="form">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="24">
|
||||
<el-form-item label="HTTP Server名称" prop="name">
|
||||
<el-input v-model="form.name" placeholder="请输入HTTP Server名称"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="协议" prop="protocol">
|
||||
<el-select v-model="form.protocol">
|
||||
<el-option v-for="dict in dict.type.http_protocol" :key="dict.value" :label="dict.label" :value="dict.value"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="主机" prop="host">
|
||||
<el-input v-model="form.host" placeholder="请输入主机地址"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="端口" prop="port">
|
||||
<el-input v-model="form.port" placeholder="请输入端口号"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="前置路径" prop="basePath">
|
||||
<el-input v-model="form.basePath" placeholder="请输入前置路径,格式为/**"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-table :data="form.header">
|
||||
<el-table-column label="参数名">
|
||||
<template slot-scope="scope">
|
||||
<el-input placeholder="请输入参数名" v-model="form.header[scope.$index].key" @input="e => handleTableEdit(e, scope)" clearable/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="示例值">
|
||||
<template slot-scope="scope">
|
||||
<el-input placeholder="请输入参数名" v-model="form.header[scope.$index].value" @input="e => handleTableEdit(e, scope)" clearable/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="60">
|
||||
<template slot-scope="scope">
|
||||
<el-button v-if="form.header.length > scope.$index+1" size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<div class="footer">
|
||||
<el-button type="primary" @click="save">保 存</el-button>
|
||||
<el-button type="danger" @click="del">删除</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<el-empty v-else description="暂无数据" />
|
||||
</el-main>
|
||||
</el-container>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {addHttp, delHttp, getHttp, listHttp, updateHttp} from "@/api/test/http";
|
||||
|
||||
export default {
|
||||
name: 'Http',
|
||||
dicts: ["http_protocol"],
|
||||
data() {
|
||||
return {
|
||||
list: [],
|
||||
selectedKey: "",
|
||||
form: {
|
||||
name: "",
|
||||
protocol: "",
|
||||
host: "",
|
||||
port: "",
|
||||
basePath: "",
|
||||
header: [{
|
||||
key: "",
|
||||
value: "",
|
||||
}],
|
||||
},
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getData();
|
||||
},
|
||||
methods: {
|
||||
getData(key) {
|
||||
const loading = this.setLoading();
|
||||
listHttp().then(res => {
|
||||
this.list = res.data;
|
||||
if (key) {
|
||||
this.handleListClick({id: key})
|
||||
} else if (this.list && this.list.length > 0) {
|
||||
this.handleListClick({id: this.list[0].id})
|
||||
}
|
||||
loading.close();
|
||||
})
|
||||
},
|
||||
handleTableEdit(e, scope) {
|
||||
if (e && this.form.header.length === scope.$index + 1) {
|
||||
this.form.header.push({
|
||||
key: "",
|
||||
value: ""
|
||||
})
|
||||
}
|
||||
},
|
||||
handleDelete(scope) {
|
||||
this.form.header.splice(scope.$index, 1)
|
||||
},
|
||||
handleListClick(item) {
|
||||
const loading = this.setLoading();
|
||||
this.selectedKey = item.id;
|
||||
getHttp(item.id).then(res => {
|
||||
this.form = res.data;
|
||||
if (!this.form.header) {
|
||||
this.form.header = []
|
||||
} else {
|
||||
this.form.header = JSON.parse(this.form.header);
|
||||
}
|
||||
this.form.header.push({
|
||||
key: "",
|
||||
value: ""
|
||||
})
|
||||
})
|
||||
loading.close();
|
||||
},
|
||||
handleAdd() {
|
||||
this.$prompt('请输入名称', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
inputPattern: /^(?!\s*$).+/,
|
||||
inputErrorMessage: '名称不能为空'
|
||||
}).then(({ value }) => {
|
||||
if (value) {
|
||||
const loading = this.setLoading();
|
||||
addHttp({name: value}).then(res => {
|
||||
this.$message.success("添加成功")
|
||||
this.getData(res.data.id);
|
||||
loading.close();
|
||||
})
|
||||
}
|
||||
});
|
||||
},
|
||||
save() {
|
||||
this.form.header.pop();
|
||||
updateHttp({
|
||||
...this.form,
|
||||
header: JSON.stringify(this.form.header)
|
||||
}).then(res => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.getData();
|
||||
})
|
||||
},
|
||||
del() {
|
||||
this.$modal.confirm('是否确认删除?').then(() => {
|
||||
return delHttp(this.selectedKey);
|
||||
}).then(() => {
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
this.selectedKey = "";
|
||||
this.getData();
|
||||
})
|
||||
},
|
||||
setLoading() {
|
||||
return this.$loading({
|
||||
lock: true,
|
||||
text: 'Loading',
|
||||
spinner: 'el-icon-loading',
|
||||
background: 'rgba(0, 0, 0, 0.7)'
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.footer {
|
||||
text-align: right;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.header {
|
||||
font-weight: bold;
|
||||
line-height: 45px;
|
||||
border-bottom: 1px solid #eee;
|
||||
margin-bottom: 5px;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
padding-left: 10px;
|
||||
}
|
||||
|
||||
.list {
|
||||
.item {
|
||||
padding: 0 20px;
|
||||
cursor: pointer;
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
border-right: 2px solid #eee;
|
||||
}
|
||||
|
||||
.item.is-active {
|
||||
color: var(--current-color);
|
||||
border-right: 2px solid var(--current-color);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,8 +1,8 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-tabs tab-position="left" style="height: 200px;">
|
||||
<el-tabs>
|
||||
<el-tab-pane label="http 服务器">
|
||||
123
|
||||
<http/>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="数据库数据源">
|
||||
<database/>
|
||||
@@ -14,10 +14,11 @@
|
||||
<script>
|
||||
|
||||
import Database from "@/views/test/resource/database.vue";
|
||||
import Http from "@/views/test/resource/http.vue";
|
||||
|
||||
export default {
|
||||
name: "Resource",
|
||||
components: {Database},
|
||||
components: {Http, Database},
|
||||
methods: {}
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user