fix(用例管理): 用例取消依赖关系日志

--bug=1036353 --user=王旭 【用例管理】功能用例-取消关联依赖关系-未产生日志 https://www.tapd.cn/55049933/s/1469664
This commit is contained in:
WangXu10 2024-03-05 19:07:18 +08:00 committed by Craftsman
parent 8c1b548160
commit 1301433836
2 changed files with 25 additions and 0 deletions

View File

@ -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);

View File

@ -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;
}
}