Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
kt-keystone
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Matrix
kt-keystone
Commits
05393b19
提交
05393b19
authored
1月 17, 2022
作者:
mry
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(web): 将Example修改为Environment,优化了swaggerController
上级
e8bfada3
隐藏空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
97 行增加
和
90 行删除
+97
-90
EnvironmentController.java
...org/matrix/autotest/controller/EnvironmentController.java
+20
-20
EnvironmentMapper.java
.../main/java/org/matrix/autotest/dao/EnvironmentMapper.java
+2
-2
Environment.java
...src/main/java/org/matrix/autotest/entity/Environment.java
+2
-2
EnvironmentService.java
.../java/org/matrix/autotest/service/EnvironmentService.java
+10
-10
EnvironmentServiceImpl.java
.../matrix/autotest/service/Impl/EnvironmentServiceImpl.java
+56
-0
ExampleServiceImpl.java
.../org/matrix/autotest/service/Impl/ExampleServiceImpl.java
+0
-55
SwaggerController.java
...va/org/matrix/autotest/swaggerData/SwaggerController.java
+7
-1
没有找到文件。
kt-web/src/main/java/org/matrix/autotest/controller/E
xample
Controller.java
→
kt-web/src/main/java/org/matrix/autotest/controller/E
nvironment
Controller.java
浏览文件 @
05393b19
...
@@ -2,8 +2,8 @@ package org.matrix.autotest.controller;
...
@@ -2,8 +2,8 @@ package org.matrix.autotest.controller;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
org.matrix.autotest.entity.E
xample
;
import
org.matrix.autotest.entity.E
nvironment
;
import
org.matrix.autotest.service.E
xample
Service
;
import
org.matrix.autotest.service.E
nvironment
Service
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.List
;
import
java.util.List
;
...
@@ -17,14 +17,14 @@ import java.util.List;
...
@@ -17,14 +17,14 @@ import java.util.List;
* @since 2022-01-07
* @since 2022-01-07
*/
*/
@RestController
@RestController
@RequestMapping
(
"/e
xample
s"
)
@RequestMapping
(
"/e
nvironment
s"
)
@Api
(
tags
=
"对实例表example的基本操作"
)
@Api
(
tags
=
"对实例表example的基本操作"
)
public
class
E
xample
Controller
{
public
class
E
nvironment
Controller
{
private
final
E
xampleService
example
Service
;
private
final
E
nvironmentService
environment
Service
;
public
E
xampleController
(
ExampleService
example
Service
)
{
public
E
nvironmentController
(
EnvironmentService
environment
Service
)
{
this
.
e
xampleService
=
example
Service
;
this
.
e
nvironmentService
=
environment
Service
;
}
}
/**
/**
...
@@ -34,8 +34,8 @@ public class ExampleController {
...
@@ -34,8 +34,8 @@ public class ExampleController {
*/
*/
@ApiOperation
(
value
=
"查询所有实例"
)
@ApiOperation
(
value
=
"查询所有实例"
)
@GetMapping
@GetMapping
public
List
<
E
xample
>
findAllExample
()
{
public
List
<
E
nvironment
>
findAllEnvironment
()
{
return
e
xampleService
.
findAllExample
();
return
e
nvironmentService
.
findAllEnvironment
();
}
}
/**
/**
...
@@ -46,44 +46,44 @@ public class ExampleController {
...
@@ -46,44 +46,44 @@ public class ExampleController {
*/
*/
@ApiOperation
(
value
=
"根据id查询实例"
)
@ApiOperation
(
value
=
"根据id查询实例"
)
@GetMapping
(
"/{id}"
)
@GetMapping
(
"/{id}"
)
public
E
xample
findByIdExample
(
@PathVariable
Integer
id
)
{
public
E
nvironment
findByIdEnvironment
(
@PathVariable
Integer
id
)
{
return
e
xampleService
.
findByIdExample
(
id
);
return
e
nvironmentService
.
findByIdEnvironment
(
id
);
}
}
/**
/**
* 添加实例
* 添加实例
*
*
* @param e
xample
实例
* @param e
nvironment
实例
* @return 添加的实例
* @return 添加的实例
*/
*/
@ApiOperation
(
value
=
"添加实例"
)
@ApiOperation
(
value
=
"添加实例"
)
@PostMapping
@PostMapping
public
E
xample
insertExample
(
@RequestBody
Example
example
)
{
public
E
nvironment
insertEnvironment
(
@RequestBody
Environment
environment
)
{
return
e
xampleService
.
insertExample
(
example
);
return
e
nvironmentService
.
insertEnvironment
(
environment
);
}
}
/**
/**
* 修改实例
* 修改实例
*
*
* @param e
xample
实例
* @param e
nvironment
实例
* @return 修改后的实例
* @return 修改后的实例
*/
*/
@ApiOperation
(
value
=
"根据id修改实例"
)
@ApiOperation
(
value
=
"根据id修改实例"
)
@PutMapping
(
"/{id}"
)
@PutMapping
(
"/{id}"
)
public
E
xample
updateExample
(
@RequestBody
Example
example
)
{
public
E
nvironment
updateEnvironment
(
@RequestBody
Environment
environment
)
{
return
e
xampleService
.
updateExample
(
example
);
return
e
nvironmentService
.
updateEnvironment
(
environment
);
}
}
/**
/**
* 删除实例
* 删除实例
*
*
* @param e
xample
实例
* @param e
nvironment
实例
* @return 删除的实例
* @return 删除的实例
*/
*/
@ApiOperation
(
value
=
"根据id删除实例"
)
@ApiOperation
(
value
=
"根据id删除实例"
)
@DeleteMapping
(
"/{id}"
)
@DeleteMapping
(
"/{id}"
)
public
E
xample
deleteExample
(
@RequestBody
Example
example
)
{
public
E
nvironment
deleteEnvironment
(
@RequestBody
Environment
environment
)
{
return
e
xampleService
.
deleteExample
(
example
);
return
e
nvironmentService
.
deleteEnvironment
(
environment
);
}
}
}
}
kt-web/src/main/java/org/matrix/autotest/dao/E
xample
Mapper.java
→
kt-web/src/main/java/org/matrix/autotest/dao/E
nvironment
Mapper.java
浏览文件 @
05393b19
...
@@ -2,7 +2,7 @@ package org.matrix.autotest.dao;
...
@@ -2,7 +2,7 @@ package org.matrix.autotest.dao;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.matrix.autotest.entity.E
xample
;
import
org.matrix.autotest.entity.E
nvironment
;
/**
/**
* <p>
* <p>
...
@@ -13,6 +13,6 @@ import org.matrix.autotest.entity.Example;
...
@@ -13,6 +13,6 @@ import org.matrix.autotest.entity.Example;
* @since 2022-01-07
* @since 2022-01-07
*/
*/
@Mapper
@Mapper
public
interface
E
xampleMapper
extends
BaseMapper
<
Example
>
{
public
interface
E
nvironmentMapper
extends
BaseMapper
<
Environment
>
{
}
}
kt-web/src/main/java/org/matrix/autotest/entity/E
xample
.java
→
kt-web/src/main/java/org/matrix/autotest/entity/E
nvironment
.java
浏览文件 @
05393b19
...
@@ -21,8 +21,8 @@ import java.time.LocalDateTime;
...
@@ -21,8 +21,8 @@ import java.time.LocalDateTime;
@Data
@Data
@Accessors
(
chain
=
true
)
@Accessors
(
chain
=
true
)
@ApiModel
(
value
=
"实例表"
)
@ApiModel
(
value
=
"实例表"
)
@TableName
(
value
=
"e
xample
"
)
@TableName
(
value
=
"e
nvironment
"
)
public
class
E
xample
{
public
class
E
nvironment
{
private
static
final
long
serialVersionUID
=
1L
;
private
static
final
long
serialVersionUID
=
1L
;
...
...
kt-web/src/main/java/org/matrix/autotest/service/E
xample
Service.java
→
kt-web/src/main/java/org/matrix/autotest/service/E
nvironment
Service.java
浏览文件 @
05393b19
package
org
.
matrix
.
autotest
.
service
;
package
org
.
matrix
.
autotest
.
service
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
org.matrix.autotest.entity.E
xample
;
import
org.matrix.autotest.entity.E
nvironment
;
import
java.util.List
;
import
java.util.List
;
...
@@ -13,13 +13,13 @@ import java.util.List;
...
@@ -13,13 +13,13 @@ import java.util.List;
* @author mry
* @author mry
* @since 2022-01-07
* @since 2022-01-07
*/
*/
public
interface
E
xampleService
extends
IService
<
Example
>
{
public
interface
E
nvironmentService
extends
IService
<
Environment
>
{
/**
/**
* 查询所有实例
* 查询所有实例
*
*
* @return 实例
* @return 实例
*/
*/
List
<
E
xample
>
findAllExample
();
List
<
E
nvironment
>
findAllEnvironment
();
/**
/**
* 根据id查询实例
* 根据id查询实例
...
@@ -27,29 +27,29 @@ public interface ExampleService extends IService<Example> {
...
@@ -27,29 +27,29 @@ public interface ExampleService extends IService<Example> {
* @param id 实例id
* @param id 实例id
* @return 实例
* @return 实例
*/
*/
E
xample
findByIdExample
(
Integer
id
);
E
nvironment
findByIdEnvironment
(
Integer
id
);
/**
/**
* 添加实例
* 添加实例
*
*
* @param e
xample
实例
* @param e
nvironment
实例
* @return 添加的实例
* @return 添加的实例
*/
*/
E
xample
insertExample
(
Example
example
);
E
nvironment
insertEnvironment
(
Environment
environment
);
/**
/**
* 修改实例
* 修改实例
*
*
* @param e
xample
实例
* @param e
nvironment
实例
* @return 修改后的实例
* @return 修改后的实例
*/
*/
E
xample
updateExample
(
Example
example
);
E
nvironment
updateEnvironment
(
Environment
environment
);
/**
/**
* 删除实例
* 删除实例
*
*
* @param e
xample
实例
* @param e
nvironment
实例
* @return 删除的实例
* @return 删除的实例
*/
*/
E
xample
deleteExample
(
Example
example
);
E
nvironment
deleteEnvironment
(
Environment
environment
);
}
}
kt-web/src/main/java/org/matrix/autotest/service/Impl/EnvironmentServiceImpl.java
0 → 100644
浏览文件 @
05393b19
package
org
.
matrix
.
autotest
.
service
.
Impl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
org.matrix.autotest.dao.EnvironmentMapper
;
import
org.matrix.autotest.entity.Environment
;
import
org.matrix.autotest.service.EnvironmentService
;
import
org.springframework.stereotype.Service
;
import
java.util.List
;
/**
* <p>
* 实例表,项目对应的环境实例,例如:实验室环境,开发环境等 服务实现类
* </p>
*
* @author mry
* @since 2022-01-07
*/
@Service
public
class
EnvironmentServiceImpl
extends
ServiceImpl
<
EnvironmentMapper
,
Environment
>
implements
EnvironmentService
{
private
final
EnvironmentMapper
environmentMapper
;
public
EnvironmentServiceImpl
(
EnvironmentMapper
environmentMapper
)
{
this
.
environmentMapper
=
environmentMapper
;
}
@Override
public
List
<
Environment
>
findAllEnvironment
()
{
return
environmentMapper
.
selectList
(
null
);
}
@Override
public
Environment
findByIdEnvironment
(
Integer
id
)
{
return
environmentMapper
.
selectById
(
id
);
}
@Override
public
Environment
insertEnvironment
(
Environment
environment
)
{
environmentMapper
.
insert
(
environment
);
return
environment
;
}
@Override
public
Environment
updateEnvironment
(
Environment
environment
)
{
environmentMapper
.
updateById
(
environment
);
return
environment
;
}
@Override
public
Environment
deleteEnvironment
(
Environment
environment
)
{
environmentMapper
.
deleteById
(
environment
.
getId
());
return
environment
;
}
}
kt-web/src/main/java/org/matrix/autotest/service/Impl/ExampleServiceImpl.java
deleted
100644 → 0
浏览文件 @
e8bfada3
package
org
.
matrix
.
autotest
.
service
.
Impl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
org.matrix.autotest.dao.ExampleMapper
;
import
org.matrix.autotest.entity.Example
;
import
org.matrix.autotest.service.ExampleService
;
import
org.springframework.stereotype.Service
;
import
java.util.List
;
/**
* <p>
* 实例表,项目对应的环境实例,例如:实验室环境,开发环境等 服务实现类
* </p>
*
* @author mry
* @since 2022-01-07
*/
@Service
public
class
ExampleServiceImpl
extends
ServiceImpl
<
ExampleMapper
,
Example
>
implements
ExampleService
{
private
final
ExampleMapper
exampleMapper
;
public
ExampleServiceImpl
(
ExampleMapper
exampleMapper
)
{
this
.
exampleMapper
=
exampleMapper
;
}
@Override
public
List
<
Example
>
findAllExample
()
{
return
exampleMapper
.
selectList
(
null
);
}
@Override
public
Example
findByIdExample
(
Integer
id
)
{
return
exampleMapper
.
selectById
(
id
);
}
@Override
public
Example
insertExample
(
Example
example
)
{
exampleMapper
.
insert
(
example
);
return
example
;
}
@Override
public
Example
updateExample
(
Example
example
)
{
exampleMapper
.
updateById
(
example
);
return
example
;
}
@Override
public
Example
deleteExample
(
Example
example
)
{
exampleMapper
.
deleteById
(
example
.
getId
());
return
example
;
}
}
kt-web/src/main/java/org/matrix/autotest/
S
waggerData/SwaggerController.java
→
kt-web/src/main/java/org/matrix/autotest/
s
waggerData/SwaggerController.java
浏览文件 @
05393b19
package
org
.
matrix
.
autotest
.
S
waggerData
;
package
org
.
matrix
.
autotest
.
s
waggerData
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
...
@@ -48,6 +48,7 @@ public class SwaggerController {
...
@@ -48,6 +48,7 @@ public class SwaggerController {
@GetMapping
@GetMapping
public
Object
parameter
(
String
url
)
{
public
Object
parameter
(
String
url
)
{
@SuppressWarnings
(
"all"
)
List
<
String
>
list
=
new
ArrayList
();
List
<
String
>
list
=
new
ArrayList
();
//获得json字符串
//获得json字符串
String
json
=
loadJson
(
url
);
String
json
=
loadJson
(
url
);
...
@@ -58,6 +59,7 @@ public class SwaggerController {
...
@@ -58,6 +59,7 @@ public class SwaggerController {
Object
basePath
=
swaggerJson
.
get
(
"basePath"
);
Object
basePath
=
swaggerJson
.
get
(
"basePath"
);
Object
paths
=
swaggerJson
.
get
(
"paths"
);
Object
paths
=
swaggerJson
.
get
(
"paths"
);
//将paths转成map集合
//将paths转成map集合
@SuppressWarnings
(
"unchecked"
)
Map
<
String
,
String
>
pathsMaps
=
(
Map
<
String
,
String
>)
paths
;
Map
<
String
,
String
>
pathsMaps
=
(
Map
<
String
,
String
>)
paths
;
//获取key
//获取key
Set
<
String
>
methodUrls
=
pathsMaps
.
keySet
();
Set
<
String
>
methodUrls
=
pathsMaps
.
keySet
();
...
@@ -68,17 +70,21 @@ public class SwaggerController {
...
@@ -68,17 +70,21 @@ public class SwaggerController {
//通过JSON获取到methodUrl,用来获取methodUrl内部的信息
//通过JSON获取到methodUrl,用来获取methodUrl内部的信息
Object
objMethodUrls
=
objPaths
.
get
(
methodUrl
);
Object
objMethodUrls
=
objPaths
.
get
(
methodUrl
);
JSONObject
objUrlsJson
=
(
JSONObject
)
objMethodUrls
;
JSONObject
objUrlsJson
=
(
JSONObject
)
objMethodUrls
;
@SuppressWarnings
(
"unchecked"
)
Map
<
String
,
String
>
objMethodUrlsMaps
=
(
Map
<
String
,
String
>)
objMethodUrls
;
Map
<
String
,
String
>
objMethodUrlsMaps
=
(
Map
<
String
,
String
>)
objMethodUrls
;
Set
<
String
>
requests
=
objMethodUrlsMaps
.
keySet
();
Set
<
String
>
requests
=
objMethodUrlsMaps
.
keySet
();
for
(
String
request
:
requests
)
{
for
(
String
request
:
requests
)
{
//拿到请求内部的信息
//拿到请求内部的信息
Object
objRequest
=
objUrlsJson
.
get
(
request
);
Object
objRequest
=
objUrlsJson
.
get
(
request
);
@SuppressWarnings
(
"unchecked"
)
Map
<
String
,
String
>
objRequestMaps
=
(
Map
<
String
,
String
>)
objRequest
;
Map
<
String
,
String
>
objRequestMaps
=
(
Map
<
String
,
String
>)
objRequest
;
Object
parameters
=
objRequestMaps
.
get
(
"parameters"
);
Object
parameters
=
objRequestMaps
.
get
(
"parameters"
);
List
<
String
>
parameterAllList
=
new
ArrayList
<>();
List
<
String
>
parameterAllList
=
new
ArrayList
<>();
if
(
parameters
!=
null
)
{
if
(
parameters
!=
null
)
{
@SuppressWarnings
(
"all"
)
List
<
String
>
parameterLists
=
(
List
<
String
>)
parameters
;
List
<
String
>
parameterLists
=
(
List
<
String
>)
parameters
;
for
(
Object
parameterList
:
parameterLists
)
{
for
(
Object
parameterList
:
parameterLists
)
{
@SuppressWarnings
(
"unchecked"
)
Map
<
String
,
String
>
parameterMaps
=
(
Map
<
String
,
String
>)
parameterList
;
Map
<
String
,
String
>
parameterMaps
=
(
Map
<
String
,
String
>)
parameterList
;
String
name
=
parameterMaps
.
get
(
"name"
);
String
name
=
parameterMaps
.
get
(
"name"
);
String
type
=
parameterMaps
.
get
(
"type"
);
String
type
=
parameterMaps
.
get
(
"type"
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论