fix(用例管理): 修复用例评审详情页关联的接口和场景用例删除进入回收站数量不对问题

--bug=1040542 --user=郭雨琦
https://www.tapd.cn/55049933/bugtrace/bugs/view?bug_id=1155049933001040542
This commit is contained in:
guoyuqi 2024-05-22 14:09:36 +08:00 committed by 刘瑞斌
parent c9d69335bb
commit f3e788c649
4 changed files with 27 additions and 5 deletions

View File

@ -14,6 +14,8 @@ public interface ExtFunctionalCaseTestMapper {
List<String> getIds(@Param("request") DisassociateOtherCaseRequest request);
Integer getOtherCaseCount(@Param("caseId") String caseId);
List<FunctionalCaseTestDTO> getList(@Param("request") FunctionalCaseTestRequest request);
List<FunctionalCaseTestPlanDTO> getPlanList(@Param("request") AssociatePlanPageRequest request);

View File

@ -41,7 +41,10 @@
LEFT JOIN api_test_case atc ON fct.source_id = atc.id
LEFT JOIN api_scenario scenario ON fct.source_id = scenario.id
WHERE fct.case_id = #{request.sourceId}
AND atc.deleted = false AND scenario.deleted = false
AND (
atc.deleted = false
OR scenario.deleted = false
)
<if test="request.sourceType != null and request.sourceType != ''">
AND fct.source_type = #{request.sourceType}
</if>
@ -57,6 +60,22 @@
order by fct.create_time desc
</select>
<select id="getOtherCaseCount" resultType="java.lang.Integer">
SELECT
count(fct.id)
FROM
functional_case_test fct
LEFT JOIN project p ON fct.project_id = p.id
LEFT JOIN project_version v ON fct.version_id = v.id
LEFT JOIN api_test_case atc ON fct.source_id = atc.id
LEFT JOIN api_scenario scenario ON fct.source_id = scenario.id
WHERE fct.case_id = #{caseId}
AND (
atc.deleted = false
OR scenario.deleted = false
)
</select>
<select id="getPlanList" parameterType="io.metersphere.functional.request.AssociatePlanPageRequest" resultType="io.metersphere.functional.dto.FunctionalCaseTestPlanDTO">
SELECT r.* from (
SELECT distinct tpfc.test_plan_id as testPlanId,

View File

@ -138,6 +138,8 @@ public class FunctionalCaseService {
@Resource
private FunctionalCaseTestMapper functionalCaseTestMapper;
@Resource
private ExtFunctionalCaseTestMapper extFunctionalCaseTestMapper;
@Resource
private BugRelationCaseMapper bugRelationCaseMapper;
@Resource
private FunctionalCaseRelationshipEdgeMapper functionalCaseRelationshipEdgeMapper;
@ -388,9 +390,8 @@ public class FunctionalCaseService {
functionalCaseDemandExample.createCriteria().andCaseIdEqualTo(functionalCaseDetailDTO.getId());
functionalCaseDetailDTO.setDemandCount((int) functionalCaseDemandMapper.countByExample(functionalCaseDemandExample));
//获取已关联用例数量
FunctionalCaseTestExample caseTestExample = new FunctionalCaseTestExample();
caseTestExample.createCriteria().andCaseIdEqualTo(functionalCaseDetailDTO.getId());
functionalCaseDetailDTO.setCaseCount((int) functionalCaseTestMapper.countByExample(caseTestExample));
Integer otherCaseCount = extFunctionalCaseTestMapper.getOtherCaseCount(functionalCaseDetailDTO.getId());
functionalCaseDetailDTO.setCaseCount(otherCaseCount);
//获取已关联缺陷数量
BugRelationCaseExample bugRelationCaseExample = new BugRelationCaseExample();
bugRelationCaseExample.createCriteria().andCaseIdEqualTo(functionalCaseDetailDTO.getId());

View File

@ -48,7 +48,7 @@ public class ProjectController {
}
@GetMapping("/list/options/{organizationId}/{module}")
@Operation(summary = "根据组织ID获取所有开启某个模块的所有权限的项目")
@Operation(summary = "根据组织ID获取所有开启某个模块的所有权限的项目")
@CheckOwner(resourceId = "#organizationId", resourceType = "organization")
public List<Project> getUserProjectWidthModule(@PathVariable String organizationId, @PathVariable String module) {
return projectService.getUserProjectWidthModule(organizationId, module, SessionUtils.getUserId());