Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
kt-keystone
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Matrix
kt-keystone
Commits
486f7088
提交
486f7088
authored
2月 10, 2022
作者:
mry
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(service与controller): 优化了CRUD代码
上级
90b52f7c
隐藏空白字符变更
内嵌
并排
正在显示
18 个修改的文件
包含
177 行增加
和
595 行删除
+177
-595
IConnectService.java
...ain/java/org/matrix/database/service/IConnectService.java
+0
-32
IDynamicVariableService.java
.../org/matrix/database/service/IDynamicVariableService.java
+0
-40
IEnvironmentService.java
...java/org/matrix/database/service/IEnvironmentService.java
+0
-40
IMoveService.java
...c/main/java/org/matrix/database/service/IMoveService.java
+0
-8
ITestCaseService.java
...in/java/org/matrix/database/service/ITestCaseService.java
+0
-40
ConnectServiceImpl.java
.../org/matrix/database/service/impl/ConnectServiceImpl.java
+0
-35
DynamicVariableServiceImpl.java
...rix/database/service/impl/DynamicVariableServiceImpl.java
+0
-36
EnvironmentServiceImpl.java
.../matrix/database/service/impl/EnvironmentServiceImpl.java
+0
-42
MoveServiceImpl.java
...ava/org/matrix/database/service/impl/MoveServiceImpl.java
+0
-20
TestCaseServiceImpl.java
...org/matrix/database/service/impl/TestCaseServiceImpl.java
+0
-42
TestConfig.java
kt-base/src/main/java/org/matrix/testNg/TestConfig.java
+0
-13
TestPigeon.java
kt-base/src/main/java/org/matrix/testNg/TestPigeon.java
+2
-1
ConnectController.java
...ava/org/matrix/autotest/controller/ConnectController.java
+12
-23
DynamicVariableController.java
...matrix/autotest/controller/DynamicVariableController.java
+33
-57
EnvironmentController.java
...org/matrix/autotest/controller/EnvironmentController.java
+41
-60
MoveController.java
...n/java/org/matrix/autotest/controller/MoveController.java
+47
-46
ProjectController.java
...ava/org/matrix/autotest/controller/ProjectController.java
+8
-8
TestCaseController.java
...va/org/matrix/autotest/controller/TestCaseController.java
+34
-52
没有找到文件。
kt-base/src/main/java/org/matrix/database/service/IConnectService.java
浏览文件 @
486f7088
...
...
@@ -14,36 +14,4 @@ import org.matrix.database.vo.PageResult;
*/
public
interface
IConnectService
extends
IService
<
Connect
>
{
/**
* 添加连接池
*
* @param connect 连接池
* @return 影响行数
*/
int
insertConnect
(
Connect
connect
);
/**
* 修改连接池
*
* @param connect 连接池
* @return 影响行数
*/
int
updateConnect
(
Connect
connect
);
/**
* 删除连接池
*
* @param id 连接池id
* @return 影响行数
*/
int
deleteConnect
(
Integer
id
);
/**
* 分页查询
*
* @param pageResult 封装的分页
* @return 分页后的数据
*/
PageResult
pageAll
(
PageResult
pageResult
);
}
kt-base/src/main/java/org/matrix/database/service/IDynamicVariableService.java
浏览文件 @
486f7088
...
...
@@ -26,44 +26,4 @@ public interface IDynamicVariableService extends IService<DynamicVariable> {
*/
Optional
<
DynamicVariable
>
getByName
(
String
name
,
Long
projectId
);
/**
* 添加动态变量
*
* @param dynamicVariable 动态变量
* @return 影响行数
*/
int
insertDynamicVariable
(
DynamicVariable
dynamicVariable
);
/**
* 修改动态变量
*
* @param dynamicVariable 动态变量
* @return 影响行数
*/
int
updateDynamicVariable
(
DynamicVariable
dynamicVariable
);
/**
* 删除动态变量
*
* @param id 动态变量
* @return 影响行数
*/
int
deleteDynamicVariable
(
Integer
id
);
/**
* 根据项目id查询动作
*
* @param projectId 项目id
* @return 符合项目id的动作
*/
List
<
DynamicVariable
>
findByProjectIdDynamicVariable
(
Integer
projectId
);
/**
* 分页查询
*
* @param pageResult 封装的分页
* @return 分页后的数据
*/
PageResult
pageAll
(
PageResult
pageResult
);
}
kt-base/src/main/java/org/matrix/database/service/IEnvironmentService.java
浏览文件 @
486f7088
...
...
@@ -16,44 +16,4 @@ import java.util.List;
*/
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/IMoveService.java
浏览文件 @
486f7088
...
...
@@ -14,12 +14,4 @@ import org.matrix.database.vo.PageResult;
*/
public
interface
IMoveService
extends
IService
<
Move
>
{
/**
* 分页查询
*
* @param pageResult 封装的分页
* @return 分页后的数据
*/
PageResult
pageAll
(
PageResult
pageResult
);
}
kt-base/src/main/java/org/matrix/database/service/ITestCaseService.java
浏览文件 @
486f7088
...
...
@@ -16,44 +16,4 @@ import java.util.List;
*/
public
interface
ITestCaseService
extends
IService
<
TestCase
>
{
/**
* 添加用例
*
* @param testCase 用例
* @return 影响行数
*/
int
insertTestCase
(
TestCase
testCase
);
/**
* 修改用例
*
* @param testCase 用例
* @return 影响行数
*/
int
updateTestCase
(
TestCase
testCase
);
/**
* 删除用例
*
* @param id 用例
* @return 影响行数
*/
int
deleteTestCase
(
Integer
id
);
/**
* 根据项目id查询动作
*
* @param projectId 项目id
* @return 符合项目id的动作
*/
List
<
TestCase
>
findByProjectIdTestCase
(
Integer
projectId
);
/**
* 分页查询
*
* @param pageResult 封装的分页
* @return 分页后的数据
*/
PageResult
pageAll
(
PageResult
pageResult
);
}
kt-base/src/main/java/org/matrix/database/service/impl/ConnectServiceImpl.java
浏览文件 @
486f7088
...
...
@@ -24,39 +24,4 @@ import java.util.List;
@Service
public
class
ConnectServiceImpl
extends
ServiceImpl
<
ConnectMapper
,
Connect
>
implements
IConnectService
{
private
final
ConnectMapper
connectMapper
;
public
ConnectServiceImpl
(
ConnectMapper
connectMapper
)
{
this
.
connectMapper
=
connectMapper
;
}
@Override
public
int
insertConnect
(
Connect
connect
)
{
return
connectMapper
.
insert
(
connect
);
}
@Override
public
int
updateConnect
(
Connect
connect
)
{
return
connectMapper
.
updateById
(
connect
);
}
@Override
public
int
deleteConnect
(
Integer
id
)
{
return
connectMapper
.
deleteById
(
id
);
}
@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
=
connectMapper
.
selectPage
(
ipage
,
queryWrapper
);
long
total
=
ipage
.
getTotal
();
List
<
Connect
>
rows
=
ipage
.
getRecords
();
//回传5个参数 total/分页后的数据
return
pageResult
.
setTotal
(
total
).
setRows
(
rows
);
}
}
kt-base/src/main/java/org/matrix/database/service/impl/DynamicVariableServiceImpl.java
浏览文件 @
486f7088
...
...
@@ -46,40 +46,4 @@ public class DynamicVariableServiceImpl extends ServiceImpl<DynamicVariableMappe
.
eq
(
DynamicVariable:
:
getProjectId
,
projectId
)));
}
@Override
public
int
insertDynamicVariable
(
DynamicVariable
dynamicVariable
)
{
return
mapper
.
insert
(
dynamicVariable
);
}
@Override
public
int
updateDynamicVariable
(
DynamicVariable
dynamicVariable
)
{
return
mapper
.
updateById
(
dynamicVariable
);
}
@Override
public
int
deleteDynamicVariable
(
Integer
id
)
{
return
mapper
.
deleteById
(
id
);
}
@Override
public
List
<
DynamicVariable
>
findByProjectIdDynamicVariable
(
Integer
projectId
)
{
QueryWrapper
<
DynamicVariable
>
queryWrapper
=
new
QueryWrapper
<>();
queryWrapper
.
eq
(
"project_id"
,
projectId
);
return
mapper
.
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
=
mapper
.
selectPage
(
ipage
,
queryWrapper
);
long
total
=
ipage
.
getTotal
();
List
<
DynamicVariable
>
rows
=
ipage
.
getRecords
();
//回传5个参数 total/分页后的数据
return
pageResult
.
setTotal
(
total
).
setRows
(
rows
);
}
}
kt-base/src/main/java/org/matrix/database/service/impl/EnvironmentServiceImpl.java
浏览文件 @
486f7088
...
...
@@ -24,46 +24,4 @@ import java.util.List;
@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-base/src/main/java/org/matrix/database/service/impl/MoveServiceImpl.java
浏览文件 @
486f7088
...
...
@@ -24,24 +24,4 @@ import java.util.List;
@Service
public
class
MoveServiceImpl
extends
ServiceImpl
<
MoveMapper
,
Move
>
implements
IMoveService
{
private
final
MoveMapper
moveMapper
;
public
MoveServiceImpl
(
MoveMapper
moveMapper
)
{
this
.
moveMapper
=
moveMapper
;
}
@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
=
moveMapper
.
selectPage
(
ipage
,
queryWrapper
);
long
total
=
ipage
.
getTotal
();
List
<
Move
>
rows
=
ipage
.
getRecords
();
//回传5个参数 total/分页后的数据
return
pageResult
.
setTotal
(
total
).
setRows
(
rows
);
}
}
kt-base/src/main/java/org/matrix/database/service/impl/TestCaseServiceImpl.java
浏览文件 @
486f7088
...
...
@@ -24,46 +24,4 @@ import java.util.List;
@Service
public
class
TestCaseServiceImpl
extends
ServiceImpl
<
TestCaseMapper
,
TestCase
>
implements
ITestCaseService
{
private
final
TestCaseMapper
testCaseMapper
;
public
TestCaseServiceImpl
(
TestCaseMapper
testCaseMapper
)
{
this
.
testCaseMapper
=
testCaseMapper
;
}
@Override
public
int
insertTestCase
(
TestCase
testCase
)
{
return
testCaseMapper
.
insert
(
testCase
);
}
@Override
public
int
updateTestCase
(
TestCase
testCase
)
{
return
testCaseMapper
.
updateById
(
testCase
);
}
@Override
public
int
deleteTestCase
(
Integer
id
)
{
return
testCaseMapper
.
deleteById
(
id
);
}
@Override
public
List
<
TestCase
>
findByProjectIdTestCase
(
Integer
projectId
)
{
QueryWrapper
<
TestCase
>
queryWrapper
=
new
QueryWrapper
<>();
queryWrapper
.
eq
(
"project_id"
,
projectId
);
return
testCaseMapper
.
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
=
testCaseMapper
.
selectPage
(
ipage
,
queryWrapper
);
long
total
=
ipage
.
getTotal
();
List
<
TestCase
>
rows
=
ipage
.
getRecords
();
//回传5个参数 total/分页后的数据
return
pageResult
.
setTotal
(
total
).
setRows
(
rows
);
}
}
kt-base/src/main/java/org/matrix/testNg/TestConfig.java
deleted
100644 → 0
浏览文件 @
90b52f7c
package
org
.
matrix
.
testNg
;
/**
* @author mry
*/
public
class
TestConfig
{
public
static
final
String
DB_IP
=
"192.168.100.248"
;
public
static
final
String
DB_PORT
=
"3306"
;
public
static
final
String
DB_BASE_NAME
=
"key_stone"
;
public
static
final
String
DB_USERNAME
=
"root"
;
public
static
final
String
DB_PASSWORD
=
"root"
;
}
kt-base/src/main/java/org/matrix/testNg/TestPigeon.java
浏览文件 @
486f7088
package
org
.
matrix
.
testNg
;
import
org.matrix.BaseBootApplication
;
import
org.matrix.actuators.checkpoint.CheckPointActuator
;
import
org.matrix.actuators.checkpoint.CheckPointResult
;
import
org.matrix.actuators.httpclient.HttpClientActuator
;
...
...
@@ -24,7 +25,7 @@ import java.util.Map;
* @author mry
*/
@Component
@SpringBootTest
@SpringBootTest
(
classes
=
BaseBootApplication
.
class
)
public
class
TestPigeon
extends
AbstractTestNGSpringContextTests
{
String
sql
;
...
...
kt-web/src/main/java/org/matrix/autotest/controller/ConnectController.java
浏览文件 @
486f7088
...
...
@@ -6,6 +6,7 @@ import org.matrix.database.entity.Connect;
import
org.matrix.database.service.IConnectService
;
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.*
;
...
...
@@ -33,23 +34,12 @@ public class ConnectController {
this
.
connectService
=
connectService
;
}
// @ApiOperation(value = "分页查询")
// @PostMapping("/page")
// public ResponseEntity<CommonResultObj<PageResult>> findAllPage(@RequestBody PageResult pageResult) {
// pageResult = connectService.pageAll(pageResult);
// if (pageResult.getRows() != null) {
// return CommonResult.success(pageResult, "查询成功");
// } else {
// return CommonResult.failed("查询失败或无数据");
// }
// }
/**
* 查询所有数据库
*
* @return 查询到的所有数据库
* @return 查询到的所有数据库
, 以及是否查询成功的提示信息
*/
@ApiOperation
(
value
=
"查询所有"
)
@ApiOperation
(
value
=
"查询所有
数据库
"
)
@GetMapping
public
ResponseEntity
<
CommonResultObj
<
List
<
Connect
>>>
findAllConnects
()
{
List
<
Connect
>
results
=
Optional
.
ofNullable
(
connectService
.
list
()).
orElse
(
new
ArrayList
<>());
...
...
@@ -61,8 +51,8 @@ public class ConnectController {
/**
* 添加连接池
*
* @param connect 连接池
* @return 添加的连接池
* @param connect 连接池
对象
* @return 添加的连接池
, 以及是否添加成功的提示信息
*/
@ApiOperation
(
value
=
"添加连接池"
)
@PostMapping
...
...
@@ -74,8 +64,8 @@ public class ConnectController {
/**
* 修改连接池
*
* @param connect 连接池
* @return 修改后的连接池
* @param connect 连接池
对象
* @return 修改后的连接池
, 以及是否修改成功的提示信息
*/
@ApiOperation
(
value
=
"修改连接池"
)
@PutMapping
...
...
@@ -85,17 +75,16 @@ public class ConnectController {
}
/**
* 删除连接池
*
根据主键id
删除连接池
*
* @param id 连接池id
* @return
是否删除成功
* @return
删除的连接池id, 以及是否删除成功的提示信息
*/
@ApiOperation
(
value
=
"根据id删除连接池"
)
@ApiOperation
(
value
=
"根据
主键
id删除连接池"
)
@DeleteMapping
(
"/{id}"
)
public
ResponseEntity
<
CommonResultObj
<
Integer
>>
deleteConnect
(
@PathVariable
Integer
id
)
{
public
ResponseEntity
<
CommonResultObj
<
Long
>>
deleteConnect
(
@PathVariable
Long
id
)
{
return
CommonResult
.
pred
(
connectService:
:
removeById
,
id
,
"删除成功"
,
"删除失败"
);
,
"删除成功"
,
"删除失败
或id不存在
"
);
}
}
kt-web/src/main/java/org/matrix/autotest/controller/DynamicVariableController.java
浏览文件 @
486f7088
...
...
@@ -8,10 +8,10 @@ import org.matrix.database.service.IDynamicVariableService;
import
org.matrix.database.vo.CommonResult
;
import
org.matrix.database.vo.CommonResultObj
;
import
org.matrix.database.vo.PageResult
;
import
org.matrix.exception.GlobalException
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Optional
;
...
...
@@ -35,97 +35,74 @@ public class DynamicVariableController {
this
.
dynamicVariableService
=
dynamicVariableService
;
}
@ApiOperation
(
value
=
"分页查询"
)
@PostMapping
(
"/page"
)
public
ResponseEntity
<
CommonResultObj
<
PageResult
>>
findAllPage
(
@RequestBody
PageResult
pageResult
)
{
pageResult
=
dynamicVariableService
.
pageAll
(
pageResult
);
if
(
pageResult
.
getRows
()
!=
null
)
{
return
CommonResult
.
success
(
pageResult
,
"查询成功"
);
}
else
{
return
CommonResult
.
failed
(
"查询失败或无数据"
);
}
}
@ApiOperation
(
value
=
"查询所有动参"
)
/**
* 查询所有动态参数
*
* @return 查询到的所有动态参数, 以及是否查询成功的提示信息
*/
@ApiOperation
(
value
=
"查询所有动态变量"
)
@GetMapping
public
ResponseEntity
<
CommonResultObj
<
List
<
DynamicVariable
>>>
findAll
()
{
List
<
DynamicVariable
>
list
=
dynamicVariableService
.
list
();
if
(
list
!=
null
&&
list
.
size
()
!=
0
)
{
return
CommonResult
.
success
(
list
,
"查询成功"
);
}
else
{
return
CommonResult
.
failed
(
"查询失败或无数据"
);
}
public
ResponseEntity
<
CommonResultObj
<
List
<
DynamicVariable
>>>
findAllDynamicVariable
()
{
List
<
DynamicVariable
>
results
=
Optional
.
ofNullable
(
dynamicVariableService
.
list
()).
orElse
(
new
ArrayList
<>());
return
results
.
size
()
!=
0
?
CommonResult
.
success
(
results
,
"查询成功"
)
:
CommonResult
.
failed
(
results
,
"查询失败或无数据"
);
}
/**
* 添加动态变量
*
* @param dynamicVariable 动态变量
* @return 添加的动态变量
* @param dynamicVariable 动态变量
对象
* @return 添加的动态变量
, 以及是否添加成功的提示信息
*/
@ApiOperation
(
value
=
"添加动态变量"
)
@PostMapping
public
ResponseEntity
<
CommonResultObj
<
DynamicVariable
>>
insertDynamicVariable
(
@RequestBody
DynamicVariable
dynamicVariable
)
{
int
i
=
dynamicVariableService
.
insertDynamicVariable
(
dynamicVariable
);
if
(
i
!=
0
)
{
return
CommonResult
.
success
(
dynamicVariable
,
"添加成功"
);
}
else
{
return
CommonResult
.
failed
(
"添加失败"
);
}
return
CommonResult
.
pred
(
dynamicVariableService:
:
save
,
dynamicVariable
,
"添加成功"
,
"添加失败"
);
}
/**
* 修改动态变量
*
* @param dynamicVariable 动态变量
* @return 修改后的动态变量
* @param dynamicVariable 动态变量
对象
* @return 修改后的动态变量
, 以及是否修改成功的提示信息
*/
@ApiOperation
(
value
=
"修改动态变量"
)
@PutMapping
public
ResponseEntity
<
CommonResultObj
<
DynamicVariable
>>
updateDynamicVariable
(
@RequestBody
DynamicVariable
dynamicVariable
)
{
int
i
=
dynamicVariableService
.
updateDynamicVariable
(
dynamicVariable
);
if
(
i
!=
0
)
{
return
CommonResult
.
success
(
dynamicVariable
,
"修改成功"
);
}
else
{
return
CommonResult
.
failed
(
"修改失败"
);
}
return
CommonResult
.
pred
(
dynamicVariableService:
:
updateById
,
dynamicVariable
,
"修改成功"
,
"修改失败"
);
}
/**
* 删除动态变量
*
* @param id 动态变量id
* @return
是否删除成功
* @return
删除的动态变量id, 以及是否删除成功的提示信息
*/
@ApiOperation
(
value
=
"根据id删除动态变量"
)
@ApiOperation
(
value
=
"根据
主键
id删除动态变量"
)
@DeleteMapping
(
"/{id}"
)
public
ResponseEntity
<
CommonResultObj
<
String
>>
deleteDynamicVariable
(
@PathVariable
Integer
id
)
{
int
i
=
dynamicVariableService
.
deleteDynamicVariable
(
id
);
if
(
i
!=
0
)
{
return
CommonResult
.
success
(
"id: "
+
id
+
"已删除"
,
"删除成功"
);
}
else
{
return
CommonResult
.
failed
(
"删除失败,或不存在需要删除的数据"
);
}
public
ResponseEntity
<
CommonResultObj
<
Long
>>
deleteDynamicVariable
(
@PathVariable
Long
id
)
{
return
CommonResult
.
pred
(
dynamicVariableService:
:
removeById
,
id
,
"删除成功"
,
"删除失败或id不存在"
);
}
/**
* 根据项目id查询动
作
* 根据项目id查询动
态变量
*
* @param projectId 项目id
* @return 符合项目id的动
作
* @return 符合项目id的动
态变量, 以及是否查询成功的提示信息
*/
@ApiOperation
(
value
=
"根据项目id查询所有"
)
@ApiOperation
(
value
=
"根据项目id查询所有
动态变量
"
)
@GetMapping
(
"/project/{projectId}"
)
public
ResponseEntity
<
CommonResultObj
<
List
<
DynamicVariable
>>>
findByProjectIdDynamicVariable
(
@PathVariable
Long
projectId
)
{
List
<
DynamicVariable
>
results
=
Optional
.
ofNullable
(
dynamicVariableService
.
list
(
Wrappers
.
lambdaQuery
(
DynamicVariable
.
class
)
.
eq
(
DynamicVariable:
:
getProjectId
,
projectId
)))
.
orElseThrow
(()
->
new
GlobalException
(
String
.
format
(
"没有查到指定的行为,你提供的行为id是%d"
,
projectId
)));
if
(
results
!=
null
&&
results
.
size
()
!=
0
)
{
return
CommonResult
.
success
(
results
,
"查询成功"
);
}
else
{
return
CommonResult
.
failed
(
"查询失败或无数据"
);
}
.
orElse
(
new
ArrayList
<>());
return
results
.
size
()
!=
0
?
CommonResult
.
success
(
results
,
"查询成功"
)
:
CommonResult
.
failed
(
results
,
"查询失败或无数据"
);
}
}
\ No newline at end of file
}
kt-web/src/main/java/org/matrix/autotest/controller/EnvironmentController.java
浏览文件 @
486f7088
package
org
.
matrix
.
autotest
.
controller
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.matrix.database.entity.Environment
;
...
...
@@ -10,7 +11,9 @@ import org.matrix.database.vo.PageResult;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Optional
;
/**
* <p>
...
...
@@ -32,96 +35,74 @@ public class EnvironmentController {
this
.
environmentService
=
environmentService
;
}
@ApiOperation
(
value
=
"分页查询环境"
)
@PostMapping
(
"/page"
)
public
ResponseEntity
<
CommonResultObj
<
PageResult
>>
findAllPage
(
@RequestBody
PageResult
pageResult
)
{
pageResult
=
environmentService
.
pageAll
(
pageResult
);
if
(
pageResult
.
getRows
()
!=
null
)
{
return
CommonResult
.
success
(
pageResult
,
"查询成功"
);
}
else
{
return
CommonResult
.
failed
(
"查询失败或无数据"
);
}
}
/**
* 查询所有环境
*
* @return 查询到的所有环境, 以及是否查询成功的提示信息
*/
@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
(
"查询失败或无数据"
);
}
List
<
Environment
>
results
=
Optional
.
ofNullable
(
environmentService
.
list
()).
orElse
(
new
ArrayList
<>());
return
results
.
size
()
!=
0
?
CommonResult
.
success
(
results
,
"查询成功"
)
:
CommonResult
.
failed
(
results
,
"查询失败或无数据"
);
}
/**
* 添加
实例
* 添加
环境
*
* @param environment
实例
* @return 添加的
实例
* @param environment
环境对象
* @return 添加的
环境, 以及是否添加成功的提示信息
*/
@ApiOperation
(
value
=
"添加
实例
"
)
@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
(
"添加失败"
);
}
return
CommonResult
.
pred
(
environmentService:
:
save
,
environment
,
"添加成功"
,
"添加失败"
);
}
/**
* 修改
实例
* 修改
环境
*
* @param environment
实例
* @return 修改后的
实例
* @param environment
环境对象
* @return 修改后的
环境, 以及是否修改成功的提示信息
*/
@ApiOperation
(
value
=
"修改
实例
"
)
@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
(
"修改失败"
);
}
return
CommonResult
.
pred
(
environmentService:
:
updateById
,
environment
,
"修改成功"
,
"修改失败"
);
}
/**
* 删除
实例
* 删除
环境
*
* @param id
实例
id
* @return
是否删除成功
* @param id
环境
id
* @return
删除的环境id, 以及是否删除成功的提示信息
*/
@ApiOperation
(
value
=
"根据
id删除实例
"
)
@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
(
"删除失败,或不存在需要删除的数据"
);
}
public
ResponseEntity
<
CommonResultObj
<
Long
>>
deleteEnvironment
(
@PathVariable
Long
id
)
{
return
CommonResult
.
pred
(
environmentService:
:
removeById
,
id
,
"删除成功"
,
"删除失败或id不存在"
);
}
/**
* 根据项目id查询
动作
* 根据项目id查询
环境
*
* @param projectId 项目id
* @return 符合项目id的
动作
* @return 符合项目id的
环境, 以及是否查询成功的提示信息
*/
@ApiOperation
(
value
=
"根据项目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
(
"查询失败或无数据"
);
}
public
ResponseEntity
<
CommonResultObj
<
List
<
Environment
>>>
findByProjectIdEnvironment
(
@PathVariable
Long
projectId
)
{
List
<
Environment
>
results
=
Optional
.
ofNullable
(
environmentService
.
list
(
Wrappers
.
lambdaQuery
(
Environment
.
class
)
.
eq
(
Environment:
:
getProjectId
,
projectId
)))
.
orElse
(
new
ArrayList
<>()
);
return
results
.
size
()
!=
0
?
CommonResult
.
success
(
results
,
"查询成功"
)
:
CommonResult
.
failed
(
results
,
"查询失败或无数据"
);
}
}
kt-web/src/main/java/org/matrix/autotest/controller/MoveController.java
浏览文件 @
486f7088
package
org
.
matrix
.
autotest
.
controller
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
...
...
@@ -45,33 +44,19 @@ public class MoveController {
this
.
actionService
=
actionService
;
}
@ApiOperation
(
value
=
"分页查询用例"
)
@PostMapping
(
"/page"
)
public
ResponseEntity
<
CommonResultObj
<
PageResult
>>
findAllPage
(
@RequestBody
PageResult
pageResult
)
{
pageResult
=
moveService
.
pageAll
(
pageResult
);
if
(
pageResult
.
getRows
()
!=
null
)
{
return
CommonResult
.
success
(
pageResult
,
"查询成功"
);
}
else
{
return
CommonResult
.
failed
(
"查询失败或无数据"
);
}
}
/**
* 输入行为主键id,查询出行为以及行为下包含的所有动作
*
* @param moveId 行为id
* @return {@link MoveAction}
*/
@ApiOperation
(
value
=
"根据
项目
id查,行为以及,行为下的动作"
)
@ApiOperation
(
value
=
"根据
行为
id查,行为以及,行为下的动作"
)
@GetMapping
(
"/{moveId}"
)
public
ResponseEntity
<
CommonResultObj
<
MoveAction
>>
findById
(
@PathVariable
Long
moveId
)
{
// todo 关于空判断的后面可以再处理
Move
byId
=
moveService
.
getById
(
moveId
);
if
(
byId
==
null
)
{
throw
new
GlobalException
(
""
);
if
(
byId
==
null
)
{
throw
new
GlobalException
(
"
不存在行为
"
);
}
Move
move
=
ofNullable
(
moveService
.
getById
(
moveId
))
.
orElseThrow
(()
->
new
GlobalException
(
String
.
format
(
"没有查到指定的行为,你提供的行为id是%d"
,
moveId
)));
List
<
Action
>
actionList
=
ofNullable
(
actionService
.
list
(
Wrappers
.
lambdaQuery
(
Action
.
class
)
...
...
@@ -81,29 +66,45 @@ public class MoveController {
return
CommonResult
.
success
(
ma
,
"查询成功"
);
}
/**
* 根据项目id查询行为
*
* @param projectId 项目id
* @return 查询到的行为, 以及是否查询成功的提示信息
*/
@ApiOperation
(
value
=
"根据项目id查行为"
)
@GetMapping
(
"project/{projectId}"
)
public
ResponseEntity
<
CommonResultObj
<
List
<
Move
>>>
findByProjectIdMove
(
@PathVariable
Integer
projectId
)
{
QueryWrapper
<
Move
>
queryWrapper
=
new
QueryWrapper
<>();
queryWrapper
.
eq
(
"project_id"
,
projectId
);
List
<
Move
>
list
=
moveService
.
list
(
queryWrapper
);
if
(
list
.
size
()
!=
0
)
{
return
CommonResult
.
success
(
list
,
"查询成功"
);
}
else
{
return
CommonResult
.
failed
(
"查询失败或无数据"
);
}
List
<
Move
>
results
=
ofNullable
(
moveService
.
list
(
Wrappers
.
lambdaQuery
(
Move
.
class
)
.
eq
(
Move:
:
getProjectId
,
projectId
)))
.
orElse
(
new
ArrayList
<>());
return
results
.
size
()
!=
0
?
CommonResult
.
success
(
results
,
"查询成功"
)
:
CommonResult
.
failed
(
results
,
"查询失败或无数据"
);
}
/**
* 添加行为和动作(可以单独添加行为)
*
* @param moveAction 行为以及行为下的动作
* @return 添加的行为和动作, 以及是否添加成功的提示信息
*/
@ApiOperation
(
value
=
"添加行为和动作"
)
@PostMapping
public
ResponseEntity
<
CommonResultObj
<
MoveAction
>>
insertMoveAction
(
@RequestBody
MoveAction
moveAction
)
{
boolean
save
=
moveService
.
save
(
moveAction
.
getMove
());
Boolean
moveBoolean
=
Optional
.
of
(
moveService
.
save
(
moveAction
.
getMove
()))
.
orElseThrow
(
GlobalException:
:
new
);
Integer
id
=
Math
.
toIntExact
(
moveAction
.
getMove
().
getId
());
for
(
Action
action
:
moveAction
.
getAction
())
{
action
.
setMoveId
(
id
);
if
(
moveAction
.
getAction
().
size
()
!=
0
)
{
for
(
Action
action
:
moveAction
.
getAction
())
{
action
.
setMoveId
(
id
);
}
}
boolean
actionBoolean
=
actionService
.
saveBatch
(
moveAction
.
getAction
());
if
(
moveAction
.
getAction
().
size
()
==
0
)
{
actionBoolean
=
true
;
}
boolean
saveBatch
=
actionService
.
saveBatch
(
moveAction
.
getAction
());
return
save
&&
saveBatch
return
moveBoolean
&&
actionBoolean
?
CommonResult
.
success
(
moveAction
,
"添加成功"
)
:
CommonResult
.
failed
(
"添加失败"
);
}
...
...
@@ -111,29 +112,30 @@ public class MoveController {
/**
* 修改行为,根据行为id修改动作
*
* @param moveAction
* @return
* @param moveAction
行为以及行为下的动作
* @return
{@link MoveAction}
*/
@ApiOperation
(
value
=
"修改行为
和
动作"
)
@ApiOperation
(
value
=
"修改行为
,修改动作,添加
动作"
)
@PutMapping
public
ResponseEntity
<
CommonResultObj
<
MoveAction
>>
updateMoveAction
(
@RequestBody
MoveAction
moveAction
)
{
Optional
<
Boolean
>
aBoolean
=
ofNullable
(
moveService
.
updateById
(
moveAction
.
getMove
()));
// Optional.ofNullable(actionService.update(Wrappers.))
if
(
aBoolean
.
get
())
{
return
CommonResult
.
success
(
moveAction
,
"修改成功"
);
}
else
{
return
CommonResult
.
failed
(
"修改失败"
);
}
Boolean
moveBoolean
=
Optional
.
of
(
moveService
.
updateById
(
moveAction
.
getMove
()))
.
orElseThrow
(()
->
new
GlobalException
(
"修改失败"
));
Boolean
actionBoolean
=
Optional
.
of
(
actionService
.
updateBatchById
(
moveAction
.
getAction
()))
.
orElseThrow
(()
->
new
GlobalException
(
"修改失败"
)
);
return
moveBoolean
||
actionBoolean
?
CommonResult
.
success
(
moveAction
,
"修改成功"
)
:
CommonResult
.
failed
(
moveAction
,
"修改失败"
);
}
@ApiOperation
(
value
=
"删除行为和动作"
)
@DeleteMapping
(
"/{moveId}"
)
public
ResponseEntity
<
CommonResultObj
<
MoveAction
>>
deleteMoveAction
(
@PathVariable
Long
moveId
)
{
Boolean
aBoolean
=
ofNullable
(
moveService
.
removeById
(
moveId
))
Boolean
moveBoolean
=
Optional
.
of
(
moveService
.
removeById
(
moveId
))
.
orElseThrow
(()
->
new
GlobalException
(
String
.
format
(
"没有查到指定的行为,你提供的行为id是%d"
,
moveId
)));
Optional
.
ofNullable
(
actionService
.
remove
(
Wrappers
.
lambdaQuery
(
Action
.
class
)
.
eq
(
Action:
:
getMoveId
,
moveId
)));
if
(
aBoolean
)
{
Boolean
actionBoolean
=
Optional
.
of
(
actionService
.
remove
(
Wrappers
.
lambdaQuery
(
Action
.
class
)
.
eq
(
Action:
:
getMoveId
,
moveId
)))
.
orElseThrow
(()
->
new
GlobalException
(
String
.
format
(
"没有查到指定的行为,你提供的行为id是%d"
,
moveId
)));
if
(
moveBoolean
&&
actionBoolean
)
{
return
CommonResult
.
success
(
"删除成功"
);
}
else
{
return
CommonResult
.
failed
(
"删除失败或不存在"
+
moveId
+
"id值"
);
...
...
@@ -141,4 +143,3 @@ public class MoveController {
}
}
kt-web/src/main/java/org/matrix/autotest/controller/ProjectController.java
浏览文件 @
486f7088
...
...
@@ -36,7 +36,7 @@ public class ProjectController {
/**
* 查询所有项目
*
* @return 查询到的所有项目
* @return 查询到的所有项目
, 以及是否查询成功的提示信息
*/
@ApiOperation
(
value
=
"查询所有项目"
)
@GetMapping
...
...
@@ -50,8 +50,8 @@ public class ProjectController {
/**
* 添加项目
*
* @param project 项目
* @return 添加的项目
* @param project 项目
对象
* @return 添加的项目
, 以及是否添加成功的提示信息
*/
@ApiOperation
(
value
=
"添加项目"
)
@PostMapping
...
...
@@ -63,8 +63,8 @@ public class ProjectController {
/**
* 修改项目
*
* @param project 项目
* @return 修改后的项目
* @param project 项目
对象
* @return 修改后的项目
, 以及是否修改成功的提示信息
*/
@ApiOperation
(
value
=
"修改项目"
)
@PutMapping
...
...
@@ -79,11 +79,11 @@ public class ProjectController {
* @param id 项目id
* @return 删除的项目id, 以及是否删除成功的提示信息
*/
@ApiOperation
(
value
=
"删除项目"
)
@ApiOperation
(
value
=
"
根据主键id
删除项目"
)
@DeleteMapping
(
"/{id}"
)
public
ResponseEntity
<
CommonResultObj
<
Integer
>>
deleteProject
(
@PathVariable
Integer
id
)
{
public
ResponseEntity
<
CommonResultObj
<
Long
>>
deleteProject
(
@PathVariable
Long
id
)
{
return
CommonResult
.
pred
(
projectService:
:
removeById
,
id
,
"删除成功"
,
"删除失败"
);
,
"删除成功"
,
"删除失败
或id不存在
"
);
}
}
kt-web/src/main/java/org/matrix/autotest/controller/TestCaseController.java
浏览文件 @
486f7088
package
org
.
matrix
.
autotest
.
controller
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.matrix.database.entity.TestCase
;
...
...
@@ -10,7 +11,9 @@ import org.matrix.database.vo.PageResult;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Optional
;
/**
* <p>
...
...
@@ -32,95 +35,74 @@ public class TestCaseController {
this
.
testCaseService
=
testCaseService
;
}
@ApiOperation
(
value
=
"分页查询用例"
)
@PostMapping
(
"/page"
)
public
ResponseEntity
<
CommonResultObj
<
PageResult
>>
findAllPage
(
@RequestBody
PageResult
pageResult
)
{
pageResult
=
testCaseService
.
pageAll
(
pageResult
);
if
(
pageResult
.
getRows
()
!=
null
)
{
return
CommonResult
.
success
(
pageResult
,
"查询成功"
);
}
else
{
return
CommonResult
.
failed
(
"查询失败或无数据"
);
}
}
/**
* 查询所有用例
*
* @return 查询到的所有用例, 以及是否查询成功的提示信息
*/
@ApiOperation
(
value
=
"查询所有用例"
)
@GetMapping
public
ResponseEntity
<
CommonResultObj
<
List
<
TestCase
>>>
findAll
()
{
List
<
TestCase
>
list
=
testCaseService
.
list
();
if
(
list
!=
null
&&
list
.
size
()
!=
0
)
{
return
CommonResult
.
success
(
list
,
"查询成功"
);
}
else
{
return
CommonResult
.
failed
(
"查询失败或无数据"
);
}
List
<
TestCase
>
results
=
Optional
.
ofNullable
(
testCaseService
.
list
()).
orElse
(
new
ArrayList
<>());
return
results
.
size
()
!=
0
?
CommonResult
.
success
(
results
,
"查询成功"
)
:
CommonResult
.
failed
(
results
,
"查询失败或无数据"
);
}
/**
* 添加用例
*
* @param testCase 用例
* @return 添加的用例
* @param testCase 用例
对象
* @return 添加的用例
, 以及是否添加成功的提示信息
*/
@ApiOperation
(
value
=
"添加用例"
)
@PostMapping
public
ResponseEntity
<
CommonResultObj
<
TestCase
>>
insertTestCase
(
@RequestBody
TestCase
testCase
)
{
int
i
=
testCaseService
.
insertTestCase
(
testCase
);
if
(
i
!=
0
)
{
return
CommonResult
.
success
(
testCase
,
"添加成功"
);
}
else
{
return
CommonResult
.
failed
(
"添加失败"
);
}
return
CommonResult
.
pred
(
testCaseService:
:
save
,
testCase
,
"添加成功"
,
"添加失败"
);
}
/**
* 修改用例
*
* @param testCase 用例
* @return 修改后的用例
* @param testCase 用例
对象
* @return 修改后的用例
, 以及是否修改成功的提示信息
*/
@ApiOperation
(
value
=
"修改用例"
)
@PutMapping
public
ResponseEntity
<
CommonResultObj
<
TestCase
>>
updateTestCase
(
@RequestBody
TestCase
testCase
)
{
int
i
=
testCaseService
.
updateTestCase
(
testCase
);
if
(
i
!=
0
)
{
return
CommonResult
.
success
(
testCase
,
"修改成功"
);
}
else
{
return
CommonResult
.
failed
(
"修改失败"
);
}
return
CommonResult
.
pred
(
testCaseService:
:
updateById
,
testCase
,
"修改成功"
,
"修改失败"
);
}
/**
* 删除用例
*
* @param id 用例id
* @return
是否删除成功
* @return
删除的用例id, 以及是否删除成功的提示信息
*/
@ApiOperation
(
value
=
"根据id删除用例"
)
@ApiOperation
(
value
=
"根据
主键
id删除用例"
)
@DeleteMapping
(
"/{id}"
)
public
ResponseEntity
<
CommonResultObj
<
String
>>
deleteTestCase
(
@PathVariable
Integer
id
)
{
int
i
=
testCaseService
.
deleteTestCase
(
id
);
if
(
i
!=
0
)
{
return
CommonResult
.
success
(
"id: "
+
id
+
"已删除"
,
"删除成功"
);
}
else
{
return
CommonResult
.
failed
(
"删除失败,或不存在需要删除的数据"
);
}
public
ResponseEntity
<
CommonResultObj
<
Long
>>
deleteTestCase
(
@PathVariable
Long
id
)
{
return
CommonResult
.
pred
(
testCaseService:
:
removeById
,
id
,
"删除成功"
,
"删除失败或id不存在"
);
}
/**
* 根据项目id查询
动作
* 根据项目id查询
用例
*
* @param projectId 项目id
* @return 符合项目id的
动作
* @return 符合项目id的
环境, 以及是否查询成功的提示信息
*/
@ApiOperation
(
value
=
"根据项目id查询所有"
)
@ApiOperation
(
value
=
"根据项目id查询所有
用例
"
)
@GetMapping
(
"/project/{projectId}"
)
public
ResponseEntity
<
CommonResultObj
<
List
<
TestCase
>>>
findByProjectIdTestCase
(
@PathVariable
Integer
projectId
)
{
List
<
TestCase
>
results
=
testCaseService
.
findByProjectIdTestCase
(
projectId
);
if
(
results
!=
null
&&
results
.
size
()
!=
0
)
{
return
CommonResult
.
success
(
results
,
"查询成功"
);
}
else
{
return
CommonResult
.
failed
(
"查询失败或无数据"
);
}
List
<
TestCase
>
results
=
Optional
.
ofNullable
(
testCaseService
.
list
(
Wrappers
.
lambdaQuery
(
TestCase
.
class
)
.
eq
(
TestCase:
:
getProjectId
,
projectId
)))
.
orElse
(
new
ArrayList
<>()
);
return
results
.
size
()
!=
0
?
CommonResult
.
success
(
results
,
"查询成功"
)
:
CommonResult
.
failed
(
results
,
"查询失败或无数据"
);
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论