fix(测试跟踪): 公共用例库版本筛选问题
--bug=1023493 --user=宋昌昌 【测试跟踪】公共用例库,版本筛选结果不全 https://www.tapd.cn/55049933/s/1343956
This commit is contained in:
parent
f17a628381
commit
338a7c44d8
|
@ -300,9 +300,9 @@
|
|||
</if>
|
||||
from test_case
|
||||
inner join project on test_case.project_id = project.id and workspace_id = #{request.workspaceId}
|
||||
inner join project_version ON test_case.version_id = project_version.id
|
||||
<include refid="queryPublicCaseWhere"></include>
|
||||
<include refid="io.metersphere.base.mapper.ext.ExtBaseMapper.orders"/>
|
||||
|
||||
</select>
|
||||
|
||||
<select id="getPublicProjectIdByWorkSpaceId" resultType="java.lang.String">
|
||||
|
@ -519,7 +519,6 @@
|
|||
</foreach>
|
||||
</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>
|
||||
|
@ -565,6 +564,10 @@
|
|||
and test_case.version_id in
|
||||
<include refid="io.metersphere.base.mapper.ext.ExtBaseMapper.filterInWrapper"/>
|
||||
</when>
|
||||
<when test="key == 'version_name'">
|
||||
and project_version.name in
|
||||
<include refid="io.metersphere.base.mapper.ext.ExtBaseMapper.filterInWrapper"/>
|
||||
</when>
|
||||
<when test="key=='maintainer'">
|
||||
and test_case.maintainer in
|
||||
<include refid="io.metersphere.base.mapper.ext.ExtBaseMapper.filterInWrapper"/>
|
||||
|
@ -1170,14 +1173,13 @@
|
|||
ORDER BY update_time DESC limit 1;
|
||||
</select>
|
||||
<select id="countByWorkSpaceId" resultType="java.lang.Integer">
|
||||
select count(distinct ref_id)
|
||||
select count(ref_id)
|
||||
from test_case
|
||||
where project_id in (select id
|
||||
from project
|
||||
where workspace_id = #{workSpaceId})
|
||||
and case_public = true
|
||||
and test_case.status != 'Trash'
|
||||
and test_case.latest = 1
|
||||
</select>
|
||||
|
||||
<select id="trashCount" resultType="java.lang.Long">
|
||||
|
@ -1410,6 +1412,7 @@
|
|||
from test_case
|
||||
left join test_case_node tcn on test_case.node_id = tcn.id
|
||||
inner join project p on p.id = test_case.project_id
|
||||
inner join project_version ON test_case.version_id = project_version.id
|
||||
<include refid="queryWhereCondition"/>
|
||||
and p.workspace_id = #{request.workspaceId}
|
||||
group by tcn.id;
|
||||
|
|
|
@ -65,6 +65,7 @@ public class TestCaseController {
|
|||
@PostMapping("/public/list/{goPage}/{pageSize}")
|
||||
@RequiresPermissions(PermissionConstants.PROJECT_TRACK_CASE_READ)
|
||||
public Pager<List<TestCaseDTO>> publicList(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody QueryTestCaseRequest request) {
|
||||
testCaseService.setPublicListRequestParam(request);
|
||||
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
|
||||
return PageUtils.setPageInfo(page, testCaseService.publicListTestCase(request));
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ package io.metersphere.service;
|
|||
import com.google.common.util.concurrent.AtomicDouble;
|
||||
import io.metersphere.base.domain.*;
|
||||
import io.metersphere.base.mapper.ProjectMapper;
|
||||
import io.metersphere.base.mapper.ProjectVersionMapper;
|
||||
import io.metersphere.base.mapper.TestCaseMapper;
|
||||
import io.metersphere.base.mapper.TestCaseNodeMapper;
|
||||
import io.metersphere.base.mapper.ext.ExtTestCaseMapper;
|
||||
|
@ -63,6 +64,8 @@ public class TestCaseNodeService extends NodeTreeService<TestCaseNodeDTO> {
|
|||
@Resource
|
||||
ProjectMapper projectMapper;
|
||||
@Resource
|
||||
ProjectVersionMapper projectVersionMapper;
|
||||
@Resource
|
||||
ExtTestReviewCaseMapper extTestReviewCaseMapper;
|
||||
@Resource
|
||||
TestPlanProjectService testPlanProjectService;
|
||||
|
@ -277,6 +280,16 @@ public class TestCaseNodeService extends NodeTreeService<TestCaseNodeDTO> {
|
|||
request.setWorkspaceId(workspaceId);
|
||||
request.setProjectId(null);
|
||||
request.setNodeIds(null);
|
||||
// 保留: 后续若需要根据列表版本筛选的话, version_id => version_name
|
||||
List<String> versionIds = request.getFilters().get("version_id");
|
||||
if (!CollectionUtils.isEmpty(versionIds)) {
|
||||
ProjectVersionExample versionExample = new ProjectVersionExample();
|
||||
versionExample.createCriteria().andIdIn(versionIds);
|
||||
List<ProjectVersion> versions = projectVersionMapper.selectByExample(versionExample);
|
||||
List<String> versionNames = versions.stream().map(ProjectVersion::getName).distinct().collect(Collectors.toList());
|
||||
request.getFilters().put("version_name", versionNames);
|
||||
request.getFilters().put("version_id", Collections.emptyList());
|
||||
}
|
||||
ServiceUtils.setBaseQueryRequestCustomMultipleFields(request);
|
||||
List<TestCaseNodeDTO> countModules = extTestCaseMapper.getWorkspaceCountNodes(request);
|
||||
return getNodeTreeWithPruningTree(countModules);
|
||||
|
|
|
@ -846,7 +846,7 @@ public class TestCaseService {
|
|||
});
|
||||
}
|
||||
|
||||
public List<TestCaseDTO> publicListTestCase(QueryTestCaseRequest request) {
|
||||
public void setPublicListRequestParam(QueryTestCaseRequest request) {
|
||||
this.initRequest(request, true);
|
||||
setDefaultOrder(request);
|
||||
if (request.getFilters() != null && !request.getFilters().containsKey("status")) {
|
||||
|
@ -856,7 +856,20 @@ public class TestCaseService {
|
|||
MSException.throwException("workspaceId could not be null!");
|
||||
}
|
||||
request.setProjectId(null);
|
||||
// 保留: 后续若需要根据列表版本筛选的话, version_id => version_name
|
||||
List<String> versionIds = request.getFilters().get("version_id");
|
||||
if (CollectionUtils.isNotEmpty(versionIds)) {
|
||||
ProjectVersionExample versionExample = new ProjectVersionExample();
|
||||
versionExample.createCriteria().andIdIn(versionIds);
|
||||
List<ProjectVersion> versions = projectVersionMapper.selectByExample(versionExample);
|
||||
List<String> versionNames = versions.stream().map(ProjectVersion::getName).distinct().collect(Collectors.toList());
|
||||
request.getFilters().put("version_name", versionNames);
|
||||
request.getFilters().put("version_id", Collections.emptyList());
|
||||
}
|
||||
ServiceUtils.setBaseQueryRequestCustomMultipleFields(request);
|
||||
}
|
||||
|
||||
public List<TestCaseDTO> publicListTestCase(QueryTestCaseRequest request) {
|
||||
List<TestCaseDTO> returnList = extTestCaseMapper.publicList(request);
|
||||
ServiceUtils.buildProjectInfo(returnList);
|
||||
buildUserInfo(returnList);
|
||||
|
|
|
@ -161,7 +161,6 @@
|
|||
</ms-table-column>
|
||||
|
||||
<ms-table-column
|
||||
:filters="versionFilters"
|
||||
v-if="versionEnable"
|
||||
:label="$t('project.version.name')"
|
||||
:field="item"
|
||||
|
@ -427,7 +426,8 @@ export default {
|
|||
},
|
||||
getData() {
|
||||
if (this.projectId) {
|
||||
this.condition.projectId = this.projectId;
|
||||
// 公共用例暂不支持所属项目过滤
|
||||
// this.condition.projectId = this.projectId;
|
||||
this.$emit('setCondition', this.condition);
|
||||
this.condition.casePublic = true;
|
||||
this.condition.workspaceId = getCurrentWorkspaceId();
|
||||
|
@ -595,7 +595,8 @@ export default {
|
|||
},
|
||||
getVersionOptions() {
|
||||
if (hasLicense()) {
|
||||
getVersionFilters(getCurrentProjectID())
|
||||
// 暂时去掉列表版本筛选, 保留但是查询逻辑待后续需求来更正
|
||||
getVersionFilters(getCurrentWorkspaceId())
|
||||
.then(r => this.versionFilters = r.data);
|
||||
}
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue