Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MeterSphere
metersphere
提交
8f43deaf
M
metersphere
项目概览
MeterSphere
/
metersphere
上一次同步 大约 3 年
通知
25
Star
1
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
metersphere
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
8f43deaf
编写于
5月 25, 2021
作者:
C
chenjianxing
提交者:
jianxing
5月 25, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor: 测试用例模块树加载优化
上级
6c329d3f
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
57 addition
and
51 deletion
+57
-51
backend/src/main/java/io/metersphere/api/service/ApiModuleService.java
...ain/java/io/metersphere/api/service/ApiModuleService.java
+1
-6
backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiDefinitionMapper.java
...o/metersphere/base/mapper/ext/ExtApiDefinitionMapper.java
+3
-1
backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiDefinitionMapper.xml
...io/metersphere/base/mapper/ext/ExtApiDefinitionMapper.xml
+53
-44
未找到文件。
backend/src/main/java/io/metersphere/api/service/ApiModuleService.java
浏览文件 @
8f43deaf
...
...
@@ -93,16 +93,11 @@ public class ApiModuleService extends NodeTreeService<ApiModuleDTO> {
moduleIds
=
this
.
nodeList
(
apiModules
,
node
.
getId
(),
moduleIds
);
moduleIds
.
add
(
node
.
getId
());
request
.
setModuleIds
(
moduleIds
);
int
num
=
this
.
getCaseNum
(
request
);
node
.
setCaseNum
(
num
);
node
.
setCaseNum
(
extApiDefinitionMapper
.
moduleCount
(
request
));
});
return
getNodeTrees
(
apiModules
);
}
private
int
getCaseNum
(
ApiDefinitionRequest
request
)
{
return
extApiDefinitionMapper
.
list
(
request
).
size
();
}
public
static
List
<
String
>
nodeList
(
List
<
ApiModuleDTO
>
apiNodes
,
String
pid
,
List
<
String
>
list
)
{
for
(
ApiModuleDTO
node
:
apiNodes
)
{
//遍历出父id等于参数的id,add进子节点集合
...
...
backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiDefinitionMapper.java
浏览文件 @
8f43deaf
...
...
@@ -17,6 +17,8 @@ public interface ExtApiDefinitionMapper {
List
<
ApiDefinitionResult
>
list
(
@Param
(
"request"
)
ApiDefinitionRequest
request
);
int
moduleCount
(
@Param
(
"request"
)
ApiDefinitionRequest
request
);
//List<ApiComputeResult> selectByIds(@Param("ids") List<String> ids);
List
<
ApiComputeResult
>
selectByIds
(
@Param
(
"ids"
)
List
<
String
>
ids
,
@Param
(
"projectId"
)
String
projectId
);
...
...
@@ -46,4 +48,4 @@ public interface ExtApiDefinitionMapper {
List
<
ApiDefinition
>
selectEffectiveIdByProjectId
(
String
projectId
);
List
<
ApiDefinitionResult
>
listByIds
(
@Param
(
"ids"
)
List
<
String
>
ids
);
}
\ No newline at end of file
}
backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiDefinitionMapper.xml
浏览文件 @
8f43deaf
...
...
@@ -487,6 +487,40 @@
WHERE project_id = #{0} AND status != 'Trash' AND protocol = 'HTTP'
</select>
<select
id=
"moduleCount"
resultType=
"java.lang.Integer"
>
select count(id) from api_definition
<include
refid=
"queryWhereCondition"
/>
</select>
<sql
id=
"filter"
>
<if
test=
"request.filters != null and request.filters.size() > 0"
>
<foreach
collection=
"request.filters.entrySet()"
index=
"key"
item=
"values"
>
<if
test=
"values != null and values.size() > 0"
>
<choose>
<when
test=
"key=='status'"
>
and api_definition.status in
<foreach
collection=
"values"
item=
"value"
separator=
","
open=
"("
close=
")"
>
#{value}
</foreach>
</when>
<when
test=
"key=='method'"
>
and api_definition.method in
<foreach
collection=
"values"
item=
"value"
separator=
","
open=
"("
close=
")"
>
#{value}
</foreach>
</when>
<when
test=
"key=='user_id'"
>
and api_definition.user_id in
<foreach
collection=
"values"
item=
"value"
separator=
","
open=
"("
close=
")"
>
#{value}
</foreach>
</when>
</choose>
</if>
</foreach>
</if>
</sql>
<sql
id=
"queryWhereCondition"
>
<where>
<if
test=
"request.combine != null"
>
...
...
@@ -504,12 +538,6 @@
<if
test=
"request.protocol != null"
>
AND api_definition.protocol = #{request.protocol}
</if>
<if
test=
"request.workspaceId != null"
>
AND project.workspace_id = #{request.workspaceId}
</if>
<if
test=
"request.projectId != null"
>
AND project.id = #{request.projectId}
</if>
<if
test=
"request.id != null"
>
AND api_definition.id = #{request.id}
</if>
...
...
@@ -522,41 +550,24 @@
<if
test=
"request.moduleId != null"
>
AND api_definition.module_id = #{request.moduleId}
</if>
<if
test=
"request.projectId != null"
>
AND api_definition.project_id = #{request.projectId}
</if>
<if
test=
"request.moduleIds != null and request.moduleIds.size() > 0"
>
AND api_definition.module_id in
<foreach
collection=
"request.moduleIds"
item=
"nodeId"
separator=
","
open=
"("
close=
")"
>
#{nodeId}
</foreach>
</if>
<if
test=
"request.filters != null and request.filters.size() > 0"
>
<foreach
collection=
"request.filters.entrySet()"
index=
"key"
item=
"values"
>
<if
test=
"values != null and values.size() > 0"
>
<choose>
<when
test=
"key=='status'"
>
and api_definition.status in
<foreach
collection=
"values"
item=
"value"
separator=
","
open=
"("
close=
")"
>
#{value}
</foreach>
</when>
<when
test=
"key=='method'"
>
and api_definition.method in
<foreach
collection=
"values"
item=
"value"
separator=
","
open=
"("
close=
")"
>
#{value}
</foreach>
</when>
<when
test=
"key=='user_id'"
>
and api_definition.user_id in
<foreach
collection=
"values"
item=
"value"
separator=
","
open=
"("
close=
")"
>
#{value}
</foreach>
</when>
</choose>
</if>
</foreach>
</if>
<choose>
<when
test=
"request.moduleIds != null and request.moduleIds.size() > 0"
>
AND api_definition.module_id in
<foreach
collection=
"request.moduleIds"
item=
"nodeId"
separator=
","
open=
"("
close=
")"
>
#{nodeId}
</foreach>
</when>
<when
test=
"request.projectId != null"
>
AND api_definition.project_id = #{request.projectId}
</when>
<when
test=
"request.projectId != null"
>
AND project.id = #{request.projectId}
</when>
<when
test=
"request.workspaceId != null"
>
AND project.workspace_id = #{request.workspaceId}
</when>
</choose>
<include
refid=
"filter"
/>
<if
test=
"request.apiCaseCoverage == 'uncoverage' "
>
and api_definition.id not in
(SELECT api_definition_id FROM api_test_case)
...
...
@@ -565,8 +576,6 @@
and api_definition.id in
(SELECT api_definition_id FROM api_test_case)
</if>
</where>
</sql>
</mapper>
\ No newline at end of file
</mapper>
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录