From 21efe997ef02304fa4002b84e929e2ec346c26b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E6=98=B1=E6=B6=B5?= Date: Mon, 10 Feb 2025 09:11:22 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E8=8A=82=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test-admin/src/main/resources/application.yml | 2 +- .../test/controller/TestApiController.java | 6 +- .../controller/TestApiGroupController.java | 93 ++++++++++++++++++ .../com/test/test/domain/TestApiGroup.java | 68 +++++++++++++ .../test/test/mapper/TestApiGroupMapper.java | 61 ++++++++++++ .../test/service/ITestApiGroupService.java | 61 ++++++++++++ .../service/impl/TestApiGroupServiceImpl.java | 97 +++++++++++++++++++ .../mapper/test/TestApiGroupMapper.xml | 76 +++++++++++++++ test-ui/src/api/test/api.js | 44 +++++++++ 9 files changed, 504 insertions(+), 4 deletions(-) create mode 100644 test-test/src/main/java/com/test/test/controller/TestApiGroupController.java create mode 100644 test-test/src/main/java/com/test/test/domain/TestApiGroup.java create mode 100644 test-test/src/main/java/com/test/test/mapper/TestApiGroupMapper.java create 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/impl/TestApiGroupServiceImpl.java create mode 100644 test-test/src/main/resources/mapper/test/TestApiGroupMapper.xml diff --git a/test-admin/src/main/resources/application.yml b/test-admin/src/main/resources/application.yml index 764183a..cf68d74 100644 --- a/test-admin/src/main/resources/application.yml +++ b/test-admin/src/main/resources/application.yml @@ -142,7 +142,7 @@ aj: # blockPuzzle 滑块 clickWord 文字点选 default默认两者都实例化 type: blockPuzzle # 右下角显示字 - water-mark: cmcf-test + water-mark: test # 校验滑动拼图允许误差偏移量(默认5像素) slip-offset: 5 # aes加密坐标开启或者禁用(true|false) 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 36abe03..983a6bd 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 @@ -55,7 +55,7 @@ public class TestApiController extends BaseController { /** * 获取接口详细信息 */ - @GetMapping(value = "/detail/{id}") + @GetMapping(value = "/{id}") public AjaxResult getInfo(@PathVariable("id") Long id) { return success(testApiService.selectTestApiById(id)); } @@ -64,7 +64,7 @@ public class TestApiController extends BaseController { * 新增接口 */ @Log(title = "接口", businessType = BusinessType.INSERT) - @PostMapping(value = "/add") + @PostMapping("/add") public AjaxResult add(@RequestBody TestApi testApi) { return toAjax(testApiService.insertTestApi(testApi)); } @@ -73,7 +73,7 @@ public class TestApiController extends BaseController { * 修改接口 */ @Log(title = "接口", businessType = BusinessType.UPDATE) - @PostMapping(value = "/edit") + @PostMapping("/edit") public AjaxResult edit(@RequestBody TestApi testApi) { return toAjax(testApiService.updateTestApi(testApi)); } 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 new file mode 100644 index 0000000..05b895a --- /dev/null +++ b/test-test/src/main/java/com/test/test/controller/TestApiGroupController.java @@ -0,0 +1,93 @@ +package com.test.test.controller; + +import java.util.List; + +import jakarta.annotation.Resource; +import jakarta.servlet.http.HttpServletResponse; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +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; +import com.test.common.utils.poi.ExcelUtil; +import com.test.common.core.page.TableDataInfo; + +/** + * 接口节点Controller + * + * @author xiaoe + * @date 2025-02-10 + */ +@RestController +@RequestMapping("/test/group") +public class TestApiGroupController extends BaseController { + @Resource + private ITestApiGroupService testApiGroupService; + + /** + * 查询接口节点列表 + */ + @GetMapping("/list") + public TableDataInfo list(TestApiGroup testApiGroup) { + startPage(); + List list = testApiGroupService.selectTestApiGroupList(testApiGroup); + return getDataTable(list); + } + + /** + * 导出接口节点列表 + */ + @Log(title = "接口节点", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, TestApiGroup testApiGroup) { + List list = testApiGroupService.selectTestApiGroupList(testApiGroup); + ExcelUtil util = new ExcelUtil(TestApiGroup.class); + util.exportExcel(response, list, "接口节点数据"); + } + + /** + * 获取接口节点详细信息 + */ + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) { + return success(testApiGroupService.selectTestApiGroupById(id)); + } + + /** + * 新增接口节点 + */ + @Log(title = "接口节点", businessType = BusinessType.INSERT) + @PostMapping("/add") + public AjaxResult add(@RequestBody TestApiGroup testApiGroup) { + return toAjax(testApiGroupService.insertTestApiGroup(testApiGroup)); + } + + /** + * 修改接口节点 + */ + @Log(title = "接口节点", businessType = BusinessType.UPDATE) + @PutMapping("/edit") + public AjaxResult edit(@RequestBody TestApiGroup testApiGroup) { + return toAjax(testApiGroupService.updateTestApiGroup(testApiGroup)); + } + + /** + * 删除接口节点 + */ + @Log(title = "接口节点", businessType = BusinessType.DELETE) + @DeleteMapping("/del/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) { + return toAjax(testApiGroupService.deleteTestApiGroupByIds(ids)); + } +} diff --git a/test-test/src/main/java/com/test/test/domain/TestApiGroup.java b/test-test/src/main/java/com/test/test/domain/TestApiGroup.java new file mode 100644 index 0000000..5e6485b --- /dev/null +++ b/test-test/src/main/java/com/test/test/domain/TestApiGroup.java @@ -0,0 +1,68 @@ +package com.test.test.domain; + +import com.test.common.core.domain.BaseEntity; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.test.common.annotation.Excel; + +/** + * 接口节点对象 test_api_group + * + * @author xiaoe + * @date 2025-02-10 + */ +public class TestApiGroup extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 节点id */ + private Long id; + + /** 节点名称 */ + @Excel(name = "节点名称") + private String name; + + /** 删除标志(0代表存在 2代表删除) */ + private String delFlag; + + public void setId(Long id) + { + this.id = id; + } + + public Long getId() + { + return id; + } + public void setName(String name) + { + this.name = name; + } + + public String getName() + { + return name; + } + public void setDelFlag(String delFlag) + { + this.delFlag = delFlag; + } + + public String getDelFlag() + { + return delFlag; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("name", getName()) + .append("delFlag", getDelFlag()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} 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 new file mode 100644 index 0000000..988751d --- /dev/null +++ b/test-test/src/main/java/com/test/test/mapper/TestApiGroupMapper.java @@ -0,0 +1,61 @@ +package com.test.test.mapper; + +import java.util.List; +import com.test.test.domain.TestApiGroup; + +/** + * 接口节点Mapper接口 + * + * @author xiaoe + * @date 2025-02-10 + */ +public interface TestApiGroupMapper +{ + /** + * 查询接口节点 + * + * @param id 接口节点主键 + * @return 接口节点 + */ + public TestApiGroup selectTestApiGroupById(Long id); + + /** + * 查询接口节点列表 + * + * @param testApiGroup 接口节点 + * @return 接口节点集合 + */ + public List selectTestApiGroupList(TestApiGroup testApiGroup); + + /** + * 新增接口节点 + * + * @param testApiGroup 接口节点 + * @return 结果 + */ + public int insertTestApiGroup(TestApiGroup testApiGroup); + + /** + * 修改接口节点 + * + * @param testApiGroup 接口节点 + * @return 结果 + */ + public int updateTestApiGroup(TestApiGroup testApiGroup); + + /** + * 删除接口节点 + * + * @param id 接口节点主键 + * @return 结果 + */ + public int deleteTestApiGroupById(Long id); + + /** + * 批量删除接口节点 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteTestApiGroupByIds(Long[] ids); +} 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 new file mode 100644 index 0000000..18c661a --- /dev/null +++ b/test-test/src/main/java/com/test/test/service/ITestApiGroupService.java @@ -0,0 +1,61 @@ +package com.test.test.service; + +import java.util.List; +import com.test.test.domain.TestApiGroup; + +/** + * 接口节点Service接口 + * + * @author xiaoe + * @date 2025-02-10 + */ +public interface ITestApiGroupService +{ + /** + * 查询接口节点 + * + * @param id 接口节点主键 + * @return 接口节点 + */ + public TestApiGroup selectTestApiGroupById(Long id); + + /** + * 查询接口节点列表 + * + * @param testApiGroup 接口节点 + * @return 接口节点集合 + */ + public List selectTestApiGroupList(TestApiGroup testApiGroup); + + /** + * 新增接口节点 + * + * @param testApiGroup 接口节点 + * @return 结果 + */ + public int insertTestApiGroup(TestApiGroup testApiGroup); + + /** + * 修改接口节点 + * + * @param testApiGroup 接口节点 + * @return 结果 + */ + public int updateTestApiGroup(TestApiGroup testApiGroup); + + /** + * 批量删除接口节点 + * + * @param ids 需要删除的接口节点主键集合 + * @return 结果 + */ + public int deleteTestApiGroupByIds(Long[] ids); + + /** + * 删除接口节点信息 + * + * @param id 接口节点主键 + * @return 结果 + */ + public int deleteTestApiGroupById(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 new file mode 100644 index 0000000..d7a0053 --- /dev/null +++ b/test-test/src/main/java/com/test/test/service/impl/TestApiGroupServiceImpl.java @@ -0,0 +1,97 @@ +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 + * @date 2025-02-10 + */ +@Service +public class TestApiGroupServiceImpl implements ITestApiGroupService +{ + @Resource + private TestApiGroupMapper testApiGroupMapper; + + /** + * 查询接口节点 + * + * @param id 接口节点主键 + * @return 接口节点 + */ + @Override + public TestApiGroup selectTestApiGroupById(Long id) + { + return testApiGroupMapper.selectTestApiGroupById(id); + } + + /** + * 查询接口节点列表 + * + * @param testApiGroup 接口节点 + * @return 接口节点 + */ + @Override + public List selectTestApiGroupList(TestApiGroup testApiGroup) + { + return testApiGroupMapper.selectTestApiGroupList(testApiGroup); + } + + /** + * 新增接口节点 + * + * @param testApiGroup 接口节点 + * @return 结果 + */ + @Override + public int insertTestApiGroup(TestApiGroup testApiGroup) + { + testApiGroup.setCreateTime(DateUtils.getNowDate()); + return testApiGroupMapper.insertTestApiGroup(testApiGroup); + } + + /** + * 修改接口节点 + * + * @param testApiGroup 接口节点 + * @return 结果 + */ + @Override + public int updateTestApiGroup(TestApiGroup testApiGroup) + { + testApiGroup.setUpdateTime(DateUtils.getNowDate()); + return testApiGroupMapper.updateTestApiGroup(testApiGroup); + } + + /** + * 批量删除接口节点 + * + * @param ids 需要删除的接口节点主键 + * @return 结果 + */ + @Override + public int deleteTestApiGroupByIds(Long[] ids) + { + return testApiGroupMapper.deleteTestApiGroupByIds(ids); + } + + /** + * 删除接口节点信息 + * + * @param id 接口节点主键 + * @return 结果 + */ + @Override + public int deleteTestApiGroupById(Long id) + { + return testApiGroupMapper.deleteTestApiGroupById(id); + } +} diff --git a/test-test/src/main/resources/mapper/test/TestApiGroupMapper.xml b/test-test/src/main/resources/mapper/test/TestApiGroupMapper.xml new file mode 100644 index 0000000..62be649 --- /dev/null +++ b/test-test/src/main/resources/mapper/test/TestApiGroupMapper.xml @@ -0,0 +1,76 @@ + + + + + + + + + + + + + + + + select id, name, del_flag, create_by, create_time, update_by, update_time from test_api_group + + + + + + + + insert into test_api_group + + name, + del_flag, + create_by, + create_time, + update_by, + update_time, + + + #{name}, + #{delFlag}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update test_api_group + + name = #{name}, + del_flag = #{delFlag}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where id = #{id} + + + + delete from test_api_group where id = #{id} + + + + delete from test_api_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 b691c9f..250fc31 100644 --- a/test-ui/src/api/test/api.js +++ b/test-ui/src/api/test/api.js @@ -42,3 +42,47 @@ export function delApi(id) { method: 'post' }) } + + +// 查询接口节点列表 +export function listGroup(query) { + return request({ + url: '/test/group/list', + method: 'get', + params: query + }) +} + +// 查询接口节点详细 +export function getGroup(id) { + return request({ + url: '/test/group/' + id, + method: 'get' + }) +} + +// 新增接口节点 +export function addGroup(data) { + return request({ + url: '/test/group', + method: 'post', + data: data + }) +} + +// 修改接口节点 +export function updateGroup(data) { + return request({ + url: '/test/group', + method: 'put', + data: data + }) +} + +// 删除接口节点 +export function delGroup(id) { + return request({ + url: '/test/group/' + id, + method: 'delete' + }) +}