diff --git a/test-admin/pom.xml b/test-admin/pom.xml index 14e0dba..b22f28e 100644 --- a/test-admin/pom.xml +++ b/test-admin/pom.xml @@ -61,9 +61,6 @@ org.springframework.boot spring-boot-maven-plugin 2.5.15 - - true - diff --git a/test-test/src/main/java/com/test/test/controller/TestApiController.java b/test-test/src/main/java/com/test/test/controller/TestApiController.java index 93ef420..9cf1d94 100644 --- a/test-test/src/main/java/com/test/test/controller/TestApiController.java +++ b/test-test/src/main/java/com/test/test/controller/TestApiController.java @@ -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") diff --git a/test-test/src/main/java/com/test/test/controller/TestCaseController.java b/test-test/src/main/java/com/test/test/controller/TestCaseController.java new file mode 100644 index 0000000..f668c37 --- /dev/null +++ b/test-test/src/main/java/com/test/test/controller/TestCaseController.java @@ -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 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())); + } +} diff --git a/test-test/src/main/java/com/test/test/controller/TestDatasourceController.java b/test-test/src/main/java/com/test/test/controller/TestDatasourceController.java new file mode 100644 index 0000000..0eb56cc --- /dev/null +++ b/test-test/src/main/java/com/test/test/controller/TestDatasourceController.java @@ -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 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())); + } +} diff --git a/test-test/src/main/java/com/test/test/controller/TestGroupController.java b/test-test/src/main/java/com/test/test/controller/TestGroupController.java index 2ef9a9c..f2f7a74 100644 --- a/test-test/src/main/java/com/test/test/controller/TestGroupController.java +++ b/test-test/src/main/java/com/test/test/controller/TestGroupController.java @@ -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 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)); diff --git a/test-test/src/main/java/com/test/test/controller/TestHttpController.java b/test-test/src/main/java/com/test/test/controller/TestHttpController.java new file mode 100644 index 0000000..eb28457 --- /dev/null +++ b/test-test/src/main/java/com/test/test/controller/TestHttpController.java @@ -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())); + } +} diff --git a/test-test/src/main/java/com/test/test/domain/TestDatasource.java b/test-test/src/main/java/com/test/test/domain/TestDatasource.java new file mode 100644 index 0000000..7c1eb1b --- /dev/null +++ b/test-test/src/main/java/com/test/test/domain/TestDatasource.java @@ -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; +} diff --git a/test-test/src/main/java/com/test/test/domain/TestHttp.java b/test-test/src/main/java/com/test/test/domain/TestHttp.java new file mode 100644 index 0000000..5c94026 --- /dev/null +++ b/test-test/src/main/java/com/test/test/domain/TestHttp.java @@ -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; +} diff --git a/test-test/src/main/java/com/test/test/domain/dto/SwaggerInfo.java b/test-test/src/main/java/com/test/test/domain/dto/SwaggerInfo.java deleted file mode 100644 index 9afe569..0000000 --- a/test-test/src/main/java/com/test/test/domain/dto/SwaggerInfo.java +++ /dev/null @@ -1,4 +0,0 @@ -package com.test.test.domain.dto; - -public class SwaggerInfo { -} diff --git a/test-test/src/main/java/com/test/test/domain/qo/TestCaseListQO.java b/test-test/src/main/java/com/test/test/domain/qo/TestCaseListQO.java new file mode 100644 index 0000000..56ed405 --- /dev/null +++ b/test-test/src/main/java/com/test/test/domain/qo/TestCaseListQO.java @@ -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; +} diff --git a/test-test/src/main/java/com/test/test/mapper/TestCaseMapper.java b/test-test/src/main/java/com/test/test/mapper/TestCaseMapper.java index 6a428e7..9b224eb 100644 --- a/test-test/src/main/java/com/test/test/mapper/TestCaseMapper.java +++ b/test-test/src/main/java/com/test/test/mapper/TestCaseMapper.java @@ -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 selectTestCaseList(TestCase testCase); + List 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); } diff --git a/test-test/src/main/java/com/test/test/mapper/TestDatasourceMapper.java b/test-test/src/main/java/com/test/test/mapper/TestDatasourceMapper.java new file mode 100644 index 0000000..3edf8da --- /dev/null +++ b/test-test/src/main/java/com/test/test/mapper/TestDatasourceMapper.java @@ -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 selectTestDatasourceList(); + + /** + * 新增数据源 + */ + int insertTestDatasource(TestDatasource testDatasource); + + /** + * 修改数据源 + */ + int updateTestDatasource(TestDatasource testDatasource); + + /** + * 删除数据源 + */ + int deleteTestDatasourceById(Long id); + + /** + * 批量删除数据源 + */ + int deleteTestDatasourceByIds(Long[] ids); +} diff --git a/test-test/src/main/java/com/test/test/mapper/TestGroupMapper.java b/test-test/src/main/java/com/test/test/mapper/TestGroupMapper.java index 275fbf5..856a20a 100644 --- a/test-test/src/main/java/com/test/test/mapper/TestGroupMapper.java +++ b/test-test/src/main/java/com/test/test/mapper/TestGroupMapper.java @@ -33,4 +33,5 @@ public interface TestGroupMapper */ int deleteTestGroupByIds(List ids); + TestGroup selectGroup(String name, Long parentId, String type); } diff --git a/test-test/src/main/java/com/test/test/mapper/TestHttpMapper.java b/test-test/src/main/java/com/test/test/mapper/TestHttpMapper.java new file mode 100644 index 0000000..61948ea --- /dev/null +++ b/test-test/src/main/java/com/test/test/mapper/TestHttpMapper.java @@ -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 selectTestHttpList(); + + /** + * 新增http服务 + */ + int insertTestHttp(TestHttp testHttp); + + /** + * 修改http服务 + */ + int updateTestHttp(TestHttp testHttp); + + /** + * 删除http服务 + */ + int deleteTestHttpById(Long id); + + /** + * 批量删除http服务 + */ + int deleteTestHttpByIds(Long[] ids); +} diff --git a/test-test/src/main/java/com/test/test/service/ITestCaseService.java b/test-test/src/main/java/com/test/test/service/ITestCaseService.java index 89c3b13..0f3d58a 100644 --- a/test-test/src/main/java/com/test/test/service/ITestCaseService.java +++ b/test-test/src/main/java/com/test/test/service/ITestCaseService.java @@ -1,9 +1,5 @@ package com.test.test.service; -import com.test.test.domain.TestCase; - -import java.util.List; - /** * 用例Service接口 * diff --git a/test-test/src/main/java/com/test/test/service/ITestDatasourceService.java b/test-test/src/main/java/com/test/test/service/ITestDatasourceService.java new file mode 100644 index 0000000..17a31c9 --- /dev/null +++ b/test-test/src/main/java/com/test/test/service/ITestDatasourceService.java @@ -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 selectTestDatasourceList(); + + /** + * 新增数据源 + */ + TestDatasource insertTestDatasource(TestDatasource testDatasource); + + /** + * 修改数据源 + */ + int updateTestDatasource(TestDatasource testDatasource); + + /** + * 批量删除数据源 + */ + int deleteTestDatasourceByIds(Long[] ids); + + /** + * 删除数据源信息 + */ + int deleteTestDatasourceById(Long id); +} diff --git a/test-test/src/main/java/com/test/test/service/ITestGroupService.java b/test-test/src/main/java/com/test/test/service/ITestGroupService.java index 5ab13c7..9b6f744 100644 --- a/test-test/src/main/java/com/test/test/service/ITestGroupService.java +++ b/test-test/src/main/java/com/test/test/service/ITestGroupService.java @@ -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); + /** * 修改节点(文件夹) */ diff --git a/test-test/src/main/java/com/test/test/service/ITestHttpService.java b/test-test/src/main/java/com/test/test/service/ITestHttpService.java new file mode 100644 index 0000000..7ec24ec --- /dev/null +++ b/test-test/src/main/java/com/test/test/service/ITestHttpService.java @@ -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 selectTestHttpList(); + + /** + * 新增http服务 + */ + TestHttp insertTestHttp(TestHttp testHttp); + + /** + * 修改http服务 + */ + int updateTestHttp(TestHttp testHttp); + + /** + * 批量删除http服务 + */ + int deleteTestHttpByIds(Long[] ids); + + /** + * 删除http服务信息 + */ + int deleteTestHttpById(Long id); +} diff --git a/test-test/src/main/java/com/test/test/service/impl/TestApiServiceImpl.java b/test-test/src/main/java/com/test/test/service/impl/TestApiServiceImpl.java index 7b4ad91..b4e1fbb 100644 --- a/test-test/src/main/java/com/test/test/service/impl/TestApiServiceImpl.java +++ b/test-test/src/main/java/com/test/test/service/impl/TestApiServiceImpl.java @@ -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 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 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 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(); } /** diff --git a/test-test/src/main/java/com/test/test/service/impl/TestDatasourceServiceImpl.java b/test-test/src/main/java/com/test/test/service/impl/TestDatasourceServiceImpl.java new file mode 100644 index 0000000..38fb7e7 --- /dev/null +++ b/test-test/src/main/java/com/test/test/service/impl/TestDatasourceServiceImpl.java @@ -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 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); + } +} diff --git a/test-test/src/main/java/com/test/test/service/impl/TestGroupServiceImpl.java b/test-test/src/main/java/com/test/test/service/impl/TestGroupServiceImpl.java index c6974f7..c5259a7 100644 --- a/test-test/src/main/java/com/test/test/service/impl/TestGroupServiceImpl.java +++ b/test-test/src/main/java/com/test/test/service/impl/TestGroupServiceImpl.java @@ -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); + } + /** * 修改节点(文件夹) */ diff --git a/test-test/src/main/java/com/test/test/service/impl/TestHttpServiceImpl.java b/test-test/src/main/java/com/test/test/service/impl/TestHttpServiceImpl.java new file mode 100644 index 0000000..c78e6d8 --- /dev/null +++ b/test-test/src/main/java/com/test/test/service/impl/TestHttpServiceImpl.java @@ -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 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); + } +} diff --git a/test-test/src/main/resources/mapper/test/TestApiMapper.xml b/test-test/src/main/resources/mapper/test/TestApiMapper.xml index 5446865..5188abc 100644 --- a/test-test/src/main/resources/mapper/test/TestApiMapper.xml +++ b/test-test/src/main/resources/mapper/test/TestApiMapper.xml @@ -28,11 +28,12 @@ - and case_id = #{caseId} - and oper_type = #{operType} - and oper_detail = #{operDetail} - and oper_user = #{operUser} - and oper_time = #{operTime} + and case_id = #{caseId} + and oper_type = #{operType} + and oper_detail = #{operDetail} + and oper_user = #{operUser} + and oper_time = #{operTime} @@ -41,14 +42,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" oper_detail, oper_user, oper_time, - + #{caseId}, #{operType}, #{operDetail}, #{operUser}, #{operTime}, - + @@ -64,7 +65,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - delete from test_case_log where id = #{id} + delete + from test_case_log + where id = #{id} diff --git a/test-test/src/main/resources/mapper/test/TestCaseMapper.xml b/test-test/src/main/resources/mapper/test/TestCaseMapper.xml index f926e89..846430e 100644 --- a/test-test/src/main/resources/mapper/test/TestCaseMapper.xml +++ b/test-test/src/main/resources/mapper/test/TestCaseMapper.xml @@ -1,36 +1,44 @@ + PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - - - - - - - - - - - + + + + + + + + + + + - 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 - - and group_id = #{groupId} - and project_id = #{projectId} - and name like concat('%', #{name}, '%') - and importance = #{importance} - and status = #{status} + group_id = #{groupId} + order by create_time desc - and parent_id = #{parentId} - and case_id = #{caseId} - and name like concat('%', #{name}, '%') - and step_num = #{stepNum} - and type = #{type} - and request_method = #{requestMethod} - and request_url = #{requestUrl} - and request_body = #{requestBody} - and request_header = #{requestHeader} - and request_params = #{requestParams} - and api_http_id = #{apiHttpId} - and api_host = #{apiHost} - and api_port = #{apiPort} - and api_protocol = #{apiProtocol} - and sql_command = #{sqlCommand} - and count = #{count} - and async = #{async} - and interval = #{interval} - and break_error = #{breakError} - and pre_script = #{preScript} - and post_script = #{postScript} - and assignment = #{assignment} - and assertion = #{assertion} + and parent_id = #{parentId} + and case_id = #{caseId} + and name like concat('%', #{name}, '%') + and step_num = #{stepNum} + and type = #{type} + and request_method = #{requestMethod} + and request_url = #{requestUrl} + and request_body = #{requestBody} + and request_header = #{requestHeader} + and request_params = #{requestParams} + and api_http_id = #{apiHttpId} + and api_host = #{apiHost} + and api_port = #{apiPort} + and api_protocol = #{apiProtocol} + and sql_command = #{sqlCommand} + and count = #{count} + and async = #{async} + and interval = #{interval} + and break_error = #{breakError} + and pre_script = #{preScript} + and post_script = #{postScript} + and assignment = #{assignment} + and assertion = #{assertion} ORDER BY step_num @@ -106,7 +135,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" create_time, update_by, update_time, - + #{parentId}, #{caseId}, @@ -136,7 +165,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{createTime}, #{updateBy}, #{updateTime}, - + @@ -175,7 +204,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - delete from test_case_step where id = #{id} + delete + from test_case_step + where id = #{id} diff --git a/test-test/src/main/resources/mapper/test/TestDatasourceMapper.xml b/test-test/src/main/resources/mapper/test/TestDatasourceMapper.xml new file mode 100644 index 0000000..e009d8d --- /dev/null +++ b/test-test/src/main/resources/mapper/test/TestDatasourceMapper.xml @@ -0,0 +1,109 @@ + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + + + + + + + insert into test_datasource + + name, + type, + host, + port, + username, + password, + db_name, + auth_db, + cluster, + master_name, + del_flag, + create_by, + create_time, + update_by, + update_time, + + + #{name}, + #{type}, + #{host}, + #{port}, + #{username}, + #{password}, + #{dbName}, + #{authDb}, + #{cluster}, + #{masterName}, + #{delFlag}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update test_datasource + + name = #{name}, + type = #{type}, + host = #{host}, + port = #{port}, + username = #{username}, + password = #{password}, + db_name = #{dbName}, + auth_db = #{authDb}, + cluster = #{cluster}, + master_name = #{masterName}, + del_flag = #{delFlag}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where id = #{id} + + + + delete from test_datasource where id = #{id} + + + + delete from test_datasource where id in + + #{id} + + + \ No newline at end of file diff --git a/test-test/src/main/resources/mapper/test/TestGroupMapper.xml b/test-test/src/main/resources/mapper/test/TestGroupMapper.xml index 29ef807..f8c562c 100644 --- a/test-test/src/main/resources/mapper/test/TestGroupMapper.xml +++ b/test-test/src/main/resources/mapper/test/TestGroupMapper.xml @@ -5,19 +5,28 @@ - - - - - - - - - + + + + + + + + + - 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 + + insert into test_group diff --git a/test-test/src/main/resources/mapper/test/TestHttpMapper.xml b/test-test/src/main/resources/mapper/test/TestHttpMapper.xml new file mode 100644 index 0000000..be2cf60 --- /dev/null +++ b/test-test/src/main/resources/mapper/test/TestHttpMapper.xml @@ -0,0 +1,107 @@ + + + + + + + + + + + + + + + + + + + + + select id, + name, + protocol, + host, + port, + basePath, + header, + del_flag, + create_by, + create_time, + update_by, + update_time + from test_http + + + + + + + + insert into test_http + + name, + protocol, + host, + port, + basePath, + header, + del_flag, + create_by, + create_time, + update_by, + update_time, + + + #{name}, + #{protocol}, + #{host}, + #{port}, + #{basePath}, + #{header}, + #{delFlag}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update test_http + + name = #{name}, + protocol = #{protocol}, + host = #{host}, + port = #{port}, + basePath = #{basePath}, + header = #{header}, + del_flag = #{delFlag}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where id = #{id} + + + + delete + from test_http + where id = #{id} + + + + delete from test_http where id in + + #{id} + + + \ No newline at end of file diff --git a/test-ui/src/api/test/api.js b/test-ui/src/api/test/api.js index bda0365..9eaac71 100644 --- a/test-ui/src/api/test/api.js +++ b/test-ui/src/api/test/api.js @@ -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 }) } diff --git a/test-ui/src/api/test/case.js b/test-ui/src/api/test/case.js new file mode 100644 index 0000000..145b553 --- /dev/null +++ b/test-ui/src/api/test/case.js @@ -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} + }) +} diff --git a/test-ui/src/api/test/database.js b/test-ui/src/api/test/database.js new file mode 100644 index 0000000..696e32d --- /dev/null +++ b/test-ui/src/api/test/database.js @@ -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} + }) +} diff --git a/test-ui/src/api/test/http.js b/test-ui/src/api/test/http.js new file mode 100644 index 0000000..7ee5269 --- /dev/null +++ b/test-ui/src/api/test/http.js @@ -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} + }) +} diff --git a/test-ui/src/assets/icons/svg/1.svg b/test-ui/src/assets/icons/svg/1.svg new file mode 100644 index 0000000..f0d7dc1 --- /dev/null +++ b/test-ui/src/assets/icons/svg/1.svg @@ -0,0 +1,50 @@ + + + + diff --git a/test-ui/src/assets/icons/svg/2.svg b/test-ui/src/assets/icons/svg/2.svg new file mode 100644 index 0000000..f639310 --- /dev/null +++ b/test-ui/src/assets/icons/svg/2.svg @@ -0,0 +1,49 @@ + + + + diff --git a/test-ui/src/assets/icons/svg/3.svg b/test-ui/src/assets/icons/svg/3.svg new file mode 100644 index 0000000..9adf838 --- /dev/null +++ b/test-ui/src/assets/icons/svg/3.svg @@ -0,0 +1,23 @@ + + + + diff --git a/test-ui/src/assets/icons/svg/4.svg b/test-ui/src/assets/icons/svg/4.svg new file mode 100644 index 0000000..d3226ad --- /dev/null +++ b/test-ui/src/assets/icons/svg/4.svg @@ -0,0 +1,29 @@ + + + + diff --git a/test-ui/src/assets/icons/svg/5.svg b/test-ui/src/assets/icons/svg/5.svg new file mode 100644 index 0000000..85a4d5e --- /dev/null +++ b/test-ui/src/assets/icons/svg/5.svg @@ -0,0 +1,12 @@ + + + + diff --git a/test-ui/src/assets/icons/svg/6.svg b/test-ui/src/assets/icons/svg/6.svg new file mode 100644 index 0000000..a4dbd7d --- /dev/null +++ b/test-ui/src/assets/icons/svg/6.svg @@ -0,0 +1,17 @@ + + + + diff --git a/test-ui/src/components/FolderPage/index.vue b/test-ui/src/components/FolderPage/index.vue index f0e6b65..4557f0c 100644 --- a/test-ui/src/components/FolderPage/index.vue +++ b/test-ui/src/components/FolderPage/index.vue @@ -187,6 +187,7 @@ export default { } }); this.getGroup(openList); + this.$emit('click', res.data.id); }); } else { updateGroup({ diff --git a/test-ui/src/router/index.js b/test-ui/src/router/index.js index 6d39578..d27ec4b 100644 --- a/test-ui/src/router/index.js +++ b/test-ui/src/router/index.js @@ -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' } } ] }, diff --git a/test-ui/src/views/test/api/add.vue b/test-ui/src/views/test/api/add.vue index 2b8bc7e..69c4857 100644 --- a/test-ui/src/views/test/api/add.vue +++ b/test-ui/src/views/test/api/add.vue @@ -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; } diff --git a/test-ui/src/views/test/api/edit.vue b/test-ui/src/views/test/api/edit.vue index d948641..1feb255 100644 --- a/test-ui/src/views/test/api/edit.vue +++ b/test-ui/src/views/test/api/edit.vue @@ -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; } diff --git a/test-ui/src/views/test/api/import.vue b/test-ui/src/views/test/api/import.vue deleted file mode 100644 index dbd3049..0000000 --- a/test-ui/src/views/test/api/import.vue +++ /dev/null @@ -1,27 +0,0 @@ - - - - - diff --git a/test-ui/src/views/test/api/index.vue b/test-ui/src/views/test/api/index.vue index f4d4d26..9fba0dd 100644 --- a/test-ui/src/views/test/api/index.vue +++ b/test-ui/src/views/test/api/index.vue @@ -1,47 +1,63 @@ diff --git a/test-ui/src/views/test/case/detail.vue b/test-ui/src/views/test/case/detail.vue new file mode 100644 index 0000000..5592e15 --- /dev/null +++ b/test-ui/src/views/test/case/detail.vue @@ -0,0 +1,16 @@ + + + + + diff --git a/test-ui/src/views/test/case/index.vue b/test-ui/src/views/test/case/index.vue index 89de1e1..471c478 100644 --- a/test-ui/src/views/test/case/index.vue +++ b/test-ui/src/views/test/case/index.vue @@ -1,30 +1,102 @@ diff --git a/test-ui/src/views/test/resource/database.vue b/test-ui/src/views/test/resource/database.vue index c6a1e2f..82197dc 100644 --- a/test-ui/src/views/test/resource/database.vue +++ b/test-ui/src/views/test/resource/database.vue @@ -1,69 +1,221 @@ - diff --git a/test-ui/src/views/test/resource/http.vue b/test-ui/src/views/test/resource/http.vue new file mode 100644 index 0000000..498ec0b --- /dev/null +++ b/test-ui/src/views/test/resource/http.vue @@ -0,0 +1,222 @@ + + + + + diff --git a/test-ui/src/views/test/resource/index.vue b/test-ui/src/views/test/resource/index.vue index 51a1520..5b80c99 100644 --- a/test-ui/src/views/test/resource/index.vue +++ b/test-ui/src/views/test/resource/index.vue @@ -1,8 +1,8 @@