Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
kt-keystone
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Matrix
kt-keystone
Commits
8feb4cbb
提交
8feb4cbb
authored
3月 22, 2022
作者:
mry
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat(web): 添加了行为动作中部分缓存
上级
14a00b93
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
22 行增加
和
3 行删除
+22
-3
MoveController.java
...n/java/org/matrix/autotest/controller/MoveController.java
+18
-2
TestCaseController.java
...va/org/matrix/autotest/controller/TestCaseController.java
+4
-1
没有找到文件。
kt-web/src/main/java/org/matrix/autotest/controller/MoveController.java
浏览文件 @
8feb4cbb
...
...
@@ -14,7 +14,9 @@ import org.matrix.database.vo.CommonResultObj;
import
org.matrix.database.vo.MoveAction
;
import
org.matrix.exception.GlobalException
;
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.transaction.annotation.Transactional
;
import
org.springframework.util.StringUtils
;
...
...
@@ -51,7 +53,9 @@ public class MoveController {
@GetMapping
@Cacheable
(
cacheNames
=
"moveNames"
,
key
=
"#p0"
,
condition
=
"#p0 != null "
,
unless
=
"#result.statusCodeValue != 200"
)
@Cacheable
(
cacheNames
=
"moveNames"
,
key
=
"#p0"
,
condition
=
"#p0 != null "
,
unless
=
"#result.statusCodeValue != 200"
)
public
ResponseEntity
<
CommonResultObj
<
String
>>
findNameById
(
@RequestParam
Integer
moveId
)
{
String
name
=
ofNullable
(
moveService
.
getById
(
moveId
))
.
orElseThrow
(()
->
new
GlobalException
(
String
.
format
(
"没有找到id = %d 的move对象名称"
,
moveId
)))
...
...
@@ -70,10 +74,14 @@ public class MoveController {
*/
@ApiOperation
(
value
=
"分页查询行为"
)
@GetMapping
(
"/{projectId}"
)
@Cacheable
(
cacheNames
=
"movePageName"
,
key
=
"#pageNum + '_' + #pageSize + #projectId"
,
condition
=
"#pageNum != null && #pageSize != null"
,
unless
=
"#result.statusCodeValue != 200"
)
public
ResponseEntity
<
CommonResultObj
<
Page
<
Move
>>>
findPageConnects
(
@RequestParam
(
defaultValue
=
"10"
)
int
pageSize
,
@RequestParam
(
defaultValue
=
"1"
)
int
pageNum
,
@RequestParam
(
required
=
false
,
defaultValue
=
""
)
String
name
,
@RequestParam
(
required
=
false
,
defaultValue
=
""
)
String
name
,
@PathVariable
Long
projectId
)
{
Page
<
Move
>
results
=
Optional
.
ofNullable
(
moveService
.
page
(
Page
.
of
(
pageNum
,
pageSize
)
,
Wrappers
.
lambdaQuery
(
Move
.
class
).
eq
(
Move:
:
getProjectId
,
projectId
)
...
...
@@ -91,6 +99,10 @@ public class MoveController {
*/
@ApiOperation
(
value
=
"根据行为id查,行为以及,行为下的动作"
)
@GetMapping
(
"/move/{moveId}"
)
@Cacheable
(
cacheNames
=
"moveName"
,
key
=
"#moveId"
,
condition
=
"#p0 != null"
,
unless
=
"#result.statusCodeValue != 200"
)
public
ResponseEntity
<
CommonResultObj
<
MoveAction
>>
findByIdMoveAction
(
@PathVariable
Long
moveId
)
{
Move
byId
=
moveService
.
getById
(
moveId
);
if
(
byId
==
null
)
{
...
...
@@ -113,6 +125,10 @@ public class MoveController {
*/
@ApiOperation
(
value
=
"添加行为和动作"
)
@PostMapping
@Caching
(
put
=
{
@CachePut
(
cacheNames
=
"moveName"
,
key
=
"result.body.data.move.id"
,
condition
=
"#p0 != null"
,
unless
=
"#result.statusCodeValue != 200"
)}
)
public
ResponseEntity
<
CommonResultObj
<
MoveAction
>>
insertMoveAction
(
@RequestBody
MoveAction
moveAction
)
{
Boolean
moveBoolean
=
Optional
.
of
(
moveService
.
save
(
moveAction
.
getMove
()))
.
orElseThrow
(
GlobalException:
:
new
);
...
...
kt-web/src/main/java/org/matrix/autotest/controller/TestCaseController.java
浏览文件 @
8feb4cbb
...
...
@@ -90,7 +90,10 @@ public class TestCaseController {
*/
@GetMapping
(
"/testCase/{testCaseId}"
)
@ApiOperation
(
value
=
"根据用例id查,用例以及,用例下的数据组"
)
@Cacheable
(
cacheNames
=
"caseCache"
,
key
=
"#testCaseId"
,
condition
=
"#p0 !=null"
,
unless
=
"#result.statusCodeValue != 200"
)
@Cacheable
(
cacheNames
=
"caseCache"
,
key
=
"#testCaseId"
,
condition
=
"#p0 !=null"
,
unless
=
"#result.statusCodeValue != 200"
)
public
ResponseEntity
<
CommonResultObj
<
TestCaseData
>>
findByIdTestCaseData
(
@PathVariable
Long
testCaseId
)
{
TestCase
byId
=
testCaseService
.
getById
(
testCaseId
);
if
(
byId
==
null
)
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论