diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/controller/FunctionalCaseRelationshipController.java b/backend/services/case-management/src/main/java/io/metersphere/functional/controller/FunctionalCaseRelationshipController.java index d6e778029c..fc3f4fe4a3 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/controller/FunctionalCaseRelationshipController.java +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/controller/FunctionalCaseRelationshipController.java @@ -9,9 +9,12 @@ import io.metersphere.functional.request.RelationshipAddRequest; import io.metersphere.functional.request.RelationshipDeleteRequest; import io.metersphere.functional.request.RelationshipPageRequest; import io.metersphere.functional.request.RelationshipRequest; +import io.metersphere.functional.service.FunctionalCaseLogService; import io.metersphere.functional.service.FunctionalCaseRelationshipEdgeService; import io.metersphere.functional.service.FunctionalCaseService; import io.metersphere.sdk.constants.PermissionConstants; +import io.metersphere.system.log.annotation.Log; +import io.metersphere.system.log.constants.OperationLogType; import io.metersphere.system.security.CheckOwner; import io.metersphere.system.utils.PageUtils; import io.metersphere.system.utils.Pager; @@ -84,6 +87,7 @@ public class FunctionalCaseRelationshipController { @PostMapping("/delete") @Operation(summary = "用例管理-功能用例-用例详情-前后置关系-取消关联") @RequiresPermissions(PermissionConstants.FUNCTIONAL_CASE_READ_UPDATE) + @Log(type = OperationLogType.DISASSOCIATE, expression = "#msClass.disassociateRelateLog(#request)", msClass = FunctionalCaseLogService.class) @CheckOwner(resourceId = "#request.getCaseId", resourceType = "functional_case") public void delete(@Validated @RequestBody RelationshipDeleteRequest request) { functionalCaseRelationshipEdgeService.delete(request); diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseLogService.java b/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseLogService.java index 6ca5f40512..6e60d0fd74 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseLogService.java +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseLogService.java @@ -374,4 +374,25 @@ public class FunctionalCaseLogService { } return null; } + + + public LogDTO disassociateRelateLog(RelationshipDeleteRequest request) { + FunctionalCase functionalCase = functionalCaseMapper.selectByPrimaryKey(request.getCaseId()); + if (functionalCase != null) { + LogDTO dto = new LogDTO( + functionalCase.getProjectId(), + null, + functionalCase.getId(), + functionalCase.getCreateUser(), + OperationLogType.DISASSOCIATE.name(), + OperationLogModule.FUNCTIONAL_CASE, + functionalCase.getName()); + + dto.setPath("/functional/case/relationship/delete"); + dto.setMethod(HttpMethodConstants.POST.name()); + dto.setOriginalValue(JSON.toJSONBytes(functionalCase)); + return dto; + } + return null; + } }