整理代码
This commit is contained in:
@@ -17,13 +17,6 @@
|
|||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|
||||||
<!-- spring-boot-devtools -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-devtools</artifactId>
|
|
||||||
<optional>true</optional> <!-- 表示依赖不会传递 -->
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- spring-doc -->
|
<!-- spring-doc -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springdoc</groupId>
|
<groupId>org.springdoc</groupId>
|
||||||
|
|||||||
@@ -22,6 +22,11 @@
|
|||||||
<groupId>com.test</groupId>
|
<groupId>com.test</groupId>
|
||||||
<artifactId>test-common</artifactId>
|
<artifactId>test-common</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|||||||
@@ -2,8 +2,10 @@ package com.test.test.controller;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.test.test.domain.qo.TestApiListQO;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
@@ -23,7 +25,6 @@ import com.test.common.core.page.TableDataInfo;
|
|||||||
* 接口Controller
|
* 接口Controller
|
||||||
*
|
*
|
||||||
* @author xiaoe
|
* @author xiaoe
|
||||||
* @date 2025-02-08
|
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/test/api")
|
@RequestMapping("/test/api")
|
||||||
@@ -35,7 +36,7 @@ public class TestApiController extends BaseController {
|
|||||||
* 查询接口列表
|
* 查询接口列表
|
||||||
*/
|
*/
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public TableDataInfo list(TestApi testApi) {
|
public TableDataInfo list(@Validated TestApiListQO testApi) {
|
||||||
startPage();
|
startPage();
|
||||||
List<TestApi> list = testApiService.selectTestApiList(testApi);
|
List<TestApi> list = testApiService.selectTestApiList(testApi);
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
@@ -46,7 +47,7 @@ public class TestApiController extends BaseController {
|
|||||||
*/
|
*/
|
||||||
@Log(title = "接口", businessType = BusinessType.EXPORT)
|
@Log(title = "接口", businessType = BusinessType.EXPORT)
|
||||||
@PostMapping("/export")
|
@PostMapping("/export")
|
||||||
public void export(HttpServletResponse response, TestApi testApi) {
|
public void export(HttpServletResponse response, TestApiListQO testApi) {
|
||||||
List<TestApi> list = testApiService.selectTestApiList(testApi);
|
List<TestApi> list = testApiService.selectTestApiList(testApi);
|
||||||
ExcelUtil<TestApi> util = new ExcelUtil<TestApi>(TestApi.class);
|
ExcelUtil<TestApi> util = new ExcelUtil<TestApi>(TestApi.class);
|
||||||
util.exportExcel(response, list, "接口数据");
|
util.exportExcel(response, list, "接口数据");
|
||||||
|
|||||||
@@ -3,13 +3,8 @@ package com.test.test.controller;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import jakarta.annotation.Resource;
|
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.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
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.PathVariable;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
@@ -20,14 +15,11 @@ import com.test.common.core.domain.AjaxResult;
|
|||||||
import com.test.common.enums.BusinessType;
|
import com.test.common.enums.BusinessType;
|
||||||
import com.test.test.domain.TestApiGroup;
|
import com.test.test.domain.TestApiGroup;
|
||||||
import com.test.test.service.ITestApiGroupService;
|
import com.test.test.service.ITestApiGroupService;
|
||||||
import com.test.common.utils.poi.ExcelUtil;
|
|
||||||
import com.test.common.core.page.TableDataInfo;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 接口节点Controller
|
* 接口节点Controller
|
||||||
*
|
*
|
||||||
* @author xiaoe
|
* @author xiaoe
|
||||||
* @date 2025-02-10
|
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/test/group")
|
@RequestMapping("/test/group")
|
||||||
@@ -39,29 +31,9 @@ public class TestApiGroupController extends BaseController {
|
|||||||
* 查询接口节点列表
|
* 查询接口节点列表
|
||||||
*/
|
*/
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public TableDataInfo list(TestApiGroup testApiGroup) {
|
public AjaxResult list() {
|
||||||
startPage();
|
List<TestApiGroup> list = testApiGroupService.selectTestApiGroupList();
|
||||||
List<TestApiGroup> list = testApiGroupService.selectTestApiGroupList(testApiGroup);
|
return success(list);
|
||||||
return getDataTable(list);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 导出接口节点列表
|
|
||||||
*/
|
|
||||||
@Log(title = "接口节点", businessType = BusinessType.EXPORT)
|
|
||||||
@PostMapping("/export")
|
|
||||||
public void export(HttpServletResponse response, TestApiGroup testApiGroup) {
|
|
||||||
List<TestApiGroup> list = testApiGroupService.selectTestApiGroupList(testApiGroup);
|
|
||||||
ExcelUtil<TestApiGroup> util = new ExcelUtil<TestApiGroup>(TestApiGroup.class);
|
|
||||||
util.exportExcel(response, list, "接口节点数据");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取接口节点详细信息
|
|
||||||
*/
|
|
||||||
@GetMapping(value = "/{id}")
|
|
||||||
public AjaxResult getInfo(@PathVariable("id") Long id) {
|
|
||||||
return success(testApiGroupService.selectTestApiGroupById(id));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -77,7 +49,7 @@ public class TestApiGroupController extends BaseController {
|
|||||||
* 修改接口节点
|
* 修改接口节点
|
||||||
*/
|
*/
|
||||||
@Log(title = "接口节点", businessType = BusinessType.UPDATE)
|
@Log(title = "接口节点", businessType = BusinessType.UPDATE)
|
||||||
@PutMapping("/edit")
|
@PostMapping("/edit")
|
||||||
public AjaxResult edit(@RequestBody TestApiGroup testApiGroup) {
|
public AjaxResult edit(@RequestBody TestApiGroup testApiGroup) {
|
||||||
return toAjax(testApiGroupService.updateTestApiGroup(testApiGroup));
|
return toAjax(testApiGroupService.updateTestApiGroup(testApiGroup));
|
||||||
}
|
}
|
||||||
@@ -86,8 +58,8 @@ public class TestApiGroupController extends BaseController {
|
|||||||
* 删除接口节点
|
* 删除接口节点
|
||||||
*/
|
*/
|
||||||
@Log(title = "接口节点", businessType = BusinessType.DELETE)
|
@Log(title = "接口节点", businessType = BusinessType.DELETE)
|
||||||
@DeleteMapping("/del/{ids}")
|
@PostMapping("/del/{id}")
|
||||||
public AjaxResult remove(@PathVariable Long[] ids) {
|
public AjaxResult remove(@PathVariable Long id) {
|
||||||
return toAjax(testApiGroupService.deleteTestApiGroupByIds(ids));
|
return toAjax(testApiGroupService.deleteTestApiGroupById(id));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,24 +1,30 @@
|
|||||||
package com.test.test.domain;
|
package com.test.test.domain;
|
||||||
|
|
||||||
import com.test.common.core.domain.BaseEntity;
|
import com.test.common.core.domain.BaseEntity;
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
import lombok.Getter;
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
import lombok.Setter;
|
||||||
|
import lombok.ToString;
|
||||||
import com.test.common.annotation.Excel;
|
import com.test.common.annotation.Excel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 接口对象 test_api
|
* 接口对象 test_api
|
||||||
*
|
*
|
||||||
* @author xiaoe
|
* @author xiaoe
|
||||||
* @date 2025-02-08
|
|
||||||
*/
|
*/
|
||||||
|
@Setter
|
||||||
|
@Getter
|
||||||
|
@ToString
|
||||||
public class TestApi extends BaseEntity {
|
public class TestApi extends BaseEntity {
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 接口id
|
* 接口id
|
||||||
*/
|
*/
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
|
/** 节点id */
|
||||||
|
@Excel(name = "节点id")
|
||||||
|
private Long groupId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 接口名称
|
* 接口名称
|
||||||
*/
|
*/
|
||||||
@@ -60,85 +66,4 @@ public class TestApi extends BaseEntity {
|
|||||||
*/
|
*/
|
||||||
private String delFlag;
|
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 setMethod(String method) {
|
|
||||||
this.method = method;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getMethod() {
|
|
||||||
return method;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUri(String uri) {
|
|
||||||
this.uri = uri;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getUri() {
|
|
||||||
return uri;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setHeader(String header) {
|
|
||||||
this.header = header;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getHeader() {
|
|
||||||
return header;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setParam(String param) {
|
|
||||||
this.param = param;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getParam() {
|
|
||||||
return param;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBody(String body) {
|
|
||||||
this.body = body;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getBody() {
|
|
||||||
return body;
|
|
||||||
}
|
|
||||||
|
|
||||||
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("method", getMethod())
|
|
||||||
.append("uri", getUri())
|
|
||||||
.append("header", getHeader())
|
|
||||||
.append("param", getParam())
|
|
||||||
.append("body", getBody())
|
|
||||||
.append("delFlag", getDelFlag())
|
|
||||||
.append("createBy", getCreateBy())
|
|
||||||
.append("createTime", getCreateTime())
|
|
||||||
.append("updateBy", getUpdateBy())
|
|
||||||
.append("updateTime", getUpdateTime())
|
|
||||||
.toString();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,20 +1,21 @@
|
|||||||
package com.test.test.domain;
|
package com.test.test.domain;
|
||||||
|
|
||||||
import com.test.common.core.domain.BaseEntity;
|
import com.test.common.core.domain.BaseEntity;
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
import lombok.Getter;
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
import lombok.Setter;
|
||||||
|
import lombok.ToString;
|
||||||
import com.test.common.annotation.Excel;
|
import com.test.common.annotation.Excel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 接口节点对象 test_api_group
|
* 接口节点对象 test_api_group
|
||||||
*
|
*
|
||||||
* @author xiaoe
|
* @author xiaoe
|
||||||
* @date 2025-02-10
|
|
||||||
*/
|
*/
|
||||||
|
@Setter
|
||||||
|
@Getter
|
||||||
|
@ToString
|
||||||
public class TestApiGroup extends BaseEntity
|
public class TestApiGroup extends BaseEntity
|
||||||
{
|
{
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
/** 节点id */
|
/** 节点id */
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
@@ -24,45 +25,4 @@ public class TestApiGroup extends BaseEntity
|
|||||||
|
|
||||||
/** 删除标志(0代表存在 2代表删除) */
|
/** 删除标志(0代表存在 2代表删除) */
|
||||||
private String delFlag;
|
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();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package com.test.test.domain.qo;
|
||||||
|
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class TestApiListQO {
|
||||||
|
|
||||||
|
@NotNull(message = "父节点id不能为空")
|
||||||
|
private Long groupId;
|
||||||
|
private String name;
|
||||||
|
private String method;
|
||||||
|
private String uri;
|
||||||
|
}
|
||||||
@@ -7,25 +7,15 @@ import com.test.test.domain.TestApiGroup;
|
|||||||
* 接口节点Mapper接口
|
* 接口节点Mapper接口
|
||||||
*
|
*
|
||||||
* @author xiaoe
|
* @author xiaoe
|
||||||
* @date 2025-02-10
|
|
||||||
*/
|
*/
|
||||||
public interface TestApiGroupMapper
|
public interface TestApiGroupMapper
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* 查询接口节点
|
|
||||||
*
|
|
||||||
* @param id 接口节点主键
|
|
||||||
* @return 接口节点
|
|
||||||
*/
|
|
||||||
public TestApiGroup selectTestApiGroupById(Long id);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询接口节点列表
|
* 查询接口节点列表
|
||||||
*
|
*
|
||||||
* @param testApiGroup 接口节点
|
|
||||||
* @return 接口节点集合
|
* @return 接口节点集合
|
||||||
*/
|
*/
|
||||||
public List<TestApiGroup> selectTestApiGroupList(TestApiGroup testApiGroup);
|
public List<TestApiGroup> selectTestApiGroupList();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增接口节点
|
* 新增接口节点
|
||||||
@@ -50,12 +40,4 @@ public interface TestApiGroupMapper
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteTestApiGroupById(Long id);
|
public int deleteTestApiGroupById(Long id);
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量删除接口节点
|
|
||||||
*
|
|
||||||
* @param ids 需要删除的数据主键集合
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int deleteTestApiGroupByIds(Long[] ids);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,12 +3,12 @@ package com.test.test.mapper;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.test.test.domain.TestApi;
|
import com.test.test.domain.TestApi;
|
||||||
|
import com.test.test.domain.qo.TestApiListQO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 接口Mapper接口
|
* 接口Mapper接口
|
||||||
*
|
*
|
||||||
* @author xiaoe
|
* @author xiaoe
|
||||||
* @date 2025-02-08
|
|
||||||
*/
|
*/
|
||||||
public interface TestApiMapper {
|
public interface TestApiMapper {
|
||||||
/**
|
/**
|
||||||
@@ -25,7 +25,7 @@ public interface TestApiMapper {
|
|||||||
* @param testApi 接口
|
* @param testApi 接口
|
||||||
* @return 接口集合
|
* @return 接口集合
|
||||||
*/
|
*/
|
||||||
public List<TestApi> selectTestApiList(TestApi testApi);
|
public List<TestApi> selectTestApiList(TestApiListQO testApi);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增接口
|
* 新增接口
|
||||||
|
|||||||
@@ -1,35 +1,26 @@
|
|||||||
package com.test.test.service;
|
package com.test.test.service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.test.test.domain.TestApiGroup;
|
import com.test.test.domain.TestApiGroup;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 接口节点Service接口
|
* 接口节点Service接口
|
||||||
*
|
*
|
||||||
* @author xiaoe
|
* @author xiaoe
|
||||||
* @date 2025-02-10
|
|
||||||
*/
|
*/
|
||||||
public interface ITestApiGroupService
|
public interface ITestApiGroupService {
|
||||||
{
|
|
||||||
/**
|
|
||||||
* 查询接口节点
|
|
||||||
*
|
|
||||||
* @param id 接口节点主键
|
|
||||||
* @return 接口节点
|
|
||||||
*/
|
|
||||||
public TestApiGroup selectTestApiGroupById(Long id);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询接口节点列表
|
* 查询接口节点列表
|
||||||
*
|
*
|
||||||
* @param testApiGroup 接口节点
|
|
||||||
* @return 接口节点集合
|
* @return 接口节点集合
|
||||||
*/
|
*/
|
||||||
public List<TestApiGroup> selectTestApiGroupList(TestApiGroup testApiGroup);
|
public List<TestApiGroup> selectTestApiGroupList();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增接口节点
|
* 新增接口节点
|
||||||
*
|
*
|
||||||
* @param testApiGroup 接口节点
|
* @param testApiGroup 接口节点
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@@ -37,23 +28,15 @@ public interface ITestApiGroupService
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改接口节点
|
* 修改接口节点
|
||||||
*
|
*
|
||||||
* @param testApiGroup 接口节点
|
* @param testApiGroup 接口节点
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int updateTestApiGroup(TestApiGroup testApiGroup);
|
public int updateTestApiGroup(TestApiGroup testApiGroup);
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量删除接口节点
|
|
||||||
*
|
|
||||||
* @param ids 需要删除的接口节点主键集合
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int deleteTestApiGroupByIds(Long[] ids);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除接口节点信息
|
* 删除接口节点信息
|
||||||
*
|
*
|
||||||
* @param id 接口节点主键
|
* @param id 接口节点主键
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -3,12 +3,12 @@ package com.test.test.service;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.test.test.domain.TestApi;
|
import com.test.test.domain.TestApi;
|
||||||
|
import com.test.test.domain.qo.TestApiListQO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 接口Service接口
|
* 接口Service接口
|
||||||
*
|
*
|
||||||
* @author xiaoe
|
* @author xiaoe
|
||||||
* @date 2025-02-08
|
|
||||||
*/
|
*/
|
||||||
public interface ITestApiService {
|
public interface ITestApiService {
|
||||||
/**
|
/**
|
||||||
@@ -25,7 +25,7 @@ public interface ITestApiService {
|
|||||||
* @param testApi 接口
|
* @param testApi 接口
|
||||||
* @return 接口集合
|
* @return 接口集合
|
||||||
*/
|
*/
|
||||||
public List<TestApi> selectTestApiList(TestApi testApi);
|
public List<TestApi> selectTestApiList(TestApiListQO testApi);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增接口
|
* 新增接口
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ import com.test.test.service.ITestApiGroupService;
|
|||||||
* 接口节点Service业务层处理
|
* 接口节点Service业务层处理
|
||||||
*
|
*
|
||||||
* @author xiaoe
|
* @author xiaoe
|
||||||
* @date 2025-02-10
|
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class TestApiGroupServiceImpl implements ITestApiGroupService
|
public class TestApiGroupServiceImpl implements ITestApiGroupService
|
||||||
@@ -21,28 +20,15 @@ public class TestApiGroupServiceImpl implements ITestApiGroupService
|
|||||||
@Resource
|
@Resource
|
||||||
private TestApiGroupMapper testApiGroupMapper;
|
private TestApiGroupMapper testApiGroupMapper;
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询接口节点
|
|
||||||
*
|
|
||||||
* @param id 接口节点主键
|
|
||||||
* @return 接口节点
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public TestApiGroup selectTestApiGroupById(Long id)
|
|
||||||
{
|
|
||||||
return testApiGroupMapper.selectTestApiGroupById(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询接口节点列表
|
* 查询接口节点列表
|
||||||
*
|
*
|
||||||
* @param testApiGroup 接口节点
|
|
||||||
* @return 接口节点
|
* @return 接口节点
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<TestApiGroup> selectTestApiGroupList(TestApiGroup testApiGroup)
|
public List<TestApiGroup> selectTestApiGroupList()
|
||||||
{
|
{
|
||||||
return testApiGroupMapper.selectTestApiGroupList(testApiGroup);
|
return testApiGroupMapper.selectTestApiGroupList();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -71,18 +57,6 @@ public class TestApiGroupServiceImpl implements ITestApiGroupService
|
|||||||
return testApiGroupMapper.updateTestApiGroup(testApiGroup);
|
return testApiGroupMapper.updateTestApiGroup(testApiGroup);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量删除接口节点
|
|
||||||
*
|
|
||||||
* @param ids 需要删除的接口节点主键
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int deleteTestApiGroupByIds(Long[] ids)
|
|
||||||
{
|
|
||||||
return testApiGroupMapper.deleteTestApiGroupByIds(ids);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除接口节点信息
|
* 删除接口节点信息
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package com.test.test.service.impl;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.test.common.utils.DateUtils;
|
import com.test.common.utils.DateUtils;
|
||||||
|
import com.test.test.domain.qo.TestApiListQO;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.test.test.mapper.TestApiMapper;
|
import com.test.test.mapper.TestApiMapper;
|
||||||
@@ -13,7 +14,6 @@ import com.test.test.service.ITestApiService;
|
|||||||
* 接口Service业务层处理
|
* 接口Service业务层处理
|
||||||
*
|
*
|
||||||
* @author xiaoe
|
* @author xiaoe
|
||||||
* @date 2025-02-08
|
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class TestApiServiceImpl implements ITestApiService {
|
public class TestApiServiceImpl implements ITestApiService {
|
||||||
@@ -38,7 +38,7 @@ public class TestApiServiceImpl implements ITestApiService {
|
|||||||
* @return 接口
|
* @return 接口
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<TestApi> selectTestApiList(TestApi testApi) {
|
public List<TestApi> selectTestApiList(TestApiListQO testApi) {
|
||||||
return testApiMapper.selectTestApiList(testApi);
|
return testApiMapper.selectTestApiList(testApi);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,16 +18,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
select id, name, del_flag, create_by, create_time, update_by, update_time from test_api_group
|
select id, name, del_flag, create_by, create_time, update_by, update_time from test_api_group
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="selectTestApiGroupList" parameterType="TestApiGroup" resultMap="TestApiGroupResult">
|
<select id="selectTestApiGroupList" resultMap="TestApiGroupResult">
|
||||||
<include refid="selectTestApiGroupVo"/>
|
<include refid="selectTestApiGroupVo"/>
|
||||||
<where>
|
|
||||||
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
|
|
||||||
</where>
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<select id="selectTestApiGroupById" parameterType="Long" resultMap="TestApiGroupResult">
|
|
||||||
<include refid="selectTestApiGroupVo"/>
|
|
||||||
where id = #{id}
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<insert id="insertTestApiGroup" parameterType="TestApiGroup" useGeneratedKeys="true" keyProperty="id">
|
<insert id="insertTestApiGroup" parameterType="TestApiGroup" useGeneratedKeys="true" keyProperty="id">
|
||||||
@@ -66,11 +58,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<delete id="deleteTestApiGroupById" parameterType="Long">
|
<delete id="deleteTestApiGroupById" parameterType="Long">
|
||||||
delete from test_api_group where id = #{id}
|
delete from test_api_group where id = #{id}
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
<delete id="deleteTestApiGroupByIds" parameterType="String">
|
|
||||||
delete from test_api_group where id in
|
|
||||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
||||||
#{id}
|
|
||||||
</foreach>
|
|
||||||
</delete>
|
|
||||||
</mapper>
|
</mapper>
|
||||||
@@ -5,45 +5,35 @@
|
|||||||
<mapper namespace="com.test.test.mapper.TestApiMapper">
|
<mapper namespace="com.test.test.mapper.TestApiMapper">
|
||||||
|
|
||||||
<resultMap type="TestApi" id="TestApiResult">
|
<resultMap type="TestApi" id="TestApiResult">
|
||||||
<result property="id" column="id"/>
|
<result property="id" column="id" />
|
||||||
<result property="name" column="name"/>
|
<result property="groupId" column="group_id" />
|
||||||
<result property="method" column="method"/>
|
<result property="name" column="name" />
|
||||||
<result property="uri" column="uri"/>
|
<result property="method" column="method" />
|
||||||
<result property="header" column="header"/>
|
<result property="uri" column="uri" />
|
||||||
<result property="param" column="param"/>
|
<result property="header" column="header" />
|
||||||
<result property="body" column="body"/>
|
<result property="param" column="param" />
|
||||||
<result property="delFlag" column="del_flag"/>
|
<result property="body" column="body" />
|
||||||
<result property="createBy" column="create_by"/>
|
<result property="delFlag" column="del_flag" />
|
||||||
<result property="createTime" column="create_time"/>
|
<result property="createBy" column="create_by" />
|
||||||
<result property="updateBy" column="update_by"/>
|
<result property="createTime" column="create_time" />
|
||||||
<result property="updateTime" column="update_time"/>
|
<result property="updateBy" column="update_by" />
|
||||||
|
<result property="updateTime" column="update_time" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectTestApiVo">
|
<sql id="selectTestApiVo">
|
||||||
select id,
|
select id, group_id, name, method, uri, header, param, body, del_flag, create_by, create_time, update_by, update_time from test_api
|
||||||
name,
|
|
||||||
method,
|
|
||||||
uri,
|
|
||||||
header,
|
|
||||||
param,
|
|
||||||
body,
|
|
||||||
del_flag,
|
|
||||||
create_by,
|
|
||||||
create_time,
|
|
||||||
update_by,
|
|
||||||
update_time
|
|
||||||
from test_api
|
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="selectTestApiList" parameterType="TestApi" resultMap="TestApiResult">
|
<select id="selectTestApiList" parameterType="TestApi" resultMap="TestApiResult">
|
||||||
<include refid="selectTestApiVo"/>
|
<include refid="selectTestApiVo"/>
|
||||||
<where>
|
<where>
|
||||||
<if test="name != null and name != ''">and name like concat('%', #{name}, '%')</if>
|
<if test="groupId != null "> and group_id = #{groupId}</if>
|
||||||
<if test="method != null and method != ''">and method = #{method}</if>
|
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
|
||||||
<if test="uri != null and uri != ''">and uri = like concat('%', #{uri}, '%')</if>
|
<if test="method != null and method != ''"> and method = #{method}</if>
|
||||||
<if test="header != null and header != ''">and header = #{header}</if>
|
<if test="uri != null and uri != ''"> and uri like concat('%', #{uri}, '%')</if>
|
||||||
<if test="param != null and param != ''">and param = #{param}</if>
|
<if test="header != null and header != ''"> and header = #{header}</if>
|
||||||
<if test="body != null and body != ''">and body = #{body}</if>
|
<if test="param != null and param != ''"> and param = #{param}</if>
|
||||||
|
<if test="body != null and body != ''"> and body = #{body}</if>
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
@@ -55,6 +45,7 @@
|
|||||||
<insert id="insertTestApi" parameterType="TestApi" useGeneratedKeys="true" keyProperty="id">
|
<insert id="insertTestApi" parameterType="TestApi" useGeneratedKeys="true" keyProperty="id">
|
||||||
insert into test_api
|
insert into test_api
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="groupId != null">group_id,</if>
|
||||||
<if test="name != null">name,</if>
|
<if test="name != null">name,</if>
|
||||||
<if test="method != null">method,</if>
|
<if test="method != null">method,</if>
|
||||||
<if test="uri != null">uri,</if>
|
<if test="uri != null">uri,</if>
|
||||||
@@ -68,6 +59,7 @@
|
|||||||
<if test="updateTime != null">update_time,</if>
|
<if test="updateTime != null">update_time,</if>
|
||||||
</trim>
|
</trim>
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="groupId != null">#{groupId},</if>
|
||||||
<if test="name != null">#{name},</if>
|
<if test="name != null">#{name},</if>
|
||||||
<if test="method != null">#{method},</if>
|
<if test="method != null">#{method},</if>
|
||||||
<if test="uri != null">#{uri},</if>
|
<if test="uri != null">#{uri},</if>
|
||||||
@@ -85,6 +77,7 @@
|
|||||||
<update id="updateTestApi" parameterType="TestApi">
|
<update id="updateTestApi" parameterType="TestApi">
|
||||||
update test_api
|
update test_api
|
||||||
<trim prefix="SET" suffixOverrides=",">
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="groupId != null">group_id = #{groupId},</if>
|
||||||
<if test="name != null">name = #{name},</if>
|
<if test="name != null">name = #{name},</if>
|
||||||
<if test="method != null">method = #{method},</if>
|
<if test="method != null">method = #{method},</if>
|
||||||
<if test="uri != null">uri = #{uri},</if>
|
<if test="uri != null">uri = #{uri},</if>
|
||||||
@@ -101,9 +94,7 @@
|
|||||||
</update>
|
</update>
|
||||||
|
|
||||||
<delete id="deleteTestApiById" parameterType="Long">
|
<delete id="deleteTestApiById" parameterType="Long">
|
||||||
delete
|
delete from test_api where id = #{id}
|
||||||
from test_api
|
|
||||||
where id = #{id}
|
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
<delete id="deleteTestApiByIds" parameterType="String">
|
<delete id="deleteTestApiByIds" parameterType="String">
|
||||||
|
|||||||
@@ -45,18 +45,9 @@ export function delApi(id) {
|
|||||||
|
|
||||||
|
|
||||||
// 查询接口节点列表
|
// 查询接口节点列表
|
||||||
export function listGroup(query) {
|
export function listGroup() {
|
||||||
return request({
|
return request({
|
||||||
url: '/test/group/list',
|
url: '/test/group/list',
|
||||||
method: 'get',
|
|
||||||
params: query
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// 查询接口节点详细
|
|
||||||
export function getGroup(id) {
|
|
||||||
return request({
|
|
||||||
url: '/test/group/' + id,
|
|
||||||
method: 'get'
|
method: 'get'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user