整理代码
This commit is contained in:
@@ -17,7 +17,7 @@ public interface TestApiMapper {
|
|||||||
* @param id 接口主键
|
* @param id 接口主键
|
||||||
* @return 接口
|
* @return 接口
|
||||||
*/
|
*/
|
||||||
public TestApi selectTestApiById(Long id);
|
TestApi selectTestApiById(Long id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询接口列表
|
* 查询接口列表
|
||||||
@@ -25,7 +25,7 @@ public interface TestApiMapper {
|
|||||||
* @param qo 接口
|
* @param qo 接口
|
||||||
* @return 接口集合
|
* @return 接口集合
|
||||||
*/
|
*/
|
||||||
public List<TestApi> selectTestApiList(TestApiListQO qo);
|
List<TestApi> selectTestApiList(TestApiListQO qo);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增接口
|
* 新增接口
|
||||||
@@ -33,7 +33,7 @@ public interface TestApiMapper {
|
|||||||
* @param testApi 接口
|
* @param testApi 接口
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int insertTestApi(TestApi testApi);
|
int insertTestApi(TestApi testApi);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改接口
|
* 修改接口
|
||||||
@@ -41,7 +41,7 @@ public interface TestApiMapper {
|
|||||||
* @param testApi 接口
|
* @param testApi 接口
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int updateTestApi(TestApi testApi);
|
int updateTestApi(TestApi testApi);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除接口
|
* 删除接口
|
||||||
@@ -49,13 +49,13 @@ public interface TestApiMapper {
|
|||||||
* @param id 接口主键
|
* @param id 接口主键
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteTestApiById(Long id);
|
int deleteTestApiById(Long id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量删除接口
|
* 批量删除接口(通过节点id)
|
||||||
*
|
*
|
||||||
* @param ids 需要删除的数据主键集合
|
* @param groupId 需要删除的接口主键集合
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteTestApiByIds(Long[] ids);
|
int deleteTestApiByGroupId(Long groupId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ public interface ITestApiService {
|
|||||||
* @param id 接口主键
|
* @param id 接口主键
|
||||||
* @return 接口
|
* @return 接口
|
||||||
*/
|
*/
|
||||||
public TestApi selectTestApiById(Long id);
|
TestApi selectTestApiById(Long id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询接口列表
|
* 查询接口列表
|
||||||
@@ -25,7 +25,7 @@ public interface ITestApiService {
|
|||||||
* @param qo 接口
|
* @param qo 接口
|
||||||
* @return 接口集合
|
* @return 接口集合
|
||||||
*/
|
*/
|
||||||
public List<TestApi> selectTestApiList(TestApiListQO qo);
|
List<TestApi> selectTestApiList(TestApiListQO qo);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增接口
|
* 新增接口
|
||||||
@@ -33,7 +33,7 @@ public interface ITestApiService {
|
|||||||
* @param testApi 接口
|
* @param testApi 接口
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int insertTestApi(TestApi testApi);
|
int insertTestApi(TestApi testApi);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导入Swagger接口
|
* 导入Swagger接口
|
||||||
@@ -49,15 +49,15 @@ public interface ITestApiService {
|
|||||||
* @param testApi 接口
|
* @param testApi 接口
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int updateTestApi(TestApi testApi);
|
int updateTestApi(TestApi testApi);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量删除接口
|
* 批量删除接口(通过节点id)
|
||||||
*
|
*
|
||||||
* @param ids 需要删除的接口主键集合
|
* @param groupId 需要删除的接口主键集合
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteTestApiByIds(Long[] ids);
|
int deleteTestApiByGroupId(Long groupId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除接口信息
|
* 删除接口信息
|
||||||
@@ -65,5 +65,5 @@ public interface ITestApiService {
|
|||||||
* @param id 接口主键
|
* @param id 接口主键
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteTestApiById(Long id);
|
int deleteTestApiById(Long id);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package com.test.test.service.impl;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.alibaba.fastjson2.JSON;
|
|
||||||
import com.alibaba.fastjson2.JSONObject;
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
import com.test.common.utils.DateUtils;
|
import com.test.common.utils.DateUtils;
|
||||||
import com.test.common.utils.http.HttpUtils;
|
import com.test.common.utils.http.HttpUtils;
|
||||||
@@ -75,15 +74,9 @@ public class TestApiServiceImpl implements ITestApiService {
|
|||||||
return testApiMapper.updateTestApi(testApi);
|
return testApiMapper.updateTestApi(testApi);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量删除接口
|
|
||||||
*
|
|
||||||
* @param ids 需要删除的接口主键
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public int deleteTestApiByIds(Long[] ids) {
|
public int deleteTestApiByGroupId(Long groupId) {
|
||||||
return testApiMapper.deleteTestApiByIds(ids);
|
return testApiMapper.deleteTestApiByGroupId(groupId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -20,6 +20,9 @@ public class TestGroupServiceImpl implements ITestGroupService {
|
|||||||
@Resource
|
@Resource
|
||||||
private TestGroupMapper testGroupMapper;
|
private TestGroupMapper testGroupMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private TestApiServiceImpl testApiServiceImpl;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询节点(文件夹)列表
|
* 查询节点(文件夹)列表
|
||||||
*
|
*
|
||||||
@@ -64,6 +67,7 @@ public class TestGroupServiceImpl implements ITestGroupService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int deleteTestGroupById(Long id) {
|
public int deleteTestGroupById(Long id) {
|
||||||
|
|
||||||
return testGroupMapper.deleteTestGroupById(id);
|
return testGroupMapper.deleteTestGroupById(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -94,10 +94,7 @@
|
|||||||
delete from test_api where id = #{id}
|
delete from test_api where id = #{id}
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
<delete id="deleteTestApiByIds" parameterType="String">
|
<delete id="deleteTestApiByGroupId" parameterType="Long">
|
||||||
delete from test_api where id in
|
delete from test_api where groupId = #{groupId}
|
||||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
||||||
#{id}
|
|
||||||
</foreach>
|
|
||||||
</delete>
|
</delete>
|
||||||
</mapper>
|
</mapper>
|
||||||
@@ -101,7 +101,35 @@ export const constantRoutes = [
|
|||||||
meta: { title: '添加接口', activeMenu: '/api' }
|
meta: { title: '添加接口', activeMenu: '/api' }
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
},
|
||||||
|
{
|
||||||
|
path: '/api/edit',
|
||||||
|
component: Layout,
|
||||||
|
hidden: true,
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
path: '',
|
||||||
|
component: () => import('@/views/test/api/edit'),
|
||||||
|
name: 'ApiEdit',
|
||||||
|
noCache: true,
|
||||||
|
meta: { title: '修改接口', activeMenu: '/api' }
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: '/api/import',
|
||||||
|
component: Layout,
|
||||||
|
hidden: true,
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
path: '',
|
||||||
|
component: () => import('@/views/test/api/import'),
|
||||||
|
name: 'ApiImport',
|
||||||
|
noCache: true,
|
||||||
|
meta: { title: '导入接口', activeMenu: '/api' }
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
// 动态路由,基于用户权限动态去加载
|
// 动态路由,基于用户权限动态去加载
|
||||||
|
|||||||
27
test-ui/src/views/test/api/edit.vue
Normal file
27
test-ui/src/views/test/api/edit.vue
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
edit
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: "ApiEdit",
|
||||||
|
dicts: ['http_method'],
|
||||||
|
created () {
|
||||||
|
console.log(this.$route.query.id)
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
// 表单参数
|
||||||
|
form: {},
|
||||||
|
// 表单校验
|
||||||
|
rules: {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
|
||||||
|
</style>
|
||||||
27
test-ui/src/views/test/api/import.vue
Normal file
27
test-ui/src/views/test/api/import.vue
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
import
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: "ApiImport",
|
||||||
|
dicts: ['http_method'],
|
||||||
|
created () {
|
||||||
|
console.log(this.$route.query.groupId)
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
// 表单参数
|
||||||
|
form: {},
|
||||||
|
// 表单校验
|
||||||
|
rules: {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
|
||||||
|
</style>
|
||||||
@@ -20,6 +20,7 @@
|
|||||||
<el-row :gutter="10" class="mb8">
|
<el-row :gutter="10" class="mb8">
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd">新增</el-button>
|
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd">新增</el-button>
|
||||||
|
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleImport">导入</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
</el-row>
|
</el-row>
|
||||||
@@ -112,9 +113,12 @@ export default {
|
|||||||
handleAdd() {
|
handleAdd() {
|
||||||
this.$tab.openPage("添加接口", "/api/add", {groupId: this.queryParams.groupId});
|
this.$tab.openPage("添加接口", "/api/add", {groupId: this.queryParams.groupId});
|
||||||
},
|
},
|
||||||
|
handleImport() {
|
||||||
|
this.$tab.openPage("导入接口", "/api/import", {groupId: this.queryParams.groupId});
|
||||||
|
},
|
||||||
/** 修改按钮操作 */
|
/** 修改按钮操作 */
|
||||||
handleUpdate(row) {
|
handleUpdate(row) {
|
||||||
this.$tab.openPage("修改接口", "/api/add", {id: row.id || this.ids});
|
this.$tab.openPage("修改接口", "/api/edit", {id: row.id});
|
||||||
},
|
},
|
||||||
/** 删除按钮操作 */
|
/** 删除按钮操作 */
|
||||||
handleDelete(row) {
|
handleDelete(row) {
|
||||||
|
|||||||
Reference in New Issue
Block a user