Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
W
web
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
mry
web
Commits
bb674b98
提交
bb674b98
authored
1月 21, 2022
作者:
mry
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
1111
上级
e30ad6b6
隐藏空白字符变更
内嵌
并排
正在显示
25 个修改的文件
包含
307 行增加
和
649 行删除
+307
-649
pom.xml
pom.xml
+1
-1
MybatisPlusConfig.java
...in/java/org/matrix/autotest/config/MybatisPlusConfig.java
+21
-0
ActionController.java
...java/org/matrix/autotest/controller/ActionController.java
+0
-153
ConnectController.java
...ava/org/matrix/autotest/controller/ConnectController.java
+13
-23
DynamicVariableController.java
...matrix/autotest/controller/DynamicVariableController.java
+14
-23
EnvironmentController.java
...org/matrix/autotest/controller/EnvironmentController.java
+13
-23
MoveController.java
...n/java/org/matrix/autotest/controller/MoveController.java
+67
-74
ProjectController.java
...ava/org/matrix/autotest/controller/ProjectController.java
+1
-18
TestCaseController.java
...va/org/matrix/autotest/controller/TestCaseController.java
+14
-41
ActionService.java
src/main/java/org/matrix/autotest/service/ActionService.java
+0
-57
ConnectService.java
...main/java/org/matrix/autotest/service/ConnectService.java
+2
-16
DynamicVariableService.java
...a/org/matrix/autotest/service/DynamicVariableService.java
+2
-14
EnvironmentService.java
.../java/org/matrix/autotest/service/EnvironmentService.java
+2
-14
ActionServiceImpl.java
...a/org/matrix/autotest/service/Impl/ActionServiceImpl.java
+0
-48
ConnectServiceImpl.java
.../org/matrix/autotest/service/Impl/ConnectServiceImpl.java
+20
-10
DynamicVariableServiceImpl.java
...rix/autotest/service/Impl/DynamicVariableServiceImpl.java
+19
-11
EnvironmentServiceImpl.java
.../matrix/autotest/service/Impl/EnvironmentServiceImpl.java
+19
-10
MoveServiceImpl.java
...ava/org/matrix/autotest/service/Impl/MoveServiceImpl.java
+16
-30
ProjectServiceImpl.java
.../org/matrix/autotest/service/Impl/ProjectServiceImpl.java
+0
-5
TestCaseServiceImpl.java
...org/matrix/autotest/service/Impl/TestCaseServiceImpl.java
+18
-10
MoveService.java
src/main/java/org/matrix/autotest/service/MoveService.java
+3
-46
ProjectService.java
...main/java/org/matrix/autotest/service/ProjectService.java
+0
-8
TestCaseService.java
...ain/java/org/matrix/autotest/service/TestCaseService.java
+2
-14
MoveAction.java
src/main/java/org/matrix/autotest/vo/MoveAction.java
+24
-0
PageResult.java
src/main/java/org/matrix/autotest/vo/PageResult.java
+36
-0
没有找到文件。
pom.xml
浏览文件 @
bb674b98
...
...
@@ -43,7 +43,7 @@
<dependency>
<groupId>
com.baomidou
</groupId>
<artifactId>
mybatis-plus-boot-starter
</artifactId>
<version>
3.
3
.0
</version>
<version>
3.
5
.0
</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.projectlombok/lombok -->
...
...
src/main/java/org/matrix/autotest/config/MybatisPlusConfig.java
0 → 100644
浏览文件 @
bb674b98
package
org
.
matrix
.
autotest
.
config
;
import
com.baomidou.mybatisplus.annotation.DbType
;
import
com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor
;
import
com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
/**
* @author mry
*/
@Configuration
public
class
MybatisPlusConfig
{
@Bean
public
MybatisPlusInterceptor
mybatisPlusInterceptor
()
{
MybatisPlusInterceptor
interceptor
=
new
MybatisPlusInterceptor
();
interceptor
.
addInnerInterceptor
(
new
PaginationInnerInterceptor
(
DbType
.
MARIADB
));
return
interceptor
;
}
}
src/main/java/org/matrix/autotest/controller/ActionController.java
deleted
100644 → 0
浏览文件 @
e30ad6b6
package
org
.
matrix
.
autotest
.
controller
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.matrix.autotest.entity.Action
;
import
org.matrix.autotest.service.ActionService
;
import
org.matrix.autotest.utils.CommonResult
;
import
org.matrix.autotest.utils.CommonResultObj
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.List
;
/**
* <p>
* 动作 前端控制器
* </p>
*
* @author mry
* @since 2022-01-07
*/
@CrossOrigin
@RestController
@RequestMapping
(
"/actions"
)
@Api
(
tags
=
"对动作action的基本操作"
)
public
class
ActionController
{
private
final
ActionService
actionService
;
public
ActionController
(
ActionService
actionService
)
{
this
.
actionService
=
actionService
;
}
/**
* 查询所有动作
*
* @return 查询到的所有动作
*/
@ApiOperation
(
value
=
"查询所有动作"
)
@GetMapping
public
ResponseEntity
<
CommonResultObj
<
List
<
Action
>>>
findAllAction
()
{
List
<
Action
>
results
=
actionService
.
findAllAction
();
if
(
results
!=
null
&&
results
.
size
()
!=
0
)
{
return
CommonResult
.
success
(
results
,
"查询成功"
);
}
else
{
return
CommonResult
.
failed
(
"查询失败或无数据"
);
}
}
/**
* 根据id查询动作
*
* @param id 动作Id
* @return 动作
*/
@ApiOperation
(
value
=
"根据id查询动作"
)
@GetMapping
(
"/{id}"
)
public
ResponseEntity
<
CommonResultObj
<
Action
>>
findByIdAction
(
@PathVariable
Integer
id
)
{
Action
result
=
actionService
.
findByIdAction
(
id
);
if
(
result
!=
null
)
{
return
CommonResult
.
success
(
result
,
"查询成功"
);
}
else
{
return
CommonResult
.
failed
(
"查询失败或无数据"
);
}
}
/**
* 添加动作
*
* @param action 动作
* @return 添加的动作
*/
@ApiOperation
(
value
=
"添加动作"
)
@PostMapping
public
ResponseEntity
<
CommonResultObj
<
Action
>>
insertAction
(
@RequestBody
Action
action
)
{
int
i
=
actionService
.
insertAction
(
action
);
if
(
i
!=
0
)
{
return
CommonResult
.
success
(
action
,
"添加成功"
);
}
else
{
return
CommonResult
.
failed
(
"添加失败"
);
}
}
/**
* 修改动作
*
* @param action 动作
* @return 修改后的动作
*/
@ApiOperation
(
value
=
"修改动作"
)
@PutMapping
public
ResponseEntity
<
CommonResultObj
<
Action
>>
updateAction
(
@RequestBody
Action
action
)
{
int
i
=
actionService
.
updateAction
(
action
);
if
(
i
!=
0
)
{
return
CommonResult
.
success
(
action
,
"修改成功"
);
}
else
{
return
CommonResult
.
failed
(
"修改失败"
);
}
}
/**
* 删除动作
*
* @param id 动作id
* @return 是否删除成功
*/
@ApiOperation
(
value
=
"根据id删除动作"
)
@DeleteMapping
(
"/{id}"
)
public
ResponseEntity
<
CommonResultObj
<
String
>>
deleteAction
(
@PathVariable
Integer
id
)
{
int
i
=
actionService
.
deleteAction
(
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
<
Action
>>>
findByProjectIdAction
(
@PathVariable
Integer
projectId
)
{
List
<
Action
>
results
=
actionService
.
findByProjectIdAction
(
projectId
);
if
(
results
!=
null
&&
results
.
size
()
!=
0
)
{
return
CommonResult
.
success
(
results
,
"查询成功"
);
}
else
{
return
CommonResult
.
failed
(
"查询失败或无数据"
);
}
}
/**
* 根据行为id查询动作
*
* @param moveId 行为id
* @return 符合行为id的动作
*/
@ApiOperation
(
value
=
"根据行为id查询所有"
)
@GetMapping
(
"/move/{moveId}"
)
public
ResponseEntity
<
CommonResultObj
<
List
<
Action
>>>
findByMoveIdAction
(
@PathVariable
Integer
moveId
)
{
List
<
Action
>
results
=
actionService
.
findByMoveIdAction
(
moveId
);
if
(
results
!=
null
&&
results
.
size
()
!=
0
)
{
return
CommonResult
.
success
(
results
,
"查询成功"
);
}
else
{
return
CommonResult
.
failed
(
"查询失败或无数据"
);
}
}
}
src/main/java/org/matrix/autotest/controller/ConnectController.java
浏览文件 @
bb674b98
...
...
@@ -6,6 +6,7 @@ import org.matrix.autotest.entity.Connect;
import
org.matrix.autotest.service.ConnectService
;
import
org.matrix.autotest.utils.CommonResult
;
import
org.matrix.autotest.utils.CommonResultObj
;
import
org.matrix.autotest.vo.PageResult
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.*
;
...
...
@@ -31,34 +32,23 @@ public class ConnectController {
this
.
connectService
=
connectService
;
}
/**
* 查询所有连接池
*
* @return 查询到的所有连接池
*/
@ApiOperation
(
value
=
"查询所有连接池"
)
@GetMapping
public
ResponseEntity
<
CommonResultObj
<
List
<
Connect
>>>
findAllConnect
()
{
List
<
Connect
>
results
=
connectService
.
findAllConnect
();
if
(
results
!=
null
&&
results
.
size
()
!=
0
)
{
return
CommonResult
.
success
(
results
,
"查询成功"
);
@ApiOperation
(
value
=
"分页查询"
)
@GetMapping
(
"/page"
)
public
ResponseEntity
<
CommonResultObj
<
PageResult
>>
findAllPage
(
PageResult
pageResult
)
{
pageResult
=
connectService
.
pageAll
(
pageResult
);
if
(
pageResult
.
getRows
()
!=
null
)
{
return
CommonResult
.
success
(
pageResult
,
"查询成功"
);
}
else
{
return
CommonResult
.
failed
(
"查询失败或无数据"
);
}
}
/**
* 根据id查询连接池
*
* @param id 连接池Id
* @return 连接池
*/
@ApiOperation
(
value
=
"根据id查询连接池"
)
@GetMapping
(
"/{id}"
)
public
ResponseEntity
<
CommonResultObj
<
Connect
>>
findByIdConnect
(
@PathVariable
Integer
id
)
{
Connect
result
=
connectService
.
findByIdConnect
(
id
);
if
(
result
!=
null
)
{
return
CommonResult
.
success
(
result
,
"查询成功"
);
@ApiOperation
(
value
=
"查询所有"
)
@GetMapping
public
ResponseEntity
<
CommonResultObj
<
List
<
Connect
>>>
findAll
()
{
List
<
Connect
>
list
=
connectService
.
list
();
if
(
list
!=
null
&&
list
.
size
()
!=
0
)
{
return
CommonResult
.
success
(
list
,
"查询成功"
);
}
else
{
return
CommonResult
.
failed
(
"查询失败或无数据"
);
}
...
...
src/main/java/org/matrix/autotest/controller/DynamicVariableController.java
浏览文件 @
bb674b98
...
...
@@ -6,6 +6,7 @@ import org.matrix.autotest.entity.DynamicVariable;
import
org.matrix.autotest.service.DynamicVariableService
;
import
org.matrix.autotest.utils.CommonResult
;
import
org.matrix.autotest.utils.CommonResultObj
;
import
org.matrix.autotest.vo.PageResult
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.*
;
...
...
@@ -31,34 +32,24 @@ public class DynamicVariableController {
this
.
dynamicVariableService
=
dynamicVariableService
;
}
/**
* 查询所有动态变量
*
* @return 查询到的所有动态变量
*/
@ApiOperation
(
value
=
"查询所有动态变量"
)
@GetMapping
public
ResponseEntity
<
CommonResultObj
<
List
<
DynamicVariable
>>>
findAllDynamicVariable
()
{
List
<
DynamicVariable
>
results
=
dynamicVariableService
.
findAllDynamicVariable
();
if
(
results
!=
null
&&
results
.
size
()
!=
0
)
{
return
CommonResult
.
success
(
results
,
"查询成功"
);
@ApiOperation
(
value
=
"分页查询"
)
@GetMapping
(
"/page"
)
public
ResponseEntity
<
CommonResultObj
<
PageResult
>>
findAllPage
(
PageResult
pageResult
)
{
pageResult
=
dynamicVariableService
.
pageAll
(
pageResult
);
if
(
pageResult
.
getRows
()
!=
null
)
{
return
CommonResult
.
success
(
pageResult
,
"查询成功"
);
}
else
{
return
CommonResult
.
failed
(
"查询失败或无数据"
);
}
}
/**
* 根据id查询动态变量
*
* @param id 动态变量Id
* @return 动态变量
*/
@ApiOperation
(
value
=
"根据id查询动态变量"
)
@GetMapping
(
"/{id}"
)
public
ResponseEntity
<
CommonResultObj
<
DynamicVariable
>>
findByIdDynamicVariable
(
@PathVariable
Integer
id
)
{
DynamicVariable
result
=
dynamicVariableService
.
findByIdDynamicVariable
(
id
);
if
(
result
!=
null
)
{
return
CommonResult
.
success
(
result
,
"查询成功"
);
@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
(
"查询失败或无数据"
);
}
...
...
src/main/java/org/matrix/autotest/controller/EnvironmentController.java
浏览文件 @
bb674b98
...
...
@@ -6,6 +6,7 @@ import org.matrix.autotest.entity.Environment;
import
org.matrix.autotest.service.EnvironmentService
;
import
org.matrix.autotest.utils.CommonResult
;
import
org.matrix.autotest.utils.CommonResultObj
;
import
org.matrix.autotest.vo.PageResult
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.*
;
...
...
@@ -31,34 +32,23 @@ public class EnvironmentController {
this
.
environmentService
=
environmentService
;
}
/**
* 查询所有实例
*
* @return 查询到的所有实例
*/
@ApiOperation
(
value
=
"查询所有实例"
)
@GetMapping
public
ResponseEntity
<
CommonResultObj
<
List
<
Environment
>>>
findAllEnvironment
()
{
List
<
Environment
>
results
=
environmentService
.
findAllEnvironment
();
if
(
results
!=
null
&&
results
.
size
()
!=
0
)
{
return
CommonResult
.
success
(
results
,
"查询成功"
);
@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
(
"查询失败或无数据"
);
}
}
/**
* 根据id查询实例
*
* @param id 实例Id
* @return 实例
*/
@ApiOperation
(
value
=
"根据id查询实例"
)
@GetMapping
(
"/{id}"
)
public
ResponseEntity
<
CommonResultObj
<
Environment
>>
findByIdEnvironment
(
@PathVariable
Integer
id
)
{
Environment
result
=
environmentService
.
findByIdEnvironment
(
id
);
if
(
result
!=
null
)
{
return
CommonResult
.
success
(
result
,
"查询成功"
);
@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
(
"查询失败或无数据"
);
}
...
...
src/main/java/org/matrix/autotest/controller/MoveController.java
浏览文件 @
bb674b98
package
org
.
matrix
.
autotest
.
controller
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.matrix.autotest.entity.Action
;
import
org.matrix.autotest.entity.Move
;
import
org.matrix.autotest.service.ActionService
;
import
org.matrix.autotest.service.MoveService
;
import
org.matrix.autotest.utils.CommonResult
;
import
org.matrix.autotest.utils.CommonResultObj
;
import
org.matrix.autotest.vo.MoveAction
;
import
org.matrix.autotest.vo.PageResult
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.*
;
...
...
@@ -25,112 +30,100 @@ import java.util.List;
@Api
(
tags
=
"对行为move的基本操作"
)
public
class
MoveController
{
private
final
ActionService
actionService
;
private
final
MoveService
moveService
;
public
MoveController
(
MoveService
moveService
)
{
public
MoveController
(
MoveService
moveService
,
ActionService
actionService
)
{
this
.
moveService
=
moveService
;
this
.
actionService
=
actionService
;
}
/**
* 查询所有行为
*
* @return 查询到的所有行为
*/
@ApiOperation
(
value
=
"查询所有行为"
)
@GetMapping
public
ResponseEntity
<
CommonResultObj
<
List
<
Move
>>>
findAllMove
()
{
List
<
Move
>
results
=
moveService
.
findAllMove
();
if
(
results
!=
null
&&
results
.
size
()
!=
0
)
{
return
CommonResult
.
success
(
results
,
"查询成功"
);
@ApiOperation
(
value
=
"分页查询用例"
)
@GetMapping
(
"/page"
)
public
ResponseEntity
<
CommonResultObj
<
PageResult
>>
findAllPage
(
PageResult
pageResult
)
{
pageResult
=
moveService
.
pageAll
(
pageResult
);
if
(
pageResult
.
getRows
()
!=
null
)
{
return
CommonResult
.
success
(
pageResult
,
"查询成功"
);
}
else
{
return
CommonResult
.
failed
(
"查询失败或无数据"
);
}
}
/**
* 根据id查询行为
*
* @param id 行为Id
* @return 行为
*/
@ApiOperation
(
value
=
"根据id查询行为"
)
@ApiOperation
(
value
=
"根据项目id查,行为以及,行为下的动作"
)
@GetMapping
(
"/{id}"
)
public
ResponseEntity
<
CommonResultObj
<
Move
>>
findByIdMove
(
@PathVariable
Integer
id
)
{
Move
result
=
moveService
.
findByIdMove
(
id
);
if
(
result
!=
null
)
{
return
CommonResult
.
success
(
result
,
"查询成功"
);
public
ResponseEntity
<
CommonResultObj
<
MoveAction
>>
findById
(
@PathVariable
Integer
id
)
{
Move
move
=
moveService
.
getById
(
id
);
Integer
projectId
=
move
.
getProjectId
();
QueryWrapper
<
Action
>
queryWrapper
=
new
QueryWrapper
<>();
queryWrapper
.
eq
(
"project_id"
,
projectId
);
List
<
Action
>
list
=
actionService
.
list
(
queryWrapper
);
MoveAction
moveAction
=
new
MoveAction
();
moveAction
.
setMove
(
move
);
moveAction
.
setAction
(
list
);
if
(
list
!=
null
&&
list
.
size
()
!=
0
)
{
return
CommonResult
.
success
(
moveAction
,
"查询成功"
);
}
else
{
return
CommonResult
.
failed
(
"查询失败或无数据"
);
}
}
@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
(
"查询失败或无数据"
);
}
}
/**
* 添加行为
*
* @param move 行为
* @return 添加的行为
*/
@ApiOperation
(
value
=
"添加行为"
)
@ApiOperation
(
value
=
"添加行为和动作"
)
@PostMapping
public
ResponseEntity
<
CommonResultObj
<
Move
>>
insertMove
(
@RequestBody
Move
move
)
{
int
i
=
moveService
.
insertMove
(
move
);
if
(
i
!=
0
)
{
return
CommonResult
.
success
(
move
,
"添加成功"
);
public
ResponseEntity
<
CommonResultObj
<
MoveAction
>>
insertMoveAction
(
@RequestBody
MoveAction
moveAction
)
{
boolean
save
=
moveService
.
save
(
moveAction
.
getMove
());
Integer
id
=
moveAction
.
getMove
().
getId
();
for
(
Action
action
:
moveAction
.
getAction
())
{
action
.
setMoveId
(
id
);
}
boolean
saveBatch
=
actionService
.
saveBatch
(
moveAction
.
getAction
());
if
(
save
&&
saveBatch
)
{
return
CommonResult
.
success
(
moveAction
,
"添加成功"
);
}
else
{
return
CommonResult
.
failed
(
"添加失败"
);
}
}
/**
* 修改行为
*
* @param move 行为
* @return 修改后的行为
*/
@ApiOperation
(
value
=
"修改行为"
)
@ApiOperation
(
value
=
"修改行为和动作"
)
@PutMapping
public
ResponseEntity
<
CommonResultObj
<
Move
>>
updateMove
(
@RequestBody
Move
move
)
{
int
i
=
moveService
.
updateMove
(
move
);
if
(
i
!=
0
)
{
return
CommonResult
.
success
(
move
,
"修改成功"
);
public
ResponseEntity
<
CommonResultObj
<
MoveAction
>>
updateMoveAction
(
@RequestBody
MoveAction
moveAction
)
{
boolean
moveUpdate
=
moveService
.
update
(
null
);
boolean
actionUpdate
=
actionService
.
update
(
null
);
if
(
moveUpdate
||
actionUpdate
)
{
return
CommonResult
.
success
(
moveAction
,
"修改成功"
);
}
else
{
return
CommonResult
.
failed
(
"修改失败"
);
}
}
/**
* 删除行为
*
* @param id 行为id
* @return 是否删除成功
*/
@ApiOperation
(
value
=
"根据id删除行为"
)
@DeleteMapping
(
"/{id}"
)
public
ResponseEntity
<
CommonResultObj
<
String
>>
deleteMove
(
@PathVariable
Integer
id
)
{
int
i
=
moveService
.
deleteMove
(
id
);
if
(
i
!=
0
)
{
return
CommonResult
.
success
(
"id: "
+
id
+
"已删除"
,
"删除成功"
);
@ApiOperation
(
value
=
"删除行为和动作"
)
@DeleteMapping
(
"/{projectId}"
)
public
ResponseEntity
<
CommonResultObj
<
MoveAction
>>
deleteMoveAction
(
@PathVariable
Integer
projectId
)
{
QueryWrapper
<
Action
>
actionQueryWrapper
=
new
QueryWrapper
<>();
actionQueryWrapper
.
eq
(
"project_id"
,
projectId
);
boolean
action
=
actionService
.
remove
(
actionQueryWrapper
);
QueryWrapper
<
Move
>
moveQueryWrapper
=
new
QueryWrapper
<>();
moveQueryWrapper
.
eq
(
"project_id"
,
projectId
);
boolean
move
=
moveService
.
remove
(
moveQueryWrapper
);
if
(
action
&&
move
)
{
return
CommonResult
.
success
(
"删除成功"
);
}
else
{
return
CommonResult
.
failed
(
"删除失败,或不存在需要删除的数据"
);
}
}
/**
* 根据项目id查询动作
*
* @param projectId 项目id
* @return 符合项目id的动作
*/
@ApiOperation
(
value
=
"根据项目id查询所有"
)
@GetMapping
(
"/project/{projectId}"
)
public
ResponseEntity
<
CommonResultObj
<
List
<
Move
>>>
findByProjectIdMove
(
@PathVariable
Integer
projectId
)
{
List
<
Move
>
results
=
moveService
.
findByProjectIdMove
(
projectId
);
if
(
results
!=
null
&&
results
.
size
()
!=
0
)
{
return
CommonResult
.
success
(
results
,
"查询成功"
);
}
else
{
return
CommonResult
.
failed
(
"查询失败或无数据"
);
}
}
}
src/main/java/org/matrix/autotest/controller/ProjectController.java
浏览文件 @
bb674b98
...
...
@@ -47,23 +47,6 @@ public class ProjectController {
}
}
/**
* 根据id查询项目
*
* @param id 项目Id
* @return 项目
*/
@ApiOperation
(
value
=
"根据id查询项目"
)
@GetMapping
(
"/{id}"
)
public
ResponseEntity
<
CommonResultObj
<
Project
>>
findByIdProject
(
@PathVariable
Integer
id
)
{
Project
result
=
projectService
.
findByIdProject
(
id
);
if
(
result
!=
null
)
{
return
CommonResult
.
success
(
result
,
"查询成功"
);
}
else
{
return
CommonResult
.
failed
(
"查询失败或无数据"
);
}
}
/**
* 添加项目
*
...
...
@@ -77,7 +60,7 @@ public class ProjectController {
if
(
i
!=
0
)
{
return
CommonResult
.
success
(
project
,
"添加成功"
);
}
else
{
return
CommonResult
.
failed
(
"添加失败"
);
return
CommonResult
.
failed
(
"添加失败
或已存在同名项目
"
);
}
}
...
...
src/main/java/org/matrix/autotest/controller/TestCaseController.java
浏览文件 @
bb674b98
...
...
@@ -6,11 +6,10 @@ import org.matrix.autotest.entity.TestCase;
import
org.matrix.autotest.service.TestCaseService
;
import
org.matrix.autotest.utils.CommonResult
;
import
org.matrix.autotest.utils.CommonResultObj
;
import
org.matrix.autotest.vo.PageResult
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.*
;
import
org.testng.TestNG
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
...
...
@@ -33,34 +32,24 @@ public class TestCaseController {
this
.
testCaseService
=
testCaseService
;
}
/**
* 查询所有用例
*
* @return 查询到的所有用例
*/
@ApiOperation
(
value
=
"查询所有用例"
)
@GetMapping
public
ResponseEntity
<
CommonResultObj
<
List
<
TestCase
>>>
findAllTestCase
()
{
List
<
TestCase
>
results
=
testCaseService
.
findAllTestCase
();
if
(
results
!=
null
&&
results
.
size
()
!=
0
)
{
return
CommonResult
.
success
(
results
,
"查询成功"
);
@ApiOperation
(
value
=
"分页查询用例"
)
@GetMapping
(
"/page"
)
public
ResponseEntity
<
CommonResultObj
<
PageResult
>>
findAllPage
(
PageResult
pageResult
)
{
pageResult
=
testCaseService
.
pageAll
(
pageResult
);
if
(
pageResult
.
getRows
()
!=
null
)
{
return
CommonResult
.
success
(
pageResult
,
"查询成功"
);
}
else
{
return
CommonResult
.
failed
(
"查询失败或无数据"
);
}
}
/**
* 根据id查询用例
*
* @param id 用例Id
* @return 用例
*/
@ApiOperation
(
value
=
"根据id查询用例"
)
@GetMapping
(
"/{id}"
)
public
ResponseEntity
<
CommonResultObj
<
TestCase
>>
findByIdTestCase
(
@PathVariable
Integer
id
)
{
TestCase
result
=
testCaseService
.
findByIdTestCase
(
id
);
if
(
result
!=
null
)
{
return
CommonResult
.
success
(
result
,
"查询成功"
);
@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
(
"查询失败或无数据"
);
}
...
...
@@ -134,21 +123,5 @@ public class TestCaseController {
}
}
/**
* 执行测试用例
*
* @param name 用例名称
* @return 是否执行成功
*/
@ApiOperation
(
value
=
"执行测试用例"
)
@GetMapping
(
"/start/{name}"
)
public
void
start
(
@PathVariable
String
name
)
{
List
<
String
>
suites
=
new
ArrayList
<
String
>();
suites
.
add
(
"kt-script\\src\\main\\java\\org\\matrix\\"
+
name
);
TestNG
testNG
=
new
TestNG
();
testNG
.
setTestSuites
(
suites
);
testNG
.
run
();
}
}
src/main/java/org/matrix/autotest/service/ActionService.java
浏览文件 @
bb674b98
...
...
@@ -3,8 +3,6 @@ package org.matrix.autotest.service;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
org.matrix.autotest.entity.Action
;
import
java.util.List
;
/**
* <p>
* 动作 服务类
...
...
@@ -15,59 +13,4 @@ import java.util.List;
*/
public
interface
ActionService
extends
IService
<
Action
>
{
/**
* 查询所有动作
*
* @return 查询到的所有动作
*/
List
<
Action
>
findAllAction
();
/**
* 根据id查询动作
*
* @param id 动作id
* @return 动作
*/
Action
findByIdAction
(
Integer
id
);
/**
* 添加动作
*
* @param action 动作
* @return 影响行数
*/
int
insertAction
(
Action
action
);
/**
* 修改动作
*
* @param action 动作
* @return 影响行数
*/
int
updateAction
(
Action
action
);
/**
* 删除动作
*
* @param id 动作id
* @return 影响行数
*/
int
deleteAction
(
Integer
id
);
/**
* 根据项目id查询动作
*
* @param projectId 项目id
* @return 符合项目id的动作
*/
List
<
Action
>
findByProjectIdAction
(
Integer
projectId
);
/**
* 根据行为id查询动作
*
* @param moveId 行为id
* @return 符合行为id的动作
*/
List
<
Action
>
findByMoveIdAction
(
Integer
moveId
);
}
src/main/java/org/matrix/autotest/service/ConnectService.java
浏览文件 @
bb674b98
...
...
@@ -2,8 +2,7 @@ package org.matrix.autotest.service;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
org.matrix.autotest.entity.Connect
;
import
java.util.List
;
import
org.matrix.autotest.vo.PageResult
;
/**
* <p>
...
...
@@ -14,20 +13,6 @@ import java.util.List;
* @since 2022-01-07
*/
public
interface
ConnectService
extends
IService
<
Connect
>
{
/**
* 查询所有连接池
*
* @return 查询到的所有连接池
*/
List
<
Connect
>
findAllConnect
();
/**
* 根据id查询连接池
*
* @param id 连接池Id
* @return 连接池
*/
Connect
findByIdConnect
(
Integer
id
);
/**
* 添加连接池
...
...
@@ -53,4 +38,5 @@ public interface ConnectService extends IService<Connect> {
*/
int
deleteConnect
(
Integer
id
);
PageResult
pageAll
(
PageResult
pageResult
);
}
src/main/java/org/matrix/autotest/service/DynamicVariableService.java
浏览文件 @
bb674b98
...
...
@@ -2,6 +2,7 @@ package org.matrix.autotest.service;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
org.matrix.autotest.entity.DynamicVariable
;
import
org.matrix.autotest.vo.PageResult
;
import
java.util.List
;
...
...
@@ -14,20 +15,6 @@ import java.util.List;
* @since 2022-01-07
*/
public
interface
DynamicVariableService
extends
IService
<
DynamicVariable
>
{
/**
* 查询所有动态变量
*
* @return 查询到的所有动态变量
*/
List
<
DynamicVariable
>
findAllDynamicVariable
();
/**
* 根据id查询动态变量
*
* @param id 动态变量id
* @return 动态变量
*/
DynamicVariable
findByIdDynamicVariable
(
Integer
id
);
/**
* 添加动态变量
...
...
@@ -61,4 +48,5 @@ public interface DynamicVariableService extends IService<DynamicVariable> {
*/
List
<
DynamicVariable
>
findByProjectIdDynamicVariable
(
Integer
projectId
);
PageResult
pageAll
(
PageResult
pageResult
);
}
src/main/java/org/matrix/autotest/service/EnvironmentService.java
浏览文件 @
bb674b98
...
...
@@ -2,6 +2,7 @@ package org.matrix.autotest.service;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
org.matrix.autotest.entity.Environment
;
import
org.matrix.autotest.vo.PageResult
;
import
java.util.List
;
...
...
@@ -14,20 +15,6 @@ import java.util.List;
* @since 2022-01-07
*/
public
interface
EnvironmentService
extends
IService
<
Environment
>
{
/**
* 查询所有实例
*
* @return 查询到的所有实例
*/
List
<
Environment
>
findAllEnvironment
();
/**
* 根据id查询实例
*
* @param id 实例id
* @return 实例
*/
Environment
findByIdEnvironment
(
Integer
id
);
/**
* 添加实例
...
...
@@ -61,4 +48,5 @@ public interface EnvironmentService extends IService<Environment> {
*/
List
<
Environment
>
findByProjectIdEnvironment
(
Integer
projectId
);
PageResult
pageAll
(
PageResult
pageResult
);
}
src/main/java/org/matrix/autotest/service/Impl/ActionServiceImpl.java
浏览文件 @
bb674b98
package
org
.
matrix
.
autotest
.
service
.
Impl
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
org.matrix.autotest.dao.ActionMapper
;
import
org.matrix.autotest.entity.Action
;
import
org.matrix.autotest.service.ActionService
;
import
org.springframework.stereotype.Service
;
import
java.util.List
;
/**
* <p>
* 动作 服务实现类
...
...
@@ -20,49 +17,4 @@ import java.util.List;
@Service
public
class
ActionServiceImpl
extends
ServiceImpl
<
ActionMapper
,
Action
>
implements
ActionService
{
private
final
ActionMapper
actionMapper
;
public
ActionServiceImpl
(
ActionMapper
actionMapper
)
{
this
.
actionMapper
=
actionMapper
;
}
@Override
public
List
<
Action
>
findAllAction
()
{
return
actionMapper
.
selectList
(
null
);
}
@Override
public
Action
findByIdAction
(
Integer
id
)
{
return
actionMapper
.
selectById
(
id
);
}
@Override
public
int
insertAction
(
Action
action
)
{
return
actionMapper
.
insert
(
action
);
}
@Override
public
int
updateAction
(
Action
action
)
{
return
actionMapper
.
updateById
(
action
);
}
@Override
public
int
deleteAction
(
Integer
id
)
{
return
actionMapper
.
deleteById
(
id
);
}
@Override
public
List
<
Action
>
findByProjectIdAction
(
Integer
projectId
)
{
QueryWrapper
<
Action
>
queryWrapper
=
new
QueryWrapper
<>();
queryWrapper
.
eq
(
"project_id"
,
projectId
);
return
actionMapper
.
selectList
(
queryWrapper
);
}
@Override
public
List
<
Action
>
findByMoveIdAction
(
Integer
moveId
)
{
QueryWrapper
<
Action
>
queryWrapper
=
new
QueryWrapper
<>();
queryWrapper
.
eq
(
"move_id"
,
moveId
);
return
actionMapper
.
selectList
(
queryWrapper
);
}
}
src/main/java/org/matrix/autotest/service/Impl/ConnectServiceImpl.java
浏览文件 @
bb674b98
package
org
.
matrix
.
autotest
.
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.autotest.dao.ConnectMapper
;
import
org.matrix.autotest.entity.Connect
;
import
org.matrix.autotest.entity.TestCase
;
import
org.matrix.autotest.service.ConnectService
;
import
org.matrix.autotest.vo.PageResult
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.StringUtils
;
import
java.util.List
;
...
...
@@ -25,16 +31,6 @@ public class ConnectServiceImpl extends ServiceImpl<ConnectMapper, Connect> impl
this
.
connectMapper
=
connectMapper
;
}
@Override
public
List
<
Connect
>
findAllConnect
()
{
return
connectMapper
.
selectList
(
null
);
}
@Override
public
Connect
findByIdConnect
(
Integer
id
)
{
return
connectMapper
.
selectById
(
id
);
}
@Override
public
int
insertConnect
(
Connect
connect
)
{
return
connectMapper
.
insert
(
connect
);
...
...
@@ -50,4 +46,18 @@ public class ConnectServiceImpl extends ServiceImpl<ConnectMapper, Connect> impl
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
<
TestCase
>
rows
=
ipage
.
getRecords
();
//回传5个参数 total/分页后的数据
return
pageResult
.
setTotal
(
total
).
setRows
(
rows
);
}
}
src/main/java/org/matrix/autotest/service/Impl/DynamicVariableServiceImpl.java
浏览文件 @
bb674b98
package
org
.
matrix
.
autotest
.
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.autotest.dao.DynamicVariableMapper
;
import
org.matrix.autotest.entity.DynamicVariable
;
import
org.matrix.autotest.entity.TestCase
;
import
org.matrix.autotest.service.DynamicVariableService
;
import
org.matrix.autotest.vo.PageResult
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.StringUtils
;
import
java.util.List
;
...
...
@@ -26,17 +31,6 @@ public class DynamicVariableServiceImpl extends ServiceImpl<DynamicVariableMappe
this
.
dynamicVariableMapper
=
dynamicVariableMapper
;
}
@Override
public
List
<
DynamicVariable
>
findAllDynamicVariable
()
{
return
dynamicVariableMapper
.
selectList
(
null
);
}
@Override
public
DynamicVariable
findByIdDynamicVariable
(
Integer
id
)
{
return
dynamicVariableMapper
.
selectById
(
id
);
}
@Override
public
int
insertDynamicVariable
(
DynamicVariable
dynamicVariable
)
{
return
dynamicVariableMapper
.
insert
(
dynamicVariable
);
...
...
@@ -59,4 +53,18 @@ public class DynamicVariableServiceImpl extends ServiceImpl<DynamicVariableMappe
return
dynamicVariableMapper
.
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
=
dynamicVariableMapper
.
selectPage
(
ipage
,
queryWrapper
);
long
total
=
ipage
.
getTotal
();
List
<
TestCase
>
rows
=
ipage
.
getRecords
();
//回传5个参数 total/分页后的数据
return
pageResult
.
setTotal
(
total
).
setRows
(
rows
);
}
}
src/main/java/org/matrix/autotest/service/Impl/EnvironmentServiceImpl.java
浏览文件 @
bb674b98
package
org
.
matrix
.
autotest
.
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.autotest.dao.EnvironmentMapper
;
import
org.matrix.autotest.entity.Environment
;
import
org.matrix.autotest.entity.TestCase
;
import
org.matrix.autotest.service.EnvironmentService
;
import
org.matrix.autotest.vo.PageResult
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.StringUtils
;
import
java.util.List
;
...
...
@@ -26,16 +31,6 @@ public class EnvironmentServiceImpl extends ServiceImpl<EnvironmentMapper, Envir
this
.
environmentMapper
=
environmentMapper
;
}
@Override
public
List
<
Environment
>
findAllEnvironment
()
{
return
environmentMapper
.
selectList
(
null
);
}
@Override
public
Environment
findByIdEnvironment
(
Integer
id
)
{
return
environmentMapper
.
selectById
(
id
);
}
@Override
public
int
insertEnvironment
(
Environment
environment
)
{
return
environmentMapper
.
insert
(
environment
);
...
...
@@ -58,4 +53,18 @@ public class EnvironmentServiceImpl extends ServiceImpl<EnvironmentMapper, Envir
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
<
TestCase
>
rows
=
ipage
.
getRecords
();
//回传5个参数 total/分页后的数据
return
pageResult
.
setTotal
(
total
).
setRows
(
rows
);
}
}
src/main/java/org/matrix/autotest/service/Impl/MoveServiceImpl.java
浏览文件 @
bb674b98
package
org
.
matrix
.
autotest
.
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.autotest.dao.MoveMapper
;
import
org.matrix.autotest.entity.Move
;
import
org.matrix.autotest.entity.TestCase
;
import
org.matrix.autotest.service.MoveService
;
import
org.matrix.autotest.vo.PageResult
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.StringUtils
;
import
java.util.List
;
...
...
@@ -27,35 +32,16 @@ public class MoveServiceImpl extends ServiceImpl<MoveMapper, Move> implements Mo
}
@Override
public
List
<
Move
>
findAllMove
()
{
return
moveMapper
.
selectList
(
null
);
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
<
TestCase
>
rows
=
ipage
.
getRecords
();
//回传5个参数 total/分页后的数据
return
pageResult
.
setTotal
(
total
).
setRows
(
rows
);
}
@Override
public
Move
findByIdMove
(
Integer
id
)
{
return
moveMapper
.
selectById
(
id
);
}
@Override
public
int
insertMove
(
Move
move
)
{
return
moveMapper
.
insert
(
move
);
}
@Override
public
int
updateMove
(
Move
move
)
{
return
moveMapper
.
updateById
(
move
);
}
@Override
public
int
deleteMove
(
Integer
id
)
{
return
moveMapper
.
deleteById
(
id
);
}
@Override
public
List
<
Move
>
findByProjectIdMove
(
Integer
projectId
)
{
QueryWrapper
<
Move
>
queryWrapper
=
new
QueryWrapper
<>();
queryWrapper
.
eq
(
"project_id"
,
projectId
);
return
moveMapper
.
selectList
(
queryWrapper
);
}
}
src/main/java/org/matrix/autotest/service/Impl/ProjectServiceImpl.java
浏览文件 @
bb674b98
...
...
@@ -30,11 +30,6 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
return
projectMapper
.
selectList
(
null
);
}
@Override
public
Project
findByIdProject
(
Integer
id
)
{
return
projectMapper
.
selectById
(
id
);
}
@Override
public
int
insertProject
(
Project
project
)
{
return
projectMapper
.
insert
(
project
);
...
...
src/main/java/org/matrix/autotest/service/Impl/TestCaseServiceImpl.java
浏览文件 @
bb674b98
package
org
.
matrix
.
autotest
.
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.autotest.dao.TestCaseMapper
;
import
org.matrix.autotest.entity.TestCase
;
import
org.matrix.autotest.service.TestCaseService
;
import
org.matrix.autotest.vo.PageResult
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.StringUtils
;
import
java.util.List
;
...
...
@@ -26,16 +30,6 @@ public class TestCaseServiceImpl extends ServiceImpl<TestCaseMapper, TestCase> i
this
.
testCaseMapper
=
testCaseMapper
;
}
@Override
public
List
<
TestCase
>
findAllTestCase
()
{
return
testCaseMapper
.
selectList
(
null
);
}
@Override
public
TestCase
findByIdTestCase
(
Integer
id
)
{
return
testCaseMapper
.
selectById
(
id
);
}
@Override
public
int
insertTestCase
(
TestCase
testCase
)
{
return
testCaseMapper
.
insert
(
testCase
);
...
...
@@ -58,4 +52,18 @@ public class TestCaseServiceImpl extends ServiceImpl<TestCaseMapper, TestCase> i
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
);
}
}
src/main/java/org/matrix/autotest/service/MoveService.java
浏览文件 @
bb674b98
...
...
@@ -2,6 +2,8 @@ package org.matrix.autotest.service;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
org.matrix.autotest.entity.Move
;
import
org.matrix.autotest.vo.MoveAction
;
import
org.matrix.autotest.vo.PageResult
;
import
java.util.List
;
...
...
@@ -14,51 +16,6 @@ import java.util.List;
* @since 2022-01-07
*/
public
interface
MoveService
extends
IService
<
Move
>
{
/**
* 查询所有行为
*
* @return 查询到的所有行为
*/
List
<
Move
>
findAllMove
();
/**
* 根据id查询行为
*
* @param id 行为id
* @return 行为
*/
Move
findByIdMove
(
Integer
id
);
/**
* 添加行为
*
* @param move 行为
* @return 影响行数
*/
int
insertMove
(
Move
move
);
/**
* 修改行为
*
* @param move 行为
* @return 影响行数
*/
int
updateMove
(
Move
move
);
/**
* 删除行为
*
* @param id 行为id
* @return 影响行数
*/
int
deleteMove
(
Integer
id
);
/**
* 根据项目id查询动作
*
* @param projectId 项目id
* @return 符合项目id的动作
*/
List
<
Move
>
findByProjectIdMove
(
Integer
projectId
);
PageResult
pageAll
(
PageResult
pageResult
);
}
src/main/java/org/matrix/autotest/service/ProjectService.java
浏览文件 @
bb674b98
...
...
@@ -21,14 +21,6 @@ public interface ProjectService extends IService<Project> {
*/
List
<
Project
>
findAllProject
();
/**
* 根据id查询项目
*
* @param id 项目id
* @return 项目
*/
Project
findByIdProject
(
Integer
id
);
/**
* 添加项目
*
...
...
src/main/java/org/matrix/autotest/service/TestCaseService.java
浏览文件 @
bb674b98
...
...
@@ -2,6 +2,7 @@ package org.matrix.autotest.service;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
org.matrix.autotest.entity.TestCase
;
import
org.matrix.autotest.vo.PageResult
;
import
java.util.List
;
...
...
@@ -14,20 +15,6 @@ import java.util.List;
* @since 2022-01-07
*/
public
interface
TestCaseService
extends
IService
<
TestCase
>
{
/**
* 查询所有用例
*
* @return 查询到的所有用例
*/
List
<
TestCase
>
findAllTestCase
();
/**
* 根据id查询用例
*
* @param id 用例Id
* @return 用例
*/
TestCase
findByIdTestCase
(
Integer
id
);
/**
* 添加用例
...
...
@@ -61,4 +48,5 @@ public interface TestCaseService extends IService<TestCase> {
*/
List
<
TestCase
>
findByProjectIdTestCase
(
Integer
projectId
);
PageResult
pageAll
(
PageResult
pageResult
);
}
src/main/java/org/matrix/autotest/vo/MoveAction.java
0 → 100644
浏览文件 @
bb674b98
package
org
.
matrix
.
autotest
.
vo
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
lombok.experimental.Accessors
;
import
org.matrix.autotest.entity.Action
;
import
org.matrix.autotest.entity.Move
;
import
java.util.List
;
/**
* @author mry
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Accessors
(
chain
=
true
)
public
class
MoveAction
{
private
Move
move
;
private
List
<
Action
>
action
;
}
src/main/java/org/matrix/autotest/vo/PageResult.java
0 → 100644
浏览文件 @
bb674b98
package
org
.
matrix
.
autotest
.
vo
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
lombok.experimental.Accessors
;
/**
* @author mry
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@Accessors
(
chain
=
true
)
public
class
PageResult
{
/**
* 用户查询的数据
*/
private
String
query
;
/**
* 查询页数
*/
private
Integer
pageNum
;
/**
* 查询条数
*/
private
Integer
pageSize
;
/**
* 查询总记录数
*/
private
Long
total
;
/**
* 分页查询的结果
*/
private
Object
rows
;
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论