接口节点

This commit is contained in:
2025-02-10 09:11:22 +08:00
parent 07d148dced
commit 21efe997ef
9 changed files with 504 additions and 4 deletions

View File

@@ -142,7 +142,7 @@ aj:
# blockPuzzle 滑块 clickWord 文字点选 default默认两者都实例化
type: blockPuzzle
# 右下角显示字
water-mark: cmcf-test
water-mark: test
# 校验滑动拼图允许误差偏移量(默认5像素)
slip-offset: 5
# aes加密坐标开启或者禁用(true|false)

View File

@@ -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));
}

View File

@@ -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<TestApiGroup> list = testApiGroupService.selectTestApiGroupList(testApiGroup);
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));
}
/**
* 新增接口节点
*/
@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));
}
}

View File

@@ -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();
}
}

View File

@@ -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<TestApiGroup> 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);
}

View File

@@ -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<TestApiGroup> 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);
}

View File

@@ -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<TestApiGroup> 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);
}
}

View File

@@ -0,0 +1,76 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.test.test.mapper.TestApiGroupMapper">
<resultMap type="TestApiGroup" id="TestApiGroupResult">
<result property="id" column="id" />
<result property="name" column="name" />
<result property="delFlag" column="del_flag" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectTestApiGroupVo">
select id, name, del_flag, create_by, create_time, update_by, update_time from test_api_group
</sql>
<select id="selectTestApiGroupList" parameterType="TestApiGroup" resultMap="TestApiGroupResult">
<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>
<insert id="insertTestApiGroup" parameterType="TestApiGroup" useGeneratedKeys="true" keyProperty="id">
insert into test_api_group
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="name != null">name,</if>
<if test="delFlag != null">del_flag,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null">#{name},</if>
<if test="delFlag != null">#{delFlag},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateTestApiGroup" parameterType="TestApiGroup">
update test_api_group
<trim prefix="SET" suffixOverrides=",">
<if test="name != null">name = #{name},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteTestApiGroupById" parameterType="Long">
delete from test_api_group where id = #{id}
</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>

View File

@@ -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'
})
}