Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
kt-keystone
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Matrix
kt-keystone
Commits
2766b230
提交
2766b230
authored
1月 21, 2022
作者:
mry
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
perf(web): action中加入了envId字段,完善了Controller,service,修改了配置文件
上级
6befc180
显示空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
220 行增加
和
13 行删除
+220
-13
Action.java
kt-base/src/main/java/org/matrix/database/entity/Action.java
+2
-0
IEnvironmentService.java
...java/org/matrix/database/service/IEnvironmentService.java
+43
-0
EnvironmentServiceImpl.java
.../matrix/database/service/impl/EnvironmentServiceImpl.java
+50
-1
EnvironmentController.java
...org/matrix/autotest/controller/EnvironmentController.java
+106
-3
TestCaseController.java
...va/org/matrix/autotest/controller/TestCaseController.java
+0
-1
application.properties
kt-web/src/main/resources/application.properties
+0
-8
application.yml
kt-web/src/main/resources/application.yml
+19
-0
没有找到文件。
kt-base/src/main/java/org/matrix/database/entity/Action.java
浏览文件 @
2766b230
...
...
@@ -40,5 +40,7 @@ public class Action extends BaseEntity {
@ApiModelProperty
(
"详细参数"
)
private
String
detail
;
@ApiModelProperty
(
"环境参数id"
)
private
Long
envId
;
}
kt-base/src/main/java/org/matrix/database/service/IEnvironmentService.java
浏览文件 @
2766b230
...
...
@@ -2,6 +2,9 @@ package org.matrix.database.service;
import
org.matrix.database.entity.Environment
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
org.matrix.database.vo.PageResult
;
import
java.util.List
;
/**
* <p>
...
...
@@ -13,4 +16,44 @@ import com.baomidou.mybatisplus.extension.service.IService;
*/
public
interface
IEnvironmentService
extends
IService
<
Environment
>
{
/**
* 添加实例
*
* @param environment 实例
* @return 影响行数
*/
int
insertEnvironment
(
Environment
environment
);
/**
* 修改实例
*
* @param environment 实例
* @return 影响行数
*/
int
updateEnvironment
(
Environment
environment
);
/**
* 删除实例
*
* @param id 实例
* @return 影响行数
*/
int
deleteEnvironment
(
Integer
id
);
/**
* 根据项目id查询动作
*
* @param projectId 项目id
* @return 符合项目id的动作
*/
List
<
Environment
>
findByProjectIdEnvironment
(
Integer
projectId
);
/**
* 分页查询
*
* @param pageResult 封装的分页
* @return 分页后的数据
*/
PageResult
pageAll
(
PageResult
pageResult
);
}
kt-base/src/main/java/org/matrix/database/service/impl/EnvironmentServiceImpl.java
浏览文件 @
2766b230
package
org
.
matrix
.
database
.
service
.
impl
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
org.matrix.database.entity.Environment
;
import
org.matrix.database.mapper.EnvironmentMapper
;
import
org.matrix.database.service.IEnvironmentService
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
org.matrix.database.vo.PageResult
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.StringUtils
;
import
java.util.List
;
/**
* <p>
...
...
@@ -17,4 +24,46 @@ import org.springframework.stereotype.Service;
@Service
public
class
EnvironmentServiceImpl
extends
ServiceImpl
<
EnvironmentMapper
,
Environment
>
implements
IEnvironmentService
{
private
final
EnvironmentMapper
environmentMapper
;
public
EnvironmentServiceImpl
(
EnvironmentMapper
environmentMapper
)
{
this
.
environmentMapper
=
environmentMapper
;
}
@Override
public
int
insertEnvironment
(
Environment
environment
)
{
return
environmentMapper
.
insert
(
environment
);
}
@Override
public
int
updateEnvironment
(
Environment
environment
)
{
return
environmentMapper
.
updateById
(
environment
);
}
@Override
public
int
deleteEnvironment
(
Integer
id
)
{
return
environmentMapper
.
deleteById
(
id
);
}
@Override
public
List
<
Environment
>
findByProjectIdEnvironment
(
Integer
projectId
)
{
QueryWrapper
<
Environment
>
queryWrapper
=
new
QueryWrapper
<>();
queryWrapper
.
eq
(
"project_id"
,
projectId
);
return
environmentMapper
.
selectList
(
queryWrapper
);
}
@Override
public
PageResult
pageAll
(
PageResult
pageResult
)
{
IPage
ipage
=
new
Page
(
pageResult
.
getPageNum
(),
pageResult
.
getPageSize
());
QueryWrapper
queryWrapper
=
new
QueryWrapper
();
boolean
flage
=
StringUtils
.
hasLength
(
pageResult
.
getQuery
());
queryWrapper
.
like
(
flage
,
"name"
,
pageResult
.
getQuery
());
//执行分页查询,返回值依然是分页的对象
ipage
=
environmentMapper
.
selectPage
(
ipage
,
queryWrapper
);
long
total
=
ipage
.
getTotal
();
List
<
Environment
>
rows
=
ipage
.
getRecords
();
//回传5个参数 total/分页后的数据
return
pageResult
.
setTotal
(
total
).
setRows
(
rows
);
}
}
kt-web/src/main/java/org/matrix/autotest/controller/EnvironmentController.java
浏览文件 @
2766b230
package
org
.
matrix
.
autotest
.
controller
;
import
io.swagger.annotations.Api
;
import
org.springframework.web.bind.annotation.CrossOrigin
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
io.swagger.annotations.ApiOperation
;
import
org.matrix.database.entity.Environment
;
import
org.matrix.database.service.IEnvironmentService
;
import
org.matrix.database.vo.CommonResult
;
import
org.matrix.database.vo.CommonResultObj
;
import
org.matrix.database.vo.PageResult
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.List
;
/**
* <p>
...
...
@@ -19,5 +26,101 @@ import org.springframework.web.bind.annotation.RestController;
@Api
(
tags
=
"对环境environment的基本操作"
)
public
class
EnvironmentController
{
private
final
IEnvironmentService
environmentService
;
public
EnvironmentController
(
IEnvironmentService
environmentService
)
{
this
.
environmentService
=
environmentService
;
}
@ApiOperation
(
value
=
"分页查询环境"
)
@GetMapping
(
"/page"
)
public
ResponseEntity
<
CommonResultObj
<
PageResult
>>
findAllPage
(
PageResult
pageResult
)
{
pageResult
=
environmentService
.
pageAll
(
pageResult
);
if
(
pageResult
.
getRows
()
!=
null
)
{
return
CommonResult
.
success
(
pageResult
,
"查询成功"
);
}
else
{
return
CommonResult
.
failed
(
"查询失败或无数据"
);
}
}
@ApiOperation
(
value
=
"查询所有环境"
)
@GetMapping
public
ResponseEntity
<
CommonResultObj
<
List
<
Environment
>>>
findAll
()
{
List
<
Environment
>
list
=
environmentService
.
list
();
if
(
list
!=
null
&&
list
.
size
()
!=
0
)
{
return
CommonResult
.
success
(
list
,
"查询成功"
);
}
else
{
return
CommonResult
.
failed
(
"查询失败或无数据"
);
}
}
/**
* 添加实例
*
* @param environment 实例
* @return 添加的实例
*/
@ApiOperation
(
value
=
"添加实例"
)
@PostMapping
public
ResponseEntity
<
CommonResultObj
<
Environment
>>
insertEnvironment
(
@RequestBody
Environment
environment
)
{
int
i
=
environmentService
.
insertEnvironment
(
environment
);
if
(
i
!=
0
)
{
return
CommonResult
.
success
(
environment
,
"添加成功"
);
}
else
{
return
CommonResult
.
failed
(
"添加失败"
);
}
}
/**
* 修改实例
*
* @param environment 实例
* @return 修改后的实例
*/
@ApiOperation
(
value
=
"修改实例"
)
@PutMapping
public
ResponseEntity
<
CommonResultObj
<
Environment
>>
updateEnvironment
(
@RequestBody
Environment
environment
)
{
int
i
=
environmentService
.
updateEnvironment
(
environment
);
if
(
i
!=
0
)
{
return
CommonResult
.
success
(
environment
,
"修改成功"
);
}
else
{
return
CommonResult
.
failed
(
"修改失败"
);
}
}
/**
* 删除实例
*
* @param id 实例id
* @return 是否删除成功
*/
@ApiOperation
(
value
=
"根据id删除实例"
)
@DeleteMapping
(
"/{id}"
)
public
ResponseEntity
<
CommonResultObj
<
String
>>
deleteEnvironment
(
@PathVariable
Integer
id
)
{
int
i
=
environmentService
.
deleteEnvironment
(
id
);
if
(
i
!=
0
)
{
return
CommonResult
.
success
(
"id: "
+
id
+
"已删除"
,
"删除成功"
);
}
else
{
return
CommonResult
.
failed
(
"删除失败,或不存在需要删除的数据"
);
}
}
/**
* 根据项目id查询动作
*
* @param projectId 项目id
* @return 符合项目id的动作
*/
@ApiOperation
(
value
=
"根据项目id查询所有"
)
@GetMapping
(
"/project/{projectId}"
)
public
ResponseEntity
<
CommonResultObj
<
List
<
Environment
>>>
findByProjectIdEnvironment
(
@PathVariable
Integer
projectId
)
{
List
<
Environment
>
results
=
environmentService
.
findByProjectIdEnvironment
(
projectId
);
if
(
results
!=
null
&&
results
.
size
()
!=
0
)
{
return
CommonResult
.
success
(
results
,
"查询成功"
);
}
else
{
return
CommonResult
.
failed
(
"查询失败或无数据"
);
}
}
}
kt-web/src/main/java/org/matrix/autotest/controller/TestCaseController.java
浏览文件 @
2766b230
...
...
@@ -32,7 +32,6 @@ public class TestCaseController {
this
.
testCaseService
=
testCaseService
;
}
@ApiOperation
(
value
=
"分页查询用例"
)
@GetMapping
(
"/page"
)
public
ResponseEntity
<
CommonResultObj
<
PageResult
>>
findAllPage
(
PageResult
pageResult
)
{
...
...
kt-web/src/main/resources/application.properties
deleted
100644 → 0
浏览文件 @
6befc180
server.port
=
8765
spring.datasource.driver-class-name
=
com.mysql.cj.jdbc.Driver
spring.datasource.url
=
jdbc:mysql://127.0.0.1:3306/keystone?useSSL=false&verifyServerCertificate=false&useUnicode=true&autoReconnect=true&characterEncoding=utf-8&serverTimezone=GMT%2B8
spring.datasource.username
=
root
spring.datasource.password
=
root
mybatis-plus.type-aliases-package
=
org.matrix.autotest.entity
mybatis-plus.configuration.map-underscore-to-camel-case
=
true
\ No newline at end of file
kt-web/src/main/resources/application.yml
0 → 100644
浏览文件 @
2766b230
server
:
port
:
8765
spring
:
application
:
name
:
keystone
datasource
:
dynamic
:
primary
:
master
#设置默认的数据源或者数据源组,默认值即为master
strict
:
true
#严格匹配数据源,默认false. true未匹配到指定数据源时抛异常,false使用默认数据源
datasource
:
master
:
#增加默认数据源
driverClassName
:
com.mysql.cj.jdbc.Driver
url
:
jdbc:mysql://192.168.100.248:3306/key_stone?useUnicode=true&characterEncoding=utf-8&useSSL=false
username
:
root
password
:
root
mybatis-plus
:
type-enums-package
:
org.matrix.enums
\ No newline at end of file
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论