fix(测试跟踪): 功能用例自定义ID筛选,模块用例数显示有误

--bug=1049981 --user=陈建星 【测试跟踪】github#34489,功能用例自定义ID筛选存在问题 https://www.tapd.cn/55049933/s/1627444
This commit is contained in:
AgAngle 2024-12-10 11:44:47 +08:00 committed by Craftsman
parent 508103b872
commit 608d4a04b7
1 changed files with 10 additions and 0 deletions

View File

@ -1,9 +1,11 @@
package io.metersphere.controller; package io.metersphere.controller;
import io.metersphere.base.domain.ProjectApplication;
import io.metersphere.base.domain.TestCaseNode; import io.metersphere.base.domain.TestCaseNode;
import io.metersphere.commons.constants.OperLogConstants; import io.metersphere.commons.constants.OperLogConstants;
import io.metersphere.commons.constants.OperLogModule; import io.metersphere.commons.constants.OperLogModule;
import io.metersphere.commons.constants.PermissionConstants; import io.metersphere.commons.constants.PermissionConstants;
import io.metersphere.commons.constants.ProjectApplicationType;
import io.metersphere.dto.TestCaseNodeDTO; import io.metersphere.dto.TestCaseNodeDTO;
import io.metersphere.log.annotation.MsAuditLog; import io.metersphere.log.annotation.MsAuditLog;
import io.metersphere.log.annotation.MsRequestLog; import io.metersphere.log.annotation.MsRequestLog;
@ -14,9 +16,11 @@ import io.metersphere.request.testcase.QueryTestCaseRequest;
import io.metersphere.request.testreview.QueryCaseReviewRequest; import io.metersphere.request.testreview.QueryCaseReviewRequest;
import io.metersphere.security.CheckOwner; import io.metersphere.security.CheckOwner;
import io.metersphere.service.BaseCheckPermissionService; import io.metersphere.service.BaseCheckPermissionService;
import io.metersphere.service.BaseProjectApplicationService;
import io.metersphere.service.TestCaseNodeService; import io.metersphere.service.TestCaseNodeService;
import io.metersphere.service.wapper.CheckPermissionService; import io.metersphere.service.wapper.CheckPermissionService;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -34,6 +38,8 @@ public class TestCaseNodeController {
private CheckPermissionService trackCheckPermissionService; private CheckPermissionService trackCheckPermissionService;
@Resource @Resource
private BaseCheckPermissionService baseCheckPermissionService; private BaseCheckPermissionService baseCheckPermissionService;
@Resource
private BaseProjectApplicationService projectApplicationService;
@GetMapping("/list/{projectId}") @GetMapping("/list/{projectId}")
@RequiresPermissions(value = {PermissionConstants.PROJECT_TRACK_CASE_READ}) @RequiresPermissions(value = {PermissionConstants.PROJECT_TRACK_CASE_READ})
@ -49,6 +55,10 @@ public class TestCaseNodeController {
if (request != null && request.getProjectId() != null) { if (request != null && request.getProjectId() != null) {
projectId = request.getProjectId(); projectId = request.getProjectId();
} }
ProjectApplication projectApplication = projectApplicationService.getProjectApplication(request.getProjectId(), ProjectApplicationType.CASE_CUSTOM_NUM.name());
if (projectApplication != null && StringUtils.isNotEmpty(projectApplication.getTypeValue()) && request.getCombine() != null) {
request.getCombine().put("caseCustomNum", projectApplication.getTypeValue());
}
baseCheckPermissionService.checkProjectOwner(projectId); baseCheckPermissionService.checkProjectOwner(projectId);
return testCaseNodeService.getNodeTreeByProjectId(projectId, return testCaseNodeService.getNodeTreeByProjectId(projectId,
Optional.ofNullable(request).orElse(new QueryTestCaseRequest())); Optional.ofNullable(request).orElse(new QueryTestCaseRequest()));