Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Skyeye云
Skyeye
提交
d98a8eac
S
Skyeye
项目概览
Skyeye云
/
Skyeye
通知
1433
Star
162
Fork
130
代码
文件
提交
分支
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看板
提交
d98a8eac
编写于
12月 03, 2021
作者:
L
laijiaping
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
api分组(api_group)新增、修改、删除、列表查询功能
上级
8f4f39d6
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
393 addition
and
0 deletion
+393
-0
skyeye-api/src/main/java/com/skyeye/controller/ApiGroupController.java
...c/main/java/com/skyeye/controller/ApiGroupController.java
+95
-0
skyeye-api/src/main/java/com/skyeye/dao/ApiGroupDao.java
skyeye-api/src/main/java/com/skyeye/dao/ApiGroupDao.java
+34
-0
skyeye-api/src/main/java/com/skyeye/service/ApiGroupService.java
...api/src/main/java/com/skyeye/service/ApiGroupService.java
+27
-0
skyeye-api/src/main/java/com/skyeye/service/impl/ApiGroupServiceImpl.java
...ain/java/com/skyeye/service/impl/ApiGroupServiceImpl.java
+155
-0
skyeye-api/src/main/resources/mapper/api/ApiGroupMapper.xml
skyeye-api/src/main/resources/mapper/api/ApiGroupMapper.xml
+82
-0
未找到文件。
skyeye-api/src/main/java/com/skyeye/controller/ApiGroupController.java
0 → 100644
浏览文件 @
d98a8eac
/*******************************************************************************
* 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.ApiGroupService
;
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
ApiGroupController
{
@Autowired
private
ApiGroupService
apiGroupService
;
/**
* @param inputObject
* @param outputObject
* @return void 返回类型
* @throws Exception 参数
* @throws
* @Title: queryApiGroupList
* @Description: 获取api接口分组列表
*/
@RequestMapping
(
"/post/ApiGroupController/queryApiGroupList"
)
@ResponseBody
public
void
queryApiGroupList
(
InputObject
inputObject
,
OutputObject
outputObject
)
throws
Exception
{
apiGroupService
.
queryApiGroupMationList
(
inputObject
,
outputObject
);
}
/**
* @param inputObject
* @param outputObject
* @return void 返回类型
* @throws Exception 参数
* @throws
* @Title: insertApiGroupMation
* @Description: 新增api接口分组信息
*/
@RequestMapping
(
"/post/ApiGroupController/insertApiGroupMation"
)
@ResponseBody
public
void
insertApiGroupMation
(
InputObject
inputObject
,
OutputObject
outputObject
)
throws
Exception
{
apiGroupService
.
insertApiGroupMation
(
inputObject
,
outputObject
);
}
/**
* @param inputObject
* @param outputObject
* @return void 返回类型
* @throws Exception 参数
* @throws
* @Title: deleteApiGroupById
* @Description: 删除api接口分组信息
*/
@RequestMapping
(
"/post/ApiGroupController/deleteApiGroupById"
)
@ResponseBody
public
void
deleteApiGroupById
(
InputObject
inputObject
,
OutputObject
outputObject
)
throws
Exception
{
apiGroupService
.
deleteApiGroupMationById
(
inputObject
,
outputObject
);
}
/**
* @param inputObject
* @param outputObject
* @return void 返回类型
* @throws Exception 参数
* @throws
* @Title: selectApiGroupById
* @Description: 通过id查找对应的api接口分组信息
*/
@RequestMapping
(
"/post/ApiGroupController/selectApiGroupById"
)
@ResponseBody
public
void
selectApiGroupById
(
InputObject
inputObject
,
OutputObject
outputObject
)
throws
Exception
{
apiGroupService
.
selectApiGroupMationById
(
inputObject
,
outputObject
);
}
/**
* @param inputObject
* @param outputObject
* @return void 返回类型
* @throws Exception 参数
* @throws
* @Title: editApiGroupMationById
* @Description: 通过id编辑对应的api接口分组信息
*/
@RequestMapping
(
"/post/ApiGroupController/editApiGroupMationById"
)
@ResponseBody
public
void
editApiGroupMationById
(
InputObject
inputObject
,
OutputObject
outputObject
)
throws
Exception
{
apiGroupService
.
editApiGroupMationById
(
inputObject
,
outputObject
);
}
}
skyeye-api/src/main/java/com/skyeye/dao/ApiGroupDao.java
0 → 100644
浏览文件 @
d98a8eac
/*******************************************************************************
* 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: ApiGroupDao
* @Description: api接口分组数据层
* @author: skyeye云系列
* @date: 2021/11/28 13:20
* @Copyright: 2021 https://gitee.com/doc_wei01/skyeye Inc. All rights reserved.
* 注意:本内容仅限购买后使用.禁止私自外泄以及用于其他的商业目的
*/
public
interface
ApiGroupDao
{
public
List
<
Map
<
String
,
Object
>>
queryApiGroupList
(
Map
<
String
,
Object
>
map
)
throws
Exception
;
public
Map
<
String
,
Object
>
queryApiGroupByName
(
Map
<
String
,
Object
>
map
)
throws
Exception
;
public
int
insertApiGroup
(
List
<
Map
<
String
,
Object
>>
beans
)
throws
Exception
;
public
int
deleteApiGroupById
(
Map
<
String
,
Object
>
map
)
throws
Exception
;
public
int
deleteApiGroupByModelId
(
Map
<
String
,
Object
>
map
)
throws
Exception
;
public
Map
<
String
,
Object
>
queryApiGroupToEditById
(
Map
<
String
,
Object
>
map
)
throws
Exception
;
public
int
editApiGroupById
(
Map
<
String
,
Object
>
map
)
throws
Exception
;
}
skyeye-api/src/main/java/com/skyeye/service/ApiGroupService.java
0 → 100644
浏览文件 @
d98a8eac
/*******************************************************************************
* 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
ApiGroupService
{
void
queryApiGroupMationList
(
InputObject
inputObject
,
OutputObject
outputObject
)
throws
Exception
;
void
insertApiGroupMation
(
InputObject
inputObject
,
OutputObject
outputObject
)
throws
Exception
;
void
insertApiGroupMationList
(
List
<
Map
<
String
,
Object
>>
beans
,
String
userId
)
throws
Exception
;
void
deleteApiGroupMationById
(
InputObject
inputObject
,
OutputObject
outputObject
)
throws
Exception
;
void
selectApiGroupMationById
(
InputObject
inputObject
,
OutputObject
outputObject
)
throws
Exception
;
void
editApiGroupMationById
(
InputObject
inputObject
,
OutputObject
outputObject
)
throws
Exception
;
}
skyeye-api/src/main/java/com/skyeye/service/impl/ApiGroupServiceImpl.java
0 → 100644
浏览文件 @
d98a8eac
/*******************************************************************************
* 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.ApiGroupDao
;
import
com.skyeye.dao.ApiMationDao
;
import
com.skyeye.dao.ApiPropertyDao
;
import
com.skyeye.service.ApiGroupService
;
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: ApiGroupServiceImpl
* @Description: api接口分组服务类
* @author: skyeye云系列
* @date: 2021/11/28 13:45
* @Copyright: 2021 https://gitee.com/doc_wei01/skyeye Inc. All rights reserved.
* 注意:本内容仅限购买后使用.禁止私自外泄以及用于其他的商业目的
*/
@Service
public
class
ApiGroupServiceImpl
implements
ApiGroupService
{
@Autowired
private
ApiGroupDao
apiGroupDao
;
@Autowired
private
ApiMationDao
apiMationDao
;
@Autowired
private
ApiPropertyDao
apiPropertyDao
;
/**
* @param inputObject
* @param outputObject
* @return void 返回类型
* @throws Exception 参数
* @throws
* @Title: queryApiGroupList
* @Description: 获取api接口分组表
*/
@Override
public
void
queryApiGroupMationList
(
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
=
apiGroupDao
.
queryApiGroupList
(
map
);
outputObject
.
setBeans
(
beans
);
outputObject
.
settotal
(
pages
.
getTotal
());
}
/**
* @param inputObject
* @param outputObject
* @return void 返回类型
* @throws Exception 参数
* @throws
* @Title: insertApiGroupMation
* @Description: 新增api接口分组
*/
@Override
@Transactional
(
value
=
"transactionManager"
)
public
void
insertApiGroupMation
(
InputObject
inputObject
,
OutputObject
outputObject
)
throws
Exception
{
Map
<
String
,
Object
>
map
=
inputObject
.
getParams
();
Map
<
String
,
Object
>
bean
=
apiGroupDao
.
queryApiGroupByName
(
map
);
if
(
bean
!=
null
&&
!
bean
.
isEmpty
())
{
outputObject
.
setreturnMessage
(
"该分组名称已存在,请更换"
);
}
else
{
this
.
insertApiGroupMationList
(
Arrays
.
asList
(
map
),
inputObject
.
getLogParams
().
get
(
"id"
).
toString
());
}
}
@Override
@Transactional
(
value
=
"transactionManager"
)
public
void
insertApiGroupMationList
(
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
());
});
apiGroupDao
.
insertApiGroup
(
beans
);
}
/**
* @param inputObject
* @param outputObject
* @return void 返回类型
* @throws Exception 参数
* @throws
* @Title: deleteApiGroupMationById
* @Description: 删除api接口分组信息
*/
@Override
@Transactional
(
value
=
"transactionManager"
)
public
void
deleteApiGroupMationById
(
InputObject
inputObject
,
OutputObject
outputObject
)
throws
Exception
{
Map
<
String
,
Object
>
map
=
inputObject
.
getParams
();
apiPropertyDao
.
deleteApiPropertyByGroupId
(
map
);
apiMationDao
.
deleteApiMationByGroupId
(
map
);
apiGroupDao
.
deleteApiGroupById
(
map
);
}
/**
* @param inputObject
* @param outputObject
* @return void 返回类型
* @throws Exception 参数
* @throws
* @Title: selectApiGroupMationById
* @Description: 通过id查找对应的api接口分组信息
*/
@Override
public
void
selectApiGroupMationById
(
InputObject
inputObject
,
OutputObject
outputObject
)
throws
Exception
{
Map
<
String
,
Object
>
map
=
inputObject
.
getParams
();
Map
<
String
,
Object
>
bean
=
apiGroupDao
.
queryApiGroupToEditById
(
map
);
outputObject
.
setBean
(
bean
);
outputObject
.
settotal
(
1
);
}
/**
* @param inputObject
* @param outputObject
* @return void 返回类型
* @throws Exception 参数
* @throws
* @Title: editApiGroupMationById
* @Description: 通过id编辑对应的api接口分组信息
*/
@Override
@Transactional
(
value
=
"transactionManager"
)
public
void
editApiGroupMationById
(
InputObject
inputObject
,
OutputObject
outputObject
)
throws
Exception
{
Map
<
String
,
Object
>
map
=
inputObject
.
getParams
();
Map
<
String
,
Object
>
bean
=
apiGroupDao
.
queryApiGroupByName
(
map
);
if
(
bean
!=
null
&&
!
bean
.
isEmpty
())
{
outputObject
.
setreturnMessage
(
"该分组名称已存在,请更换"
);
}
else
{
map
.
put
(
"userId"
,
inputObject
.
getLogParams
().
get
(
"id"
));
map
.
put
(
"lastUpdateTime"
,
DateUtil
.
getTimeAndToString
());
apiGroupDao
.
editApiGroupById
(
map
);
}
}
}
skyeye-api/src/main/resources/mapper/api/ApiGroupMapper.xml
0 → 100644
浏览文件 @
d98a8eac
<?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.ApiGroupDao"
>
<select
id=
"queryApiGroupList"
parameterType=
"java.util.Map"
resultType=
"java.util.Map"
>
SELECT
a.id,
a.name `name`,
a.model_id modelId
FROM
api_group a
WHERE
1 = 1
<if
test=
"name != '' and name != null"
>
AND a.name LIKE '%${name}%'
</if>
<if
test=
"modelId != '' and modelId != null"
>
AND a.model_id = #{modelId}
</if>
ORDER BY a.last_update_time DESC
</select>
<select
id=
"queryApiGroupByName"
parameterType=
"java.util.Map"
resultType=
"java.util.Map"
>
SELECT
a.id
FROM
api_group a
WHERE
a.name = #{name}
AND a.model_id = #{modelId}
<if
test=
"id != '' and id != null"
>
AND a.id != #{id}
</if>
</select>
<insert
id=
"insertApiGroup"
parameterType=
"java.util.Map"
>
INSERT INTO api_group
(id, `name`, model_id, create_id, create_time, last_update_id, last_update_time)
VALUES
<foreach
collection=
"list"
item=
"item"
index=
"index"
separator=
","
>
(#{item.id}, #{item.name}, #{item.modelId}, #{item.userId}, #{item.createTime}, #{item.userId}, #{item.createTime})
</foreach>
</insert>
<select
id=
"queryApiGroupToEditById"
parameterType=
"java.util.Map"
resultType=
"java.util.Map"
>
SELECT
a.id,
a.name `name`,
a.model_id modelId
FROM
api_group a
WHERE
a.id = #{id}
</select>
<update
id=
"editApiGroupById"
parameterType=
"java.util.Map"
>
UPDATE api_group
<set>
`name` = #{name},
model_id = #{modelId}
</set>
WHERE
id = #{id}
</update>
<delete
id=
"deleteApiGroupById"
parameterType=
"java.util.Map"
>
DELETE
FROM
api_group
WHERE
id = #{id}
</delete>
<delete
id=
"deleteApiGroupByModelId"
parameterType=
"java.util.Map"
>
DELETE
FROM
api_group
WHERE
model_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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录