fix(测试跟踪): 功能用例-公用用例模块展示问题优化
--bug=1013830 --user=宋昌昌 【测试跟踪】切换到公共用例模块 左侧模块列表未展开;加载响应时间需要优化 https://www.tapd.cn/55049933/s/1184061
This commit is contained in:
parent
40609eb8f9
commit
12257242bc
|
@ -26,6 +26,8 @@ public interface ExtTestCaseMapper {
|
|||
|
||||
int moduleCount(@Param("request") QueryTestCaseRequest request);
|
||||
|
||||
List<String> getPublicProjectIdByWorkSpaceId(@Param("request") QueryTestCaseRequest request);
|
||||
|
||||
List<TestCaseDTO> listByMethod(@Param("request") QueryTestCaseRequest request);
|
||||
|
||||
List<TestCaseDTO> listByTestCaseIds(@Param("request") TestCaseBatchRequest request);
|
||||
|
|
|
@ -261,68 +261,19 @@
|
|||
project on test_case.project_id = project.id
|
||||
left join project_version on project.id = project_version.project_id and project_version.id =
|
||||
test_case.version_id
|
||||
<where>
|
||||
<include refid="filters"/>
|
||||
<if test="request.combine != null">
|
||||
<include refid="combine">
|
||||
<property name="condition" value="request.combine"/>
|
||||
<property name="name" value="request.name"/>
|
||||
<property name="objectKey" value="request.combine.tags"/>
|
||||
</include>
|
||||
</if>
|
||||
|
||||
<if test="request.statusIsNot != null">
|
||||
and (test_case.status is null or test_case.status != #{request.statusIsNot})
|
||||
</if>
|
||||
|
||||
<if test="request.notEqStatus != null">
|
||||
and (test_case.status is null or test_case.status != #{request.notEqStatus})
|
||||
</if>
|
||||
<if test="request.name != null">
|
||||
and (test_case.name like CONCAT('%', #{request.name},'%')
|
||||
or test_case.num like CONCAT('%', #{request.name},'%')
|
||||
or test_case.tags like CONCAT('%', #{request.name},'%')
|
||||
or test_case.custom_num like CONCAT('%', #{request.name},'%'))
|
||||
</if>
|
||||
<if test="request.ids != null">
|
||||
and test_case.id in
|
||||
<foreach collection="request.ids" item="id" separator="," open="(" close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="request.relevanceCreateTime >0">
|
||||
and test_case.id in (select test_case_id from test_case_test where test_case_test.create_time >=
|
||||
#{request.createTime})
|
||||
</if>
|
||||
<if test="request.createTime >0">
|
||||
and test_case.create_time >= #{request.createTime}
|
||||
</if>
|
||||
<if test="request.nodeIds != null and request.nodeIds.size() > 0">
|
||||
and test_case.node_id in
|
||||
<foreach collection="request.nodeIds" item="nodeId" separator="," open="(" close=")">
|
||||
#{nodeId}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="request.workspaceId != null">
|
||||
AND test_case.project_id in (select id from project where workspace_id=#{request.workspaceId})
|
||||
</if>
|
||||
and test_case.case_public = TRUE
|
||||
<include refid="filters"/>
|
||||
<if test="request.caseCoverage == 'uncoverage' ">
|
||||
and test_case.id not in (select distinct test_case_test.test_case_id from test_case_test)
|
||||
</if>
|
||||
<if test="request.caseCoverage == 'coverage' ">
|
||||
and test_case.id in (select distinct test_case_test.test_case_id from test_case_test)
|
||||
</if>
|
||||
<include refid="queryVersionCondition">
|
||||
<property name="versionTable" value="test_case"/>
|
||||
</include>
|
||||
</where>
|
||||
|
||||
<include refid="queryPublicCaseWhere"></include>
|
||||
<include refid="io.metersphere.base.mapper.ext.ExtBaseMapper.orders"/>
|
||||
|
||||
</select>
|
||||
|
||||
<select id="getPublicProjectIdByWorkSpaceId" resultType="java.lang.String">
|
||||
select
|
||||
distinct test_case.project_id
|
||||
from test_case
|
||||
<include refid="queryPublicCaseWhere"></include>
|
||||
<include refid="io.metersphere.base.mapper.ext.ExtBaseMapper.orders"/>
|
||||
</select>
|
||||
|
||||
<select id="moduleCount" resultType="java.lang.Integer">
|
||||
select count(test_case.id) from test_case
|
||||
left join project on test_case.project_id = project.id
|
||||
|
@ -487,6 +438,66 @@
|
|||
<include refid="io.metersphere.base.mapper.ext.ExtBaseMapper.orders"/>
|
||||
</select>
|
||||
|
||||
<sql id="queryPublicCaseWhere">
|
||||
<where>
|
||||
<include refid="filters"/>
|
||||
<if test="request.combine != null">
|
||||
<include refid="combine">
|
||||
<property name="condition" value="request.combine"/>
|
||||
<property name="name" value="request.name"/>
|
||||
<property name="objectKey" value="request.combine.tags"/>
|
||||
</include>
|
||||
</if>
|
||||
|
||||
<if test="request.statusIsNot != null">
|
||||
and (test_case.status is null or test_case.status != #{request.statusIsNot})
|
||||
</if>
|
||||
|
||||
<if test="request.notEqStatus != null">
|
||||
and (test_case.status is null or test_case.status != #{request.notEqStatus})
|
||||
</if>
|
||||
<if test="request.name != null">
|
||||
and (test_case.name like CONCAT('%', #{request.name},'%')
|
||||
or test_case.num like CONCAT('%', #{request.name},'%')
|
||||
or test_case.tags like CONCAT('%', #{request.name},'%')
|
||||
or test_case.custom_num like CONCAT('%', #{request.name},'%'))
|
||||
</if>
|
||||
<if test="request.ids != null">
|
||||
and test_case.id in
|
||||
<foreach collection="request.ids" item="id" separator="," open="(" close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="request.relevanceCreateTime >0">
|
||||
and test_case.id in (select test_case_id from test_case_test where test_case_test.create_time >=
|
||||
#{request.createTime})
|
||||
</if>
|
||||
<if test="request.createTime >0">
|
||||
and test_case.create_time >= #{request.createTime}
|
||||
</if>
|
||||
<if test="request.nodeIds != null and request.nodeIds.size() > 0">
|
||||
and test_case.node_id in
|
||||
<foreach collection="request.nodeIds" item="nodeId" separator="," open="(" close=")">
|
||||
#{nodeId}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="request.workspaceId != null">
|
||||
AND test_case.project_id in (select id from project where workspace_id=#{request.workspaceId})
|
||||
</if>
|
||||
and test_case.case_public = TRUE
|
||||
<include refid="filters"/>
|
||||
<if test="request.caseCoverage == 'uncoverage' ">
|
||||
and test_case.id not in (select distinct test_case_test.test_case_id from test_case_test)
|
||||
</if>
|
||||
<if test="request.caseCoverage == 'coverage' ">
|
||||
and test_case.id in (select distinct test_case_test.test_case_id from test_case_test)
|
||||
</if>
|
||||
<include refid="queryVersionCondition">
|
||||
<property name="versionTable" value="test_case"/>
|
||||
</include>
|
||||
</where>
|
||||
</sql>
|
||||
|
||||
<sql id="filters">
|
||||
<if test="request.filters != null and request.filters.size() > 0">
|
||||
<foreach collection="request.filters.entrySet()" index="key" item="values">
|
||||
|
|
|
@ -309,23 +309,16 @@ public class TestCaseNodeService extends NodeTreeService<TestCaseNodeDTO> {
|
|||
return getNodeTreeWithPruningTree(projectNodeMap);
|
||||
}
|
||||
|
||||
public List<TestCaseNodeDTO> getNodeByTestCases(List<TestCaseDTO> testCaseDTOS) {
|
||||
Map<String, List<String>> projectNodeMap = new HashMap<>();
|
||||
for (TestCase testCase : testCaseDTOS) {
|
||||
List<String> nodeIds = Optional.ofNullable(projectNodeMap.get(testCase.getProjectId())).orElse(new ArrayList<>());
|
||||
nodeIds.add(testCase.getNodeId());
|
||||
projectNodeMap.put(testCase.getProjectId(), nodeIds);
|
||||
}
|
||||
List<TestCaseNodeDTO> tree = getNodeTreeWithPruningTree(projectNodeMap);
|
||||
public List<TestCaseNodeDTO> getPublicNodeByProjectNode(List<TestCaseNodeDTO> projectNodes) {
|
||||
QueryTestCaseRequest request = new QueryTestCaseRequest();
|
||||
request.setCasePublic(true);
|
||||
for (TestCaseNodeDTO dto : tree) {
|
||||
for (TestCaseNodeDTO dto : projectNodes) {
|
||||
List<TestCaseNodeDTO> children = this.getNodeTreeByProjectId(dto.getId(), request);
|
||||
dto.setChildren(children);
|
||||
int sum = children.stream().mapToInt(TestCaseNodeDTO::getCaseNum).sum();
|
||||
dto.setCaseNum(sum);
|
||||
}
|
||||
return tree;
|
||||
return projectNodes;
|
||||
}
|
||||
|
||||
public List<TestCaseNodeDTO> getNodeByReviewId(String reviewId) {
|
||||
|
|
|
@ -2747,8 +2747,27 @@ public class TestCaseService {
|
|||
}
|
||||
|
||||
public List<TestCaseNodeDTO> getPublicCaseNode(QueryTestCaseRequest request) {
|
||||
List<TestCaseDTO> testCaseDTOS = publicListTestCase(request);
|
||||
return testCaseNodeService.getNodeByTestCases(testCaseDTOS);
|
||||
List<TestCaseNodeDTO> testCaseDTOS = publicProjectNode(request);
|
||||
return testCaseNodeService.getPublicNodeByProjectNode(testCaseDTOS);
|
||||
}
|
||||
|
||||
public List<TestCaseNodeDTO> publicProjectNode(QueryTestCaseRequest request) {
|
||||
this.initRequest(request, true);
|
||||
setDefaultOrder(request);
|
||||
if (request.getFilters() != null && !request.getFilters().containsKey("status")) {
|
||||
request.getFilters().put("status", new ArrayList<>(0));
|
||||
}
|
||||
List<TestCaseNodeDTO> testCaseNodeDTOList = new ArrayList<>();
|
||||
List<String> publicProjectIds = extTestCaseMapper.getPublicProjectIdByWorkSpaceId(request);
|
||||
publicProjectIds.forEach(projectId -> {
|
||||
Project project = projectMapper.selectByPrimaryKey(projectId);
|
||||
TestCaseNodeDTO testCaseNodeDTO = new TestCaseNodeDTO();
|
||||
testCaseNodeDTO.setName(project.getName());
|
||||
testCaseNodeDTO.setLabel(project.getName());
|
||||
testCaseNodeDTO.setId(projectId);
|
||||
testCaseNodeDTOList.add(testCaseNodeDTO);
|
||||
});
|
||||
return testCaseNodeDTOList;
|
||||
}
|
||||
|
||||
public void saveRelationshipBatch(TestCaseRelationshipEdgeRequest request) {
|
||||
|
|
|
@ -329,6 +329,9 @@ export default {
|
|||
this.activeName = 'public';
|
||||
this.result = this.$post('/test/case/public/case/node', {workspaceId: getCurrentWorkspaceId()}, res => {
|
||||
this.publicTreeNodes = res.data;
|
||||
this.publicTreeNodes.forEach(firstLevel => {
|
||||
this.$refs.publicNodeTree.nodeExpand(firstLevel);
|
||||
})
|
||||
})
|
||||
} else {
|
||||
this.activeName = 'default';
|
||||
|
|
Loading…
Reference in New Issue