diff --git a/test-track/backend/src/main/java/io/metersphere/plan/service/TestPlanTestCaseService.java b/test-track/backend/src/main/java/io/metersphere/plan/service/TestPlanTestCaseService.java index 26a1c718b7..683b96fd87 100644 --- a/test-track/backend/src/main/java/io/metersphere/plan/service/TestPlanTestCaseService.java +++ b/test-track/backend/src/main/java/io/metersphere/plan/service/TestPlanTestCaseService.java @@ -303,9 +303,14 @@ public class TestPlanTestCaseService { List testCaseTestDTOS = extTestPlanTestCaseMapper.listTestCaseTest(testPlanCaseDTO.getCaseId()); testCaseTestDTOS.forEach(this::setTestName); testPlanCaseDTO.setList(testCaseTestDTOS); + buildCustomField(testPlanCaseDTO); return testPlanCaseDTO; } + private void buildCustomField(TestPlanCaseDTO data) { + data.setFields(testCaseService.getCustomFieldByCaseId(data.getCaseId())); + } + private void setTestName(TestCaseTestDTO dto) { String type = dto.getTestType(); String id = dto.getTestId(); diff --git a/test-track/backend/src/main/java/io/metersphere/service/TestCaseService.java b/test-track/backend/src/main/java/io/metersphere/service/TestCaseService.java index 58acf5443b..77ac453e20 100644 --- a/test-track/backend/src/main/java/io/metersphere/service/TestCaseService.java +++ b/test-track/backend/src/main/java/io/metersphere/service/TestCaseService.java @@ -770,8 +770,12 @@ public class TestCaseService { } private void buildCustomField(TestCaseDTO data) { + data.setFields(getCustomFieldByCaseId(data.getId())); + } + + public List getCustomFieldByCaseId(String caseId) { CustomFieldTestCaseExample example = new CustomFieldTestCaseExample(); - example.createCriteria().andResourceIdEqualTo(data.getId()); + example.createCriteria().andResourceIdEqualTo(caseId); List customFieldTestCases = customFieldTestCaseMapper.selectByExampleWithBLOBs(example); List fields = new ArrayList<>(); customFieldTestCases.forEach(i -> { @@ -781,7 +785,7 @@ public class TestCaseService { customFieldDao.setTextValue(i.getTextValue()); fields.add(customFieldDao); }); - data.setFields(fields); + return fields; } private void buildProjectInfoWithoutProject(List resList) {