From 977722f2c21585813e05df7bdb9334fda643614d 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 14:01:27 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=87=E4=BB=B6=E5=A4=B9=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E9=87=8D=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/TestApiGroupController.java | 65 ----- .../test/controller/TestGroupController.java | 56 ++++ .../{TestApiGroup.java => TestGroup.java} | 11 +- .../test/test/mapper/TestApiGroupMapper.java | 43 --- .../com/test/test/mapper/TestGroupMapper.java | 54 ++++ .../test/service/ITestApiGroupService.java | 44 --- .../test/test/service/ITestGroupService.java | 44 +++ .../service/impl/TestApiGroupServiceImpl.java | 72 ----- .../service/impl/TestGroupServiceImpl.java | 69 +++++ ...ApiGroupMapper.xml => TestGroupMapper.xml} | 49 +++- test-ui/src/api/test/api.js | 36 --- test-ui/src/api/test/group.js | 37 +++ test-ui/src/components/FolderPage/index.vue | 239 ++++++++++++++++ test-ui/src/views/test/api/index.vue | 256 +++--------------- 14 files changed, 585 insertions(+), 490 deletions(-) delete mode 100644 test-test/src/main/java/com/test/test/controller/TestApiGroupController.java create mode 100644 test-test/src/main/java/com/test/test/controller/TestGroupController.java rename test-test/src/main/java/com/test/test/domain/{TestApiGroup.java => TestGroup.java} (75%) delete mode 100644 test-test/src/main/java/com/test/test/mapper/TestApiGroupMapper.java create mode 100644 test-test/src/main/java/com/test/test/mapper/TestGroupMapper.java delete mode 100644 test-test/src/main/java/com/test/test/service/ITestApiGroupService.java create mode 100644 test-test/src/main/java/com/test/test/service/ITestGroupService.java delete mode 100644 test-test/src/main/java/com/test/test/service/impl/TestApiGroupServiceImpl.java create mode 100644 test-test/src/main/java/com/test/test/service/impl/TestGroupServiceImpl.java rename test-test/src/main/resources/mapper/test/{TestApiGroupMapper.xml => TestGroupMapper.xml} (59%) create mode 100644 test-ui/src/api/test/group.js create mode 100644 test-ui/src/components/FolderPage/index.vue diff --git a/test-test/src/main/java/com/test/test/controller/TestApiGroupController.java b/test-test/src/main/java/com/test/test/controller/TestApiGroupController.java deleted file mode 100644 index 5944bca..0000000 --- a/test-test/src/main/java/com/test/test/controller/TestApiGroupController.java +++ /dev/null @@ -1,65 +0,0 @@ -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.TestApiGroup; -import com.test.test.service.ITestApiGroupService; - -/** - * 接口节点Controller - * - * @author xiaoe - */ -@RestController -@RequestMapping("/test/group") -public class TestApiGroupController extends BaseController { - @Resource - private ITestApiGroupService testApiGroupService; - - /** - * 查询接口节点列表 - */ - @GetMapping("/list") - public AjaxResult list() { - List list = testApiGroupService.selectTestApiGroupList(); - return success(list); - } - - /** - * 新增接口节点 - */ - @Log(title = "接口节点", businessType = BusinessType.INSERT) - @PostMapping("/add") - public AjaxResult add(@RequestBody TestApiGroup testApiGroup) { - return success(testApiGroupService.insertTestApiGroup(testApiGroup)); - } - - /** - * 修改接口节点 - */ - @Log(title = "接口节点", businessType = BusinessType.UPDATE) - @PostMapping("/edit") - public AjaxResult edit(@RequestBody TestApiGroup testApiGroup) { - return toAjax(testApiGroupService.updateTestApiGroup(testApiGroup)); - } - - /** - * 删除接口节点 - */ - @Log(title = "接口节点", businessType = BusinessType.DELETE) - @PostMapping("/del") - public AjaxResult remove(@RequestBody IDQO qo) { - return toAjax(testApiGroupService.deleteTestApiGroupById(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 new file mode 100644 index 0000000..8880769 --- /dev/null +++ b/test-test/src/main/java/com/test/test/controller/TestGroupController.java @@ -0,0 +1,56 @@ +package com.test.test.controller; + +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.TestGroup; +import com.test.test.domain.qo.IDQO; +import com.test.test.service.ITestGroupService; +import jakarta.annotation.Resource; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +@RestController +@RequestMapping("/test/group") +public class TestGroupController extends BaseController { + @Resource + private ITestGroupService testGroupService; + + /** + * 查询接口节点列表 + */ + @GetMapping("/list") + public AjaxResult list(String type) { + List list = testGroupService.selectTestGroupList(type); + return success(list); + } + + /** + * 新增接口节点 + */ + @Log(title = "接口节点", businessType = BusinessType.INSERT) + @PostMapping("/add") + public AjaxResult add(@RequestBody TestGroup testGroup) { + return success(testGroupService.insertTestGroup(testGroup)); + } + + /** + * 修改接口节点 + */ + @Log(title = "接口节点", businessType = BusinessType.UPDATE) + @PostMapping("/edit") + public AjaxResult edit(@RequestBody TestGroup testGroup) { + return toAjax(testGroupService.updateTestGroup(testGroup)); + } + + /** + * 删除接口节点 + */ + @Log(title = "接口节点", businessType = BusinessType.DELETE) + @PostMapping("/del") + public AjaxResult remove(@RequestBody IDQO qo) { + return toAjax(testGroupService.deleteTestGroupById(qo.getId())); + } +} diff --git a/test-test/src/main/java/com/test/test/domain/TestApiGroup.java b/test-test/src/main/java/com/test/test/domain/TestGroup.java similarity index 75% rename from test-test/src/main/java/com/test/test/domain/TestApiGroup.java rename to test-test/src/main/java/com/test/test/domain/TestGroup.java index e93f29b..33e721a 100644 --- a/test-test/src/main/java/com/test/test/domain/TestApiGroup.java +++ b/test-test/src/main/java/com/test/test/domain/TestGroup.java @@ -7,14 +7,14 @@ import lombok.ToString; import com.test.common.annotation.Excel; /** - * 接口节点对象 test_api_group - * + * 节点(文件夹)对象 test_group + * * @author xiaoe */ @Setter @Getter @ToString -public class TestApiGroup extends BaseEntity +public class TestGroup extends BaseEntity { /** 节点id */ private Long id; @@ -23,10 +23,15 @@ public class TestApiGroup extends BaseEntity @Excel(name = "父节点id") private Long parentId; + /** 节点类型 */ + @Excel(name = "节点类型") + private String type; + /** 节点名称 */ @Excel(name = "节点名称") private String name; /** 删除标志(0代表存在 2代表删除) */ private String delFlag; + } diff --git a/test-test/src/main/java/com/test/test/mapper/TestApiGroupMapper.java b/test-test/src/main/java/com/test/test/mapper/TestApiGroupMapper.java deleted file mode 100644 index 3b6d0e1..0000000 --- a/test-test/src/main/java/com/test/test/mapper/TestApiGroupMapper.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.test.test.mapper; - -import java.util.List; -import com.test.test.domain.TestApiGroup; - -/** - * 接口节点Mapper接口 - * - * @author xiaoe - */ -public interface TestApiGroupMapper -{ - /** - * 查询接口节点列表 - * - * @return 接口节点集合 - */ - public List selectTestApiGroupList(); - - /** - * 新增接口节点 - * - * @param testApiGroup 接口节点 - * @return 结果 - */ - public int insertTestApiGroup(TestApiGroup testApiGroup); - - /** - * 修改接口节点 - * - * @param testApiGroup 接口节点 - * @return 结果 - */ - public int updateTestApiGroup(TestApiGroup testApiGroup); - - /** - * 删除接口节点 - * - * @param id 接口节点主键 - * @return 结果 - */ - public int deleteTestApiGroupById(Long id); -} 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 new file mode 100644 index 0000000..969be5e --- /dev/null +++ b/test-test/src/main/java/com/test/test/mapper/TestGroupMapper.java @@ -0,0 +1,54 @@ +package com.test.test.mapper; + +import java.util.List; +import com.test.test.domain.TestGroup; + +/** + * 节点(文件夹)Mapper接口 + * + * @author xiaoe + * @date 2025-02-12 + */ +public interface TestGroupMapper +{ + /** + * 查询节点(文件夹) + * + * @param id 节点(文件夹)主键 + * @return 节点(文件夹) + */ + public TestGroup selectTestGroupById(Long id); + + /** + * 查询节点(文件夹)列表 + * + * @param type 节点类型 + * @return 节点(文件夹)集合 + */ + public List selectTestGroupList(String type); + + /** + * 新增节点(文件夹) + * + * @param testGroup 节点(文件夹) + * @return 结果 + */ + public int insertTestGroup(TestGroup testGroup); + + /** + * 修改节点(文件夹) + * + * @param testGroup 节点(文件夹) + * @return 结果 + */ + public int updateTestGroup(TestGroup testGroup); + + /** + * 删除节点(文件夹) + * + * @param id 节点(文件夹)主键 + * @return 结果 + */ + public int deleteTestGroupById(Long id); + +} diff --git a/test-test/src/main/java/com/test/test/service/ITestApiGroupService.java b/test-test/src/main/java/com/test/test/service/ITestApiGroupService.java deleted file mode 100644 index 13977e2..0000000 --- a/test-test/src/main/java/com/test/test/service/ITestApiGroupService.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.test.test.service; - -import java.util.List; - -import com.test.test.domain.TestApiGroup; - -/** - * 接口节点Service接口 - * - * @author xiaoe - */ -public interface ITestApiGroupService { - - /** - * 查询接口节点列表 - * - * @return 接口节点集合 - */ - public List selectTestApiGroupList(); - - /** - * 新增接口节点 - * - * @param testApiGroup 接口节点 - * @return 结果 - */ - public TestApiGroup insertTestApiGroup(TestApiGroup testApiGroup); - - /** - * 修改接口节点 - * - * @param testApiGroup 接口节点 - * @return 结果 - */ - public int updateTestApiGroup(TestApiGroup testApiGroup); - - /** - * 删除接口节点信息 - * - * @param id 接口节点主键 - * @return 结果 - */ - public int deleteTestApiGroupById(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 new file mode 100644 index 0000000..c453995 --- /dev/null +++ b/test-test/src/main/java/com/test/test/service/ITestGroupService.java @@ -0,0 +1,44 @@ +package com.test.test.service; + +import java.util.List; +import com.test.test.domain.TestGroup; + +/** + * 节点(文件夹)Service接口 + * + * @author xiaoe + */ +public interface ITestGroupService +{ + /** + * 查询节点(文件夹)列表 + * + * @param type 节点类型 + * @return 节点(文件夹)集合 + */ + public List selectTestGroupList(String type); + + /** + * 新增节点(文件夹) + * + * @param testGroup 节点(文件夹) + * @return 结果 + */ + public TestGroup insertTestGroup(TestGroup testGroup); + + /** + * 修改节点(文件夹) + * + * @param testGroup 节点(文件夹) + * @return 结果 + */ + public int updateTestGroup(TestGroup testGroup); + + /** + * 删除节点(文件夹)信息 + * + * @param id 节点(文件夹)主键 + * @return 结果 + */ + public int deleteTestGroupById(Long id); +} diff --git a/test-test/src/main/java/com/test/test/service/impl/TestApiGroupServiceImpl.java b/test-test/src/main/java/com/test/test/service/impl/TestApiGroupServiceImpl.java deleted file mode 100644 index a2bd235..0000000 --- a/test-test/src/main/java/com/test/test/service/impl/TestApiGroupServiceImpl.java +++ /dev/null @@ -1,72 +0,0 @@ -package com.test.test.service.impl; - -import java.util.List; -import com.test.common.utils.DateUtils; -import jakarta.annotation.Resource; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import com.test.test.mapper.TestApiGroupMapper; -import com.test.test.domain.TestApiGroup; -import com.test.test.service.ITestApiGroupService; - -/** - * 接口节点Service业务层处理 - * - * @author xiaoe - */ -@Service -public class TestApiGroupServiceImpl implements ITestApiGroupService -{ - @Resource - private TestApiGroupMapper testApiGroupMapper; - - /** - * 查询接口节点列表 - * - * @return 接口节点 - */ - @Override - public List selectTestApiGroupList() - { - return testApiGroupMapper.selectTestApiGroupList(); - } - - /** - * 新增接口节点 - * - * @param testApiGroup 接口节点 - * @return 结果 - */ - @Override - public TestApiGroup insertTestApiGroup(TestApiGroup testApiGroup) - { - testApiGroup.setCreateTime(DateUtils.getNowDate()); - testApiGroupMapper.insertTestApiGroup(testApiGroup); - return testApiGroup; - } - - /** - * 修改接口节点 - * - * @param testApiGroup 接口节点 - * @return 结果 - */ - @Override - public int updateTestApiGroup(TestApiGroup testApiGroup) - { - testApiGroup.setUpdateTime(DateUtils.getNowDate()); - return testApiGroupMapper.updateTestApiGroup(testApiGroup); - } - - /** - * 删除接口节点信息 - * - * @param id 接口节点主键 - * @return 结果 - */ - @Override - public int deleteTestApiGroupById(Long id) - { - return testApiGroupMapper.deleteTestApiGroupById(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 new file mode 100644 index 0000000..be769d2 --- /dev/null +++ b/test-test/src/main/java/com/test/test/service/impl/TestGroupServiceImpl.java @@ -0,0 +1,69 @@ +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.TestGroupMapper; +import com.test.test.domain.TestGroup; +import com.test.test.service.ITestGroupService; + +/** + * 节点(文件夹)Service业务层处理 + * + * @author xiaoe + */ +@Service +public class TestGroupServiceImpl implements ITestGroupService { + + @Resource + private TestGroupMapper testGroupMapper; + + /** + * 查询节点(文件夹)列表 + * + * @param type 节点类型 + * @return 节点(文件夹) + */ + @Override + public List selectTestGroupList(String type) { + return testGroupMapper.selectTestGroupList(type); + } + + /** + * 新增节点(文件夹) + * + * @param testGroup 节点(文件夹) + * @return 结果 + */ + @Override + public TestGroup insertTestGroup(TestGroup testGroup) { + testGroup.setCreateTime(DateUtils.getNowDate()); + testGroupMapper.insertTestGroup(testGroup); + return testGroup; + } + + /** + * 修改节点(文件夹) + * + * @param testGroup 节点(文件夹) + * @return 结果 + */ + @Override + public int updateTestGroup(TestGroup testGroup) { + testGroup.setUpdateTime(DateUtils.getNowDate()); + return testGroupMapper.updateTestGroup(testGroup); + } + + /** + * 删除节点(文件夹)信息 + * + * @param id 节点(文件夹)主键 + * @return 结果 + */ + @Override + public int deleteTestGroupById(Long id) { + return testGroupMapper.deleteTestGroupById(id); + } +} diff --git a/test-test/src/main/resources/mapper/test/TestApiGroupMapper.xml b/test-test/src/main/resources/mapper/test/TestGroupMapper.xml similarity index 59% rename from test-test/src/main/resources/mapper/test/TestApiGroupMapper.xml rename to test-test/src/main/resources/mapper/test/TestGroupMapper.xml index aff38e2..1d20097 100644 --- a/test-test/src/main/resources/mapper/test/TestApiGroupMapper.xml +++ b/test-test/src/main/resources/mapper/test/TestGroupMapper.xml @@ -1,12 +1,13 @@ - - - + PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> + + + + @@ -15,18 +16,27 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - - select id, parent_id, name, del_flag, create_by, create_time, update_by, update_time from test_api_group + + select id, parent_id, type, name, del_flag, create_by, create_time, update_by, update_time from test_group - + + + type = #{type} + - - insert into test_api_group + + + + insert into test_group parent_id, + type, name, del_flag, create_by, @@ -36,6 +46,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{parentId}, + #{type}, #{name}, #{delFlag}, #{createBy}, @@ -45,10 +56,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - - update test_api_group + + update test_group parent_id = #{parentId}, + type = #{type}, name = #{name}, del_flag = #{delFlag}, create_by = #{createBy}, @@ -59,7 +71,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where id = #{id} - - delete from test_api_group where id = #{id} + + delete from test_group where id = #{id} + + + + delete from test_group 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 d4ea0b3..552767e 100644 --- a/test-ui/src/api/test/api.js +++ b/test-ui/src/api/test/api.js @@ -44,39 +44,3 @@ export function delApi(id) { params: {id} }) } - - -// 查询接口节点列表 -export function listGroup() { - return request({ - url: '/test/group/list', - method: 'get' - }) -} - -// 新增接口节点 -export function addGroup(data) { - return request({ - url: '/test/group/add', - method: 'post', - data: data - }) -} - -// 修改接口节点 -export function updateGroup(data) { - return request({ - url: '/test/group/edit', - method: 'post', - data: data - }) -} - -// 删除接口节点 -export function delGroup(id) { - return request({ - url: '/test/group/del', - method: 'post', - data: {id} - }) -} diff --git a/test-ui/src/api/test/group.js b/test-ui/src/api/test/group.js new file mode 100644 index 0000000..b60116a --- /dev/null +++ b/test-ui/src/api/test/group.js @@ -0,0 +1,37 @@ +import request from '@/utils/request' + +// 查询节点列表 +export function listGroup(type) { + return request({ + url: '/test/group/list', + method: 'get', + params: {type} + }) +} + +// 新增节点 +export function addGroup(data) { + return request({ + url: '/test/group/add', + method: 'post', + data: data + }) +} + +// 修改节点 +export function updateGroup(data) { + return request({ + url: '/test/group/edit', + method: 'post', + data: data + }) +} + +// 删除节点 +export function delGroup(id) { + return request({ + url: '/test/group/del', + method: 'post', + data: {id} + }) +} diff --git a/test-ui/src/components/FolderPage/index.vue b/test-ui/src/components/FolderPage/index.vue new file mode 100644 index 0000000..6e5aa66 --- /dev/null +++ b/test-ui/src/components/FolderPage/index.vue @@ -0,0 +1,239 @@ + + + + + diff --git a/test-ui/src/views/test/api/index.vue b/test-ui/src/views/test/api/index.vue index d500843..30d0abe 100644 --- a/test-ui/src/views/test/api/index.vue +++ b/test-ui/src/views/test/api/index.vue @@ -1,80 +1,51 @@