From 2215b4bd50da82021324a45d14abc6294aa7f34b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E6=98=B1=E6=B6=B5?= Date: Wed, 12 Feb 2025 15:53:59 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B4=E7=90=86=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/test/test/mapper/TestApiMapper.java | 16 +++++----- .../test/test/service/ITestApiService.java | 16 +++++----- .../test/service/impl/TestApiServiceImpl.java | 11 ++----- .../service/impl/TestGroupServiceImpl.java | 4 +++ .../resources/mapper/test/TestApiMapper.xml | 7 ++--- test-ui/src/router/index.js | 30 ++++++++++++++++++- test-ui/src/views/test/api/edit.vue | 27 +++++++++++++++++ test-ui/src/views/test/api/import.vue | 27 +++++++++++++++++ test-ui/src/views/test/api/index.vue | 6 +++- 9 files changed, 112 insertions(+), 32 deletions(-) create mode 100644 test-ui/src/views/test/api/edit.vue create mode 100644 test-ui/src/views/test/api/import.vue diff --git a/test-test/src/main/java/com/test/test/mapper/TestApiMapper.java b/test-test/src/main/java/com/test/test/mapper/TestApiMapper.java index 303ce5a..c2564d0 100644 --- a/test-test/src/main/java/com/test/test/mapper/TestApiMapper.java +++ b/test-test/src/main/java/com/test/test/mapper/TestApiMapper.java @@ -17,7 +17,7 @@ public interface TestApiMapper { * @param id 接口主键 * @return 接口 */ - public TestApi selectTestApiById(Long id); + TestApi selectTestApiById(Long id); /** * 查询接口列表 @@ -25,7 +25,7 @@ public interface TestApiMapper { * @param qo 接口 * @return 接口集合 */ - public List selectTestApiList(TestApiListQO qo); + List selectTestApiList(TestApiListQO qo); /** * 新增接口 @@ -33,7 +33,7 @@ public interface TestApiMapper { * @param testApi 接口 * @return 结果 */ - public int insertTestApi(TestApi testApi); + int insertTestApi(TestApi testApi); /** * 修改接口 @@ -41,7 +41,7 @@ public interface TestApiMapper { * @param testApi 接口 * @return 结果 */ - public int updateTestApi(TestApi testApi); + int updateTestApi(TestApi testApi); /** * 删除接口 @@ -49,13 +49,13 @@ public interface TestApiMapper { * @param id 接口主键 * @return 结果 */ - public int deleteTestApiById(Long id); + int deleteTestApiById(Long id); /** - * 批量删除接口 + * 批量删除接口(通过节点id) * - * @param ids 需要删除的数据主键集合 + * @param groupId 需要删除的接口主键集合 * @return 结果 */ - public int deleteTestApiByIds(Long[] ids); + int deleteTestApiByGroupId(Long groupId); } diff --git a/test-test/src/main/java/com/test/test/service/ITestApiService.java b/test-test/src/main/java/com/test/test/service/ITestApiService.java index 87a2d52..2b15457 100644 --- a/test-test/src/main/java/com/test/test/service/ITestApiService.java +++ b/test-test/src/main/java/com/test/test/service/ITestApiService.java @@ -17,7 +17,7 @@ public interface ITestApiService { * @param id 接口主键 * @return 接口 */ - public TestApi selectTestApiById(Long id); + TestApi selectTestApiById(Long id); /** * 查询接口列表 @@ -25,7 +25,7 @@ public interface ITestApiService { * @param qo 接口 * @return 接口集合 */ - public List selectTestApiList(TestApiListQO qo); + List selectTestApiList(TestApiListQO qo); /** * 新增接口 @@ -33,7 +33,7 @@ public interface ITestApiService { * @param testApi 接口 * @return 结果 */ - public int insertTestApi(TestApi testApi); + int insertTestApi(TestApi testApi); /** * 导入Swagger接口 @@ -49,15 +49,15 @@ public interface ITestApiService { * @param testApi 接口 * @return 结果 */ - public int updateTestApi(TestApi testApi); + int updateTestApi(TestApi testApi); /** - * 批量删除接口 + * 批量删除接口(通过节点id) * - * @param ids 需要删除的接口主键集合 + * @param groupId 需要删除的接口主键集合 * @return 结果 */ - public int deleteTestApiByIds(Long[] ids); + int deleteTestApiByGroupId(Long groupId); /** * 删除接口信息 @@ -65,5 +65,5 @@ public interface ITestApiService { * @param id 接口主键 * @return 结果 */ - public int deleteTestApiById(Long id); + int deleteTestApiById(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 3ed7868..48661be 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 @@ -2,7 +2,6 @@ package com.test.test.service.impl; import java.util.List; -import com.alibaba.fastjson2.JSON; import com.alibaba.fastjson2.JSONObject; import com.test.common.utils.DateUtils; import com.test.common.utils.http.HttpUtils; @@ -75,15 +74,9 @@ public class TestApiServiceImpl implements ITestApiService { return testApiMapper.updateTestApi(testApi); } - /** - * 批量删除接口 - * - * @param ids 需要删除的接口主键 - * @return 结果 - */ @Override - public int deleteTestApiByIds(Long[] ids) { - return testApiMapper.deleteTestApiByIds(ids); + public int deleteTestApiByGroupId(Long groupId) { + return testApiMapper.deleteTestApiByGroupId(groupId); } /** 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 be769d2..a19e996 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 @@ -20,6 +20,9 @@ public class TestGroupServiceImpl implements ITestGroupService { @Resource private TestGroupMapper testGroupMapper; + @Resource + private TestApiServiceImpl testApiServiceImpl; + /** * 查询节点(文件夹)列表 * @@ -64,6 +67,7 @@ public class TestGroupServiceImpl implements ITestGroupService { */ @Override public int deleteTestGroupById(Long id) { + return testGroupMapper.deleteTestGroupById(id); } } diff --git a/test-test/src/main/resources/mapper/test/TestApiMapper.xml b/test-test/src/main/resources/mapper/test/TestApiMapper.xml index 89f4987..1879a7d 100644 --- a/test-test/src/main/resources/mapper/test/TestApiMapper.xml +++ b/test-test/src/main/resources/mapper/test/TestApiMapper.xml @@ -94,10 +94,7 @@ delete from test_api where id = #{id} - - delete from test_api where id in - - #{id} - + + delete from test_api where groupId = #{groupId} \ No newline at end of file diff --git a/test-ui/src/router/index.js b/test-ui/src/router/index.js index 8289a72..6d39578 100644 --- a/test-ui/src/router/index.js +++ b/test-ui/src/router/index.js @@ -101,7 +101,35 @@ export const constantRoutes = [ meta: { title: '添加接口', activeMenu: '/api' } } ] - } + }, + { + path: '/api/edit', + component: Layout, + hidden: true, + children: [ + { + path: '', + component: () => import('@/views/test/api/edit'), + name: 'ApiEdit', + noCache: true, + meta: { title: '修改接口', activeMenu: '/api' } + } + ] + }, + { + path: '/api/import', + component: Layout, + hidden: true, + children: [ + { + path: '', + component: () => import('@/views/test/api/import'), + name: 'ApiImport', + noCache: true, + meta: { title: '导入接口', activeMenu: '/api' } + } + ] + }, ] // 动态路由,基于用户权限动态去加载 diff --git a/test-ui/src/views/test/api/edit.vue b/test-ui/src/views/test/api/edit.vue new file mode 100644 index 0000000..672a7f1 --- /dev/null +++ b/test-ui/src/views/test/api/edit.vue @@ -0,0 +1,27 @@ + + + + + diff --git a/test-ui/src/views/test/api/import.vue b/test-ui/src/views/test/api/import.vue new file mode 100644 index 0000000..dbd3049 --- /dev/null +++ b/test-ui/src/views/test/api/import.vue @@ -0,0 +1,27 @@ + + + + + diff --git a/test-ui/src/views/test/api/index.vue b/test-ui/src/views/test/api/index.vue index e1a90a6..6d83f32 100644 --- a/test-ui/src/views/test/api/index.vue +++ b/test-ui/src/views/test/api/index.vue @@ -20,6 +20,7 @@ 新增 + 导入 @@ -112,9 +113,12 @@ export default { handleAdd() { this.$tab.openPage("添加接口", "/api/add", {groupId: this.queryParams.groupId}); }, + handleImport() { + this.$tab.openPage("导入接口", "/api/import", {groupId: this.queryParams.groupId}); + }, /** 修改按钮操作 */ handleUpdate(row) { - this.$tab.openPage("修改接口", "/api/add", {id: row.id || this.ids}); + this.$tab.openPage("修改接口", "/api/edit", {id: row.id}); }, /** 删除按钮操作 */ handleDelete(row) {