Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
kt-keystone
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Matrix
kt-keystone
Commits
a97d8e36
提交
a97d8e36
authored
4月 22, 2022
作者:
mry
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat(web): 执行器部分加入了缓存
上级
22a40208
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
51 行增加
和
10 行删除
+51
-10
TestJobController.java
...ava/org/matrix/autotest/controller/TestJobController.java
+51
-10
没有找到文件。
kt-web/src/main/java/org/matrix/autotest/controller/TestJobController.java
浏览文件 @
a97d8e36
...
...
@@ -8,6 +8,10 @@ import org.matrix.database.service.ITestJobService;
import
org.matrix.database.vo.CommonResult
;
import
org.matrix.database.vo.CommonResultObj
;
import
org.matrix.database.vo.TestJobVo
;
import
org.springframework.cache.annotation.CacheEvict
;
import
org.springframework.cache.annotation.CachePut
;
import
org.springframework.cache.annotation.Cacheable
;
import
org.springframework.cache.annotation.Caching
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.*
;
...
...
@@ -43,22 +47,46 @@ public class TestJobController {
}
/**
*
分页
查询所有测试任务信息
*
条件
查询所有测试任务信息
*
* @param pageSize 每页多少条数据
* @param pageNum 当前第几页
* @param
name 测试任务名称
* @return
分页
查询的结果,测试任务信息
* @param pageSize
每页多少条数据
* @param pageNum
当前第几页
* @param
projectId 项目id
* @return
条件
查询的结果,测试任务信息
*/
@ApiOperation
(
value
=
"
分页
查询测试任务"
)
@ApiOperation
(
value
=
"
条件
查询测试任务"
)
@GetMapping
(
"/page"
)
@Cacheable
(
cacheNames
=
"testJobPageCache"
,
key
=
"#pageSize + '_' + #pageNum + '_' + #projectId"
,
condition
=
"#pageSize != null && #pageNum != null"
,
unless
=
"#result.statusCodeValue != 200"
)
public
ResponseEntity
<
CommonResultObj
<
IPage
<
TestJobVo
>>>
findPageTestTasks
(
@RequestParam
(
defaultValue
=
"10"
)
int
pageSize
,
@RequestParam
(
defaultValue
=
"1"
)
int
pageNum
,
@RequestParam
(
required
=
true
)
Long
projectId
,
@RequestParam
(
required
=
false
,
defaultValue
=
""
)
String
name
)
{
IPage
<
TestJobVo
>
result
=
testJobService
.
pageTestJob
(
projectId
,
name
,
pageSize
,
pageNum
);
@RequestParam
Long
projectId
)
{
IPage
<
TestJobVo
>
result
=
testJobService
.
pageTestJob
(
projectId
,
""
,
pageSize
,
pageNum
);
return
CommonResult
.
success
(
result
,
"查询成功"
);
}
/**
* 条件查询所有测试任务信息
*
* @param pageSize 每页多少条数据
* @param pageNum 当前第几页
* @param projectId 项目id
* @param name 测试任务名称
* @return 条件查询的结果,测试任务信息
*/
@ApiOperation
(
value
=
"条件查询测试任务"
)
@GetMapping
(
"/condition"
)
public
ResponseEntity
<
CommonResultObj
<
IPage
<
TestJobVo
>>>
findConditionTestTasks
(
@RequestParam
(
defaultValue
=
"10"
)
int
pageSize
,
@RequestParam
(
defaultValue
=
"1"
)
int
pageNum
,
@RequestParam
Long
projectId
,
@RequestParam
(
required
=
false
,
defaultValue
=
""
)
String
name
)
{
IPage
<
TestJobVo
>
result
=
testJobService
.
pageTestJob
(
projectId
,
name
,
pageSize
,
pageNum
);
return
CommonResult
.
success
(
result
,
"查询成功"
);
}
...
...
@@ -70,6 +98,12 @@ public class TestJobController {
*/
@ApiOperation
(
value
=
"添加测试任务"
)
@PostMapping
@Caching
(
put
=
{
@CachePut
(
cacheNames
=
"testJobPageCache"
,
key
=
"#result.body.data.id"
,
condition
=
"#p0 != null"
,
unless
=
"#result.statusCodeValue != 200"
)
},
evict
=
{
@CacheEvict
(
cacheNames
=
"testJobPageCache"
,
allEntries
=
true
)}
)
public
ResponseEntity
<
CommonResultObj
<
TestJob
>>
insertTestTask
(
@RequestBody
TestJob
testJob
)
{
return
CommonResult
.
pred
(
testJobService:
:
save
,
testJob
,
"添加成功"
,
"添加失败"
);
...
...
@@ -83,6 +117,12 @@ public class TestJobController {
*/
@ApiOperation
(
value
=
"修改测试任务"
)
@PutMapping
@Caching
(
put
=
{
@CachePut
(
cacheNames
=
"testJobPageCache"
,
key
=
"#result.body.data.id"
,
condition
=
"#p0 != null"
,
unless
=
"#result.statusCodeValue != 200"
)
},
evict
=
{
@CacheEvict
(
cacheNames
=
"testJobPageCache"
,
allEntries
=
true
)}
)
public
ResponseEntity
<
CommonResultObj
<
TestJob
>>
updateTestTask
(
@RequestBody
TestJob
testJob
)
{
return
CommonResult
.
pred
(
testJobService:
:
updateById
,
testJob
,
"修改成功"
,
"修改失败"
);
...
...
@@ -96,6 +136,7 @@ public class TestJobController {
*/
@ApiOperation
(
value
=
"根据主键id删除测试任务"
)
@DeleteMapping
(
"/{id}"
)
@CacheEvict
(
cacheNames
=
"connectPageCache"
,
allEntries
=
true
,
condition
=
"#p0 != null"
)
public
ResponseEntity
<
CommonResultObj
<
Long
>>
deleteTestTask
(
@PathVariable
Long
id
)
{
return
CommonResult
.
pred
(
testJobService:
:
removeById
,
id
,
"删除成功"
,
"删除失败或id不存在"
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论