整理代码
This commit is contained in:
@@ -17,7 +17,7 @@ public interface TestApiMapper {
|
||||
* @param id 接口主键
|
||||
* @return 接口
|
||||
*/
|
||||
public TestApi selectTestApiById(Long id);
|
||||
TestApi selectTestApiById(Long id);
|
||||
|
||||
/**
|
||||
* 查询接口列表
|
||||
@@ -25,7 +25,7 @@ public interface TestApiMapper {
|
||||
* @param qo 接口
|
||||
* @return 接口集合
|
||||
*/
|
||||
public List<TestApi> selectTestApiList(TestApiListQO qo);
|
||||
List<TestApi> selectTestApiList(TestApiListQO qo);
|
||||
|
||||
/**
|
||||
* 新增接口
|
||||
@@ -33,7 +33,7 @@ public interface TestApiMapper {
|
||||
* @param testApi 接口
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertTestApi(TestApi testApi);
|
||||
int insertTestApi(TestApi testApi);
|
||||
|
||||
/**
|
||||
* 修改接口
|
||||
@@ -41,7 +41,7 @@ public interface TestApiMapper {
|
||||
* @param testApi 接口
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateTestApi(TestApi testApi);
|
||||
int updateTestApi(TestApi testApi);
|
||||
|
||||
/**
|
||||
* 删除接口
|
||||
@@ -49,13 +49,13 @@ public interface TestApiMapper {
|
||||
* @param id 接口主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteTestApiById(Long id);
|
||||
int deleteTestApiById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除接口
|
||||
* 批量删除接口(通过节点id)
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @param groupId 需要删除的接口主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteTestApiByIds(Long[] ids);
|
||||
int deleteTestApiByGroupId(Long groupId);
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ public interface ITestApiService {
|
||||
* @param id 接口主键
|
||||
* @return 接口
|
||||
*/
|
||||
public TestApi selectTestApiById(Long id);
|
||||
TestApi selectTestApiById(Long id);
|
||||
|
||||
/**
|
||||
* 查询接口列表
|
||||
@@ -25,7 +25,7 @@ public interface ITestApiService {
|
||||
* @param qo 接口
|
||||
* @return 接口集合
|
||||
*/
|
||||
public List<TestApi> selectTestApiList(TestApiListQO qo);
|
||||
List<TestApi> selectTestApiList(TestApiListQO qo);
|
||||
|
||||
/**
|
||||
* 新增接口
|
||||
@@ -33,7 +33,7 @@ public interface ITestApiService {
|
||||
* @param testApi 接口
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertTestApi(TestApi testApi);
|
||||
int insertTestApi(TestApi testApi);
|
||||
|
||||
/**
|
||||
* 导入Swagger接口
|
||||
@@ -49,15 +49,15 @@ public interface ITestApiService {
|
||||
* @param testApi 接口
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateTestApi(TestApi testApi);
|
||||
int updateTestApi(TestApi testApi);
|
||||
|
||||
/**
|
||||
* 批量删除接口
|
||||
* 批量删除接口(通过节点id)
|
||||
*
|
||||
* @param ids 需要删除的接口主键集合
|
||||
* @param groupId 需要删除的接口主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteTestApiByIds(Long[] ids);
|
||||
int deleteTestApiByGroupId(Long groupId);
|
||||
|
||||
/**
|
||||
* 删除接口信息
|
||||
@@ -65,5 +65,5 @@ public interface ITestApiService {
|
||||
* @param id 接口主键
|
||||
* @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 com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.test.common.utils.DateUtils;
|
||||
import com.test.common.utils.http.HttpUtils;
|
||||
@@ -75,15 +74,9 @@ public class TestApiServiceImpl implements ITestApiService {
|
||||
return testApiMapper.updateTestApi(testApi);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除接口
|
||||
*
|
||||
* @param ids 需要删除的接口主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteTestApiByIds(Long[] ids) {
|
||||
return testApiMapper.deleteTestApiByIds(ids);
|
||||
public int deleteTestApiByGroupId(Long groupId) {
|
||||
return testApiMapper.deleteTestApiByGroupId(groupId);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -20,6 +20,9 @@ public class TestGroupServiceImpl implements ITestGroupService {
|
||||
@Resource
|
||||
private TestGroupMapper testGroupMapper;
|
||||
|
||||
@Resource
|
||||
private TestApiServiceImpl testApiServiceImpl;
|
||||
|
||||
/**
|
||||
* 查询节点(文件夹)列表
|
||||
*
|
||||
@@ -64,6 +67,7 @@ public class TestGroupServiceImpl implements ITestGroupService {
|
||||
*/
|
||||
@Override
|
||||
public int deleteTestGroupById(Long id) {
|
||||
|
||||
return testGroupMapper.deleteTestGroupById(id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,10 +94,7 @@
|
||||
delete from test_api where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteTestApiByIds" parameterType="String">
|
||||
delete from test_api where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
<delete id="deleteTestApiByGroupId" parameterType="Long">
|
||||
delete from test_api where groupId = #{groupId}
|
||||
</delete>
|
||||
</mapper>
|
||||
@@ -101,8 +101,36 @@ export const constantRoutes = [
|
||||
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' }
|
||||
}
|
||||
]
|
||||
},
|
||||
]
|
||||
|
||||
// 动态路由,基于用户权限动态去加载
|
||||
export const dynamicRoutes = [
|
||||
|
||||
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-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="handleImport">导入</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
@@ -112,9 +113,12 @@ export default {
|
||||
handleAdd() {
|
||||
this.$tab.openPage("添加接口", "/api/add", {groupId: this.queryParams.groupId});
|
||||
},
|
||||
handleImport() {
|
||||
this.$tab.openPage("导入接口", "/api/import", {groupId: this.queryParams.groupId});
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.$tab.openPage("修改接口", "/api/add", {id: row.id || this.ids});
|
||||
this.$tab.openPage("修改接口", "/api/edit", {id: row.id});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
|
||||
Reference in New Issue
Block a user