Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
doc_wei
Skyeye
提交
a4b82c18
S
Skyeye
项目概览
doc_wei
/
Skyeye
通知
1173
Star
154
Fork
127
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
Skyeye
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
a4b82c18
编写于
12月 03, 2021
作者:
L
laijiaping
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
api参数(api_property)新增、修改、删除、列表查询功能
上级
d98a8eac
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
419 addition
and
0 deletion
+419
-0
skyeye-api/src/main/java/com/skyeye/controller/ApiPropertyController.java
...ain/java/com/skyeye/controller/ApiPropertyController.java
+95
-0
skyeye-api/src/main/java/com/skyeye/dao/ApiPropertyDao.java
skyeye-api/src/main/java/com/skyeye/dao/ApiPropertyDao.java
+38
-0
skyeye-api/src/main/java/com/skyeye/service/ApiPropertyService.java
.../src/main/java/com/skyeye/service/ApiPropertyService.java
+27
-0
skyeye-api/src/main/java/com/skyeye/service/impl/ApiPropertyServiceImpl.java
.../java/com/skyeye/service/impl/ApiPropertyServiceImpl.java
+139
-0
skyeye-api/src/main/resources/mapper/api/ApiPropertyMapper.xml
...e-api/src/main/resources/mapper/api/ApiPropertyMapper.xml
+120
-0
未找到文件。
skyeye-api/src/main/java/com/skyeye/controller/ApiPropertyController.java
0 → 100644
浏览文件 @
a4b82c18
/*******************************************************************************
* Copyright 卫志强 QQ:598748873@qq.com Inc. All rights reserved. 开源地址:https://gitee.com/doc_wei01/skyeye
******************************************************************************/
package
com.skyeye.controller
;
import
com.skyeye.common.object.InputObject
;
import
com.skyeye.common.object.OutputObject
;
import
com.skyeye.service.ApiPropertyService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.ResponseBody
;
@Controller
public
class
ApiPropertyController
{
@Autowired
private
ApiPropertyService
apiPropertyService
;
/**
* @param inputObject
* @param outputObject
* @return void 返回类型
* @throws Exception 参数
* @throws
* @Title: queryApiPropertyList
* @Description: 获取api接口参数列表
*/
@RequestMapping
(
"/post/ApiPropertyController/queryApiPropertyList"
)
@ResponseBody
public
void
queryApiPropertyList
(
InputObject
inputObject
,
OutputObject
outputObject
)
throws
Exception
{
apiPropertyService
.
queryApiPropertyMationList
(
inputObject
,
outputObject
);
}
/**
* @param inputObject
* @param outputObject
* @return void 返回类型
* @throws Exception 参数
* @throws
* @Title: insertApiPropertyMation
* @Description: 新增api接口参数信息
*/
@RequestMapping
(
"/post/ApiPropertyController/insertApiPropertyMation"
)
@ResponseBody
public
void
insertApiPropertyMation
(
InputObject
inputObject
,
OutputObject
outputObject
)
throws
Exception
{
apiPropertyService
.
insertApiPropertyMation
(
inputObject
,
outputObject
);
}
/**
* @param inputObject
* @param outputObject
* @return void 返回类型
* @throws Exception 参数
* @throws
* @Title: deleteApiPropertyById
* @Description: 删除api接口参数信息
*/
@RequestMapping
(
"/post/ApiPropertyController/deleteApiPropertyById"
)
@ResponseBody
public
void
deleteApiPropertyById
(
InputObject
inputObject
,
OutputObject
outputObject
)
throws
Exception
{
apiPropertyService
.
deleteApiPropertyMationById
(
inputObject
,
outputObject
);
}
/**
* @param inputObject
* @param outputObject
* @return void 返回类型
* @throws Exception 参数
* @throws
* @Title: selectApiPropertyById
* @Description: 通过id查找对应的api接口参数信息
*/
@RequestMapping
(
"/post/ApiPropertyController/selectApiPropertyById"
)
@ResponseBody
public
void
selectApiPropertyById
(
InputObject
inputObject
,
OutputObject
outputObject
)
throws
Exception
{
apiPropertyService
.
selectApiPropertyMationById
(
inputObject
,
outputObject
);
}
/**
* @param inputObject
* @param outputObject
* @return void 返回类型
* @throws Exception 参数
* @throws
* @Title: editApiPropertyMationById
* @Description: 通过id编辑对应的api接口参数信息
*/
@RequestMapping
(
"/post/ApiPropertyController/editApiPropertyMationById"
)
@ResponseBody
public
void
editApiPropertyMationById
(
InputObject
inputObject
,
OutputObject
outputObject
)
throws
Exception
{
apiPropertyService
.
editApiPropertyMationById
(
inputObject
,
outputObject
);
}
}
skyeye-api/src/main/java/com/skyeye/dao/ApiPropertyDao.java
0 → 100644
浏览文件 @
a4b82c18
/*******************************************************************************
* Copyright 卫志强 QQ:598748873@qq.com Inc. All rights reserved. 开源地址:https://gitee.com/doc_wei01/skyeye
******************************************************************************/
package
com.skyeye.dao
;
import
java.util.List
;
import
java.util.Map
;
/**
* @ClassName: ApiPropertyDao
* @Description: api接口参数数据层
* @author: skyeye云系列
* @date: 2021/11/28 14:42
* @Copyright: 2021 https://gitee.com/doc_wei01/skyeye Inc. All rights reserved.
* 注意:本内容仅限购买后使用.禁止私自外泄以及用于其他的商业目的
*/
public
interface
ApiPropertyDao
{
public
List
<
Map
<
String
,
Object
>>
queryApiPropertyList
(
Map
<
String
,
Object
>
map
)
throws
Exception
;
public
Map
<
String
,
Object
>
queryApiPropertyMationByApiId
(
Map
<
String
,
Object
>
map
)
throws
Exception
;
public
int
insertApiProperty
(
List
<
Map
<
String
,
Object
>>
beans
)
throws
Exception
;
public
int
deleteApiPropertyById
(
Map
<
String
,
Object
>
map
)
throws
Exception
;
public
int
deleteApiPropertyByApiId
(
Map
<
String
,
Object
>
map
)
throws
Exception
;
public
int
deleteApiPropertyByGroupId
(
Map
<
String
,
Object
>
map
)
throws
Exception
;
public
int
deleteApiPropertyByModelId
(
Map
<
String
,
Object
>
map
)
throws
Exception
;
public
Map
<
String
,
Object
>
queryApiPropertyToEditById
(
Map
<
String
,
Object
>
map
)
throws
Exception
;
public
int
editApiPropertyById
(
Map
<
String
,
Object
>
map
)
throws
Exception
;
}
skyeye-api/src/main/java/com/skyeye/service/ApiPropertyService.java
0 → 100644
浏览文件 @
a4b82c18
/*******************************************************************************
* Copyright 卫志强 QQ:598748873@qq.com Inc. All rights reserved. 开源地址:https://gitee.com/doc_wei01/skyeye
******************************************************************************/
package
com.skyeye.service
;
import
com.skyeye.common.object.InputObject
;
import
com.skyeye.common.object.OutputObject
;
import
java.util.List
;
import
java.util.Map
;
public
interface
ApiPropertyService
{
void
queryApiPropertyMationList
(
InputObject
inputObject
,
OutputObject
outputObject
)
throws
Exception
;
void
insertApiPropertyMation
(
InputObject
inputObject
,
OutputObject
outputObject
)
throws
Exception
;
void
insertApiPropertyMationList
(
List
<
Map
<
String
,
Object
>>
beans
,
String
userId
)
throws
Exception
;
void
deleteApiPropertyMationById
(
InputObject
inputObject
,
OutputObject
outputObject
)
throws
Exception
;
void
selectApiPropertyMationById
(
InputObject
inputObject
,
OutputObject
outputObject
)
throws
Exception
;
void
editApiPropertyMationById
(
InputObject
inputObject
,
OutputObject
outputObject
)
throws
Exception
;
}
skyeye-api/src/main/java/com/skyeye/service/impl/ApiPropertyServiceImpl.java
0 → 100644
浏览文件 @
a4b82c18
/*******************************************************************************
* Copyright 卫志强 QQ:598748873@qq.com Inc. All rights reserved. 开源地址:https://gitee.com/doc_wei01/skyeye
******************************************************************************/
package
com.skyeye.service.impl
;
import
com.github.pagehelper.Page
;
import
com.github.pagehelper.PageHelper
;
import
com.skyeye.common.object.InputObject
;
import
com.skyeye.common.object.OutputObject
;
import
com.skyeye.common.util.DateUtil
;
import
com.skyeye.common.util.ToolUtil
;
import
com.skyeye.dao.ApiPropertyDao
;
import
com.skyeye.service.ApiPropertyService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.Map
;
/**
* @ClassName: ApiPropertyServiceImpl
* @Description: api接口参数服务类
* @author: skyeye云系列
* @date: 2021/11/28 15:10
* @Copyright: 2021 https://gitee.com/doc_wei01/skyeye Inc. All rights reserved.
* 注意:本内容仅限购买后使用.禁止私自外泄以及用于其他的商业目的
*/
@Service
public
class
ApiPropertyServiceImpl
implements
ApiPropertyService
{
@Autowired
private
ApiPropertyDao
apiPropertyDao
;
/**
* @param inputObject
* @param outputObject
* @return void 返回类型
* @throws Exception ApiProperty
* @throws
* @Title: queryApiPropertyList
* @Description: 获取api接口参数表
*/
@Override
public
void
queryApiPropertyMationList
(
InputObject
inputObject
,
OutputObject
outputObject
)
throws
Exception
{
Map
<
String
,
Object
>
map
=
inputObject
.
getParams
();
map
.
put
(
"userId"
,
inputObject
.
getLogParams
().
get
(
"id"
));
Page
pages
=
PageHelper
.
startPage
(
Integer
.
parseInt
(
map
.
get
(
"page"
).
toString
()),
Integer
.
parseInt
(
map
.
get
(
"limit"
).
toString
()));
List
<
Map
<
String
,
Object
>>
beans
=
apiPropertyDao
.
queryApiPropertyList
(
map
);
outputObject
.
setBeans
(
beans
);
outputObject
.
settotal
(
pages
.
getTotal
());
}
/**
* @param inputObject
* @param outputObject
* @return void 返回类型
* @throws Exception ApiProperty
* @throws
* @Title: insertApiPropertyMation
* @Description: 新增api接口参数
*/
@Override
@Transactional
(
value
=
"transactionManager"
)
public
void
insertApiPropertyMation
(
InputObject
inputObject
,
OutputObject
outputObject
)
throws
Exception
{
Map
<
String
,
Object
>
map
=
inputObject
.
getParams
();
Map
<
String
,
Object
>
bean
=
apiPropertyDao
.
queryApiPropertyMationByApiId
(
map
);
if
(
bean
!=
null
&&
!
bean
.
isEmpty
())
{
outputObject
.
setreturnMessage
(
"该API参数已存在,请更换"
);
}
else
{
this
.
insertApiPropertyMationList
(
Arrays
.
asList
(
map
),
inputObject
.
getLogParams
().
get
(
"id"
).
toString
());
}
}
@Override
@Transactional
(
value
=
"transactionManager"
)
public
void
insertApiPropertyMationList
(
List
<
Map
<
String
,
Object
>>
beans
,
String
userId
)
throws
Exception
{
beans
.
forEach
(
bean
->
{
bean
.
put
(
"id"
,
ToolUtil
.
getSurFaceId
());
bean
.
put
(
"userId"
,
userId
);
bean
.
put
(
"createTime"
,
DateUtil
.
getTimeAndToString
());
});
apiPropertyDao
.
insertApiProperty
(
beans
);
}
/**
* @param inputObject
* @param outputObject
* @return void 返回类型
* @throws Exception ApiProperty
* @throws
* @Title: deleteApiPropertyMationById
* @Description: 删除api接口参数信息
*/
@Override
@Transactional
(
value
=
"transactionManager"
)
public
void
deleteApiPropertyMationById
(
InputObject
inputObject
,
OutputObject
outputObject
)
throws
Exception
{
Map
<
String
,
Object
>
map
=
inputObject
.
getParams
();
apiPropertyDao
.
deleteApiPropertyById
(
map
);
}
/**
* @param inputObject
* @param outputObject
* @return void 返回类型
* @throws Exception ApiProperty
* @throws
* @Title: selectApiPropertyMationById
* @Description: 通过id查找对应的api接口参数信息
*/
@Override
public
void
selectApiPropertyMationById
(
InputObject
inputObject
,
OutputObject
outputObject
)
throws
Exception
{
Map
<
String
,
Object
>
map
=
inputObject
.
getParams
();
Map
<
String
,
Object
>
bean
=
apiPropertyDao
.
queryApiPropertyToEditById
(
map
);
outputObject
.
setBean
(
bean
);
outputObject
.
settotal
(
1
);
}
/**
* @param inputObject
* @param outputObject
* @return void 返回类型
* @throws Exception ApiProperty
* @throws
* @Title: editApiPropertyMationById
* @Description: 通过id编辑对应的api接口参数信息
*/
@Override
@Transactional
(
value
=
"transactionManager"
)
public
void
editApiPropertyMationById
(
InputObject
inputObject
,
OutputObject
outputObject
)
throws
Exception
{
Map
<
String
,
Object
>
map
=
inputObject
.
getParams
();
apiPropertyDao
.
deleteApiPropertyById
(
map
);
this
.
insertApiPropertyMationList
(
Arrays
.
asList
(
map
),
inputObject
.
getLogParams
().
get
(
"id"
).
toString
());
}
}
skyeye-api/src/main/resources/mapper/api/ApiPropertyMapper.xml
0 → 100644
浏览文件 @
a4b82c18
<?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.skyeye.dao.ApiPropertyDao"
>
<select
id=
"queryApiPropertyList"
parameterType=
"java.util.Map"
resultType=
"java.util.Map"
>
SELECT
a.id,
a.api_id apiId,
a.property_id propertyId,
a.property_name propertyName,
a.ref ref,
a.example_default exampleDefault,
a.default `default`,
a.remark remark
FROM
api_property a
WHERE
1 = 1
<if
test=
"apiId != '' and apiId != null"
>
AND a.api_id = #{apiId}
</if>
<if
test=
"propertyId != '' and propertyId != null"
>
AND a.property_id = #{propertyId}
</if>
<if
test=
"propertyName != '' and propertyName != null"
>
AND a.property_name = #{propertyName}
</if>
ORDER BY a.last_update_time DESC
</select>
<select
id=
"queryApiPropertyMationByApiId"
parameterType=
"java.util.Map"
resultType=
"java.util.Map"
>
SELECT
a.id
FROM
api_property a
WHERE
a.api_id = #{apiId}
<if
test=
"id != '' and id != null"
>
AND a.id != #{id}
</if>
</select>
<insert
id=
"insertApiProperty"
parameterType=
"java.util.Map"
>
INSERT INTO api_property
(id, `default`, api_id, property_id, property_name, ref, example_default, remark, create_id, create_time, last_update_id, last_update_time)
VALUES
<foreach
collection=
"list"
item=
"item"
index=
"index"
separator=
","
>
(#{item.id}, #{item.default}, #{item.apiId}, #{item.propertyId}, #{item.propertyName}, #{item.ref}, #{item.exampleDefault}, #{item.remark}, #{item.userId}, #{item.createTime}, #{item.userId}, #{item.createTime})
</foreach>
</insert>
<select
id=
"queryApiPropertyToEditById"
parameterType=
"java.util.Map"
resultType=
"java.util.Map"
>
SELECT
a.id,
a.api_id apiId,
a.property_id propertyId,
a.property_name propertyName,
a.ref ref,
a.example_default exampleDefault,
a.default `default`,
a.remark remark
FROM
api_property a
WHERE
a.id = #{id}
</select>
<update
id=
"editApiPropertyById"
parameterType=
"java.util.Map"
>
UPDATE api_property
<set>
`default` = #{defaul},
api_id = #{apiId},
property_id = #{propertyId},
property_name = #{propertyName},
ref = #{ref},
example_default = #{exampleDefault},
remark = #{remark}
</set>
WHERE
id = #{id}
</update>
<delete
id=
"deleteApiPropertyById"
parameterType=
"java.util.Map"
>
DELETE
FROM
api_property
WHERE
id = #{id}
</delete>
<delete
id=
"deleteApiPropertyByApiId"
parameterType=
"java.util.Map"
>
DELETE
FROM
api_property
WHERE
api_id = #{id}
</delete>
<delete
id=
"deleteApiPropertyByGroupId"
parameterType=
"java.util.Map"
>
DELETE a
FROM
api_property a
INNER JOIN api_mation b ON a.api_id = b.id
INNER JOIN api_group d ON b.group_id = d.id
WHERE
b.group_id = #{id}
</delete>
<delete
id=
"deleteApiPropertyByModelId"
parameterType=
"java.util.Map"
>
DELETE a
FROM
api_property a
LEFT JOIN api_mation b ON a.api_id = b.id
LEFT JOIN api_group d ON b.group_id = d.id
LEFT JOIN api_model f ON d.model_id = f.id
WHERE
f.id = #{id}
</delete>
</mapper>
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录