文件夹管理部分代码
This commit is contained in:
@@ -6,12 +6,7 @@ import com.test.test.domain.qo.IDQO;
|
||||
import com.test.test.domain.qo.TestApiListQO;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
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 org.springframework.web.bind.annotation.*;
|
||||
import com.test.common.annotation.Log;
|
||||
import com.test.common.core.controller.BaseController;
|
||||
import com.test.common.core.domain.AjaxResult;
|
||||
@@ -19,6 +14,7 @@ import com.test.common.enums.BusinessType;
|
||||
import com.test.test.domain.TestApi;
|
||||
import com.test.test.service.ITestApiService;
|
||||
import com.test.common.core.page.TableDataInfo;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
/**
|
||||
* 接口Controller
|
||||
@@ -58,6 +54,14 @@ public class TestApiController extends BaseController {
|
||||
return toAjax(testApiService.insertTestApi(testApi));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入Swagger接口
|
||||
*/
|
||||
@Log(title = "接口", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/import/swagger")
|
||||
public AjaxResult importSwagger(@RequestParam(value = "url") String url) throws Exception {
|
||||
return toAjax(testApiService.importSwaggerApi(url));
|
||||
}
|
||||
/**
|
||||
* 修改接口
|
||||
*/
|
||||
@@ -75,4 +79,6 @@ public class TestApiController extends BaseController {
|
||||
public AjaxResult remove(@RequestBody IDQO qo) {
|
||||
return toAjax(testApiService.deleteTestApiById(qo.getId()));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@ 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.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
@@ -43,7 +42,7 @@ public class TestApiGroupController extends BaseController {
|
||||
@Log(title = "接口节点", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/add")
|
||||
public AjaxResult add(@RequestBody TestApiGroup testApiGroup) {
|
||||
return toAjax(testApiGroupService.insertTestApiGroup(testApiGroup));
|
||||
return success(testApiGroupService.insertTestApiGroup(testApiGroup));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -19,6 +19,10 @@ public class TestApiGroup extends BaseEntity
|
||||
/** 节点id */
|
||||
private Long id;
|
||||
|
||||
/** 父节点id */
|
||||
@Excel(name = "父节点id")
|
||||
private Long parentId;
|
||||
|
||||
/** 节点名称 */
|
||||
@Excel(name = "节点名称")
|
||||
private String name;
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
package com.test.test.domain.dto;
|
||||
|
||||
public class SwaggerInfo {
|
||||
}
|
||||
@@ -24,7 +24,7 @@ public interface ITestApiGroupService {
|
||||
* @param testApiGroup 接口节点
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertTestApiGroup(TestApiGroup testApiGroup);
|
||||
public TestApiGroup insertTestApiGroup(TestApiGroup testApiGroup);
|
||||
|
||||
/**
|
||||
* 修改接口节点
|
||||
|
||||
@@ -35,6 +35,14 @@ public interface ITestApiService {
|
||||
*/
|
||||
public int insertTestApi(TestApi testApi);
|
||||
|
||||
/**
|
||||
* 导入Swagger接口
|
||||
*
|
||||
* @param url Swagger文档链接
|
||||
* @return 结果
|
||||
*/
|
||||
int importSwaggerApi(String url);
|
||||
|
||||
/**
|
||||
* 修改接口
|
||||
*
|
||||
|
||||
@@ -38,10 +38,11 @@ public class TestApiGroupServiceImpl implements ITestApiGroupService
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertTestApiGroup(TestApiGroup testApiGroup)
|
||||
public TestApiGroup insertTestApiGroup(TestApiGroup testApiGroup)
|
||||
{
|
||||
testApiGroup.setCreateTime(DateUtils.getNowDate());
|
||||
return testApiGroupMapper.insertTestApiGroup(testApiGroup);
|
||||
testApiGroupMapper.insertTestApiGroup(testApiGroup);
|
||||
return testApiGroup;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,7 +2,10 @@ 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;
|
||||
import com.test.test.domain.qo.TestApiListQO;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -54,6 +57,12 @@ public class TestApiServiceImpl implements ITestApiService {
|
||||
return testApiMapper.insertTestApi(testApi);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int importSwaggerApi(String url) {
|
||||
JSONObject json = JSONObject.parse(HttpUtils.sendGet(url));
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改接口
|
||||
*
|
||||
|
||||
@@ -6,6 +6,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
|
||||
<resultMap type="TestApiGroup" id="TestApiGroupResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="parentId" column="parent_id" />
|
||||
<result property="name" column="name" />
|
||||
<result property="delFlag" column="del_flag" />
|
||||
<result property="createBy" column="create_by" />
|
||||
@@ -15,7 +16,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectTestApiGroupVo">
|
||||
select id, name, del_flag, create_by, create_time, update_by, update_time from test_api_group
|
||||
select id, parent_id, name, del_flag, create_by, create_time, update_by, update_time from test_api_group
|
||||
</sql>
|
||||
|
||||
<select id="selectTestApiGroupList" resultMap="TestApiGroupResult">
|
||||
@@ -25,26 +26,29 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<insert id="insertTestApiGroup" parameterType="TestApiGroup" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into test_api_group
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="parentId != null">parent_id,</if>
|
||||
<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>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="parentId != null">#{parentId},</if>
|
||||
<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>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateTestApiGroup" parameterType="TestApiGroup">
|
||||
update test_api_group
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="parentId != null">parent_id = #{parentId},</if>
|
||||
<if test="name != null">name = #{name},</if>
|
||||
<if test="delFlag != null">del_flag = #{delFlag},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
|
||||
Reference in New Issue
Block a user