diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanTestCaseMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanTestCaseMapper.xml index cc6d504e2c..312b04b00a 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanTestCaseMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanTestCaseMapper.xml @@ -369,14 +369,12 @@ test_plan_test_case.id as id, test_plan_test_case.*, test_case.*, - if(pa.type_value = 'false', cast(test_case.num as char), test_case.custom_num) as customNum, test_case_node.name as model, project.name as projectName from test_plan_test_case inner join test_case on test_plan_test_case.case_id = test_case.id left join test_case_node on test_case_node.id = test_case.node_id inner join project on project.id = test_case.project_id - inner join project_application pa on project.id = pa.project_id and pa.type = 'CASE_CUSTOM_NUM' where test_plan_test_case.id = #{testPlanTestCaseId} diff --git a/backend/src/main/java/io/metersphere/commons/utils/ServiceUtils.java b/backend/src/main/java/io/metersphere/commons/utils/ServiceUtils.java index 76bc13d66b..7a9cb658e8 100644 --- a/backend/src/main/java/io/metersphere/commons/utils/ServiceUtils.java +++ b/backend/src/main/java/io/metersphere/commons/utils/ServiceUtils.java @@ -372,22 +372,38 @@ public class ServiceUtils { ProjectApplicationService projectApplicationService = CommonBeanFactory.getBean(ProjectApplicationService.class); Map customNumMap = projectApplicationService.getCustomNumMapByProjectIds(projectIds); list.forEach(i -> { - Class clazz = i.getClass(); - try { - Method setIsCustomNum = clazz.getMethod("setCustomNum", String.class); - Method getNum = clazz.getMethod("getNum"); - Method getProjectId = clazz.getMethod("getProjectId"); - Object projectId = getProjectId.invoke(i); - String isCustomNum = customNumMap.get(projectId); - if (isCustomNum == null) { - setIsCustomNum.invoke(i, String.valueOf(getNum.invoke(i))); - } - } catch (Exception e) { - LogUtil.error(e); - } + buildCustomNumInfo(customNumMap, i); }); } + public static void buildCustomNumInfo(Object data) { + try { + Method getProjectId = data.getClass().getMethod("getProjectId"); + String projectId = getProjectId.invoke(data).toString(); + ProjectApplicationService projectApplicationService = CommonBeanFactory.getBean(ProjectApplicationService.class); + Map customNumMap = projectApplicationService.getCustomNumMapByProjectIds(Arrays.asList(projectId)); + buildCustomNumInfo(customNumMap, data); + } catch (Exception e) { + LogUtil.error(e); + } + } + + private static void buildCustomNumInfo(Map customNumMap, Object data) { + Class clazz = data.getClass(); + try { + Method setIsCustomNum = clazz.getMethod("setCustomNum", String.class); + Method getNum = clazz.getMethod("getNum"); + Method getProjectId = clazz.getMethod("getProjectId"); + Object projectId = getProjectId.invoke(data); + String isCustomNum = customNumMap.get(projectId); + if (isCustomNum == null) { + setIsCustomNum.invoke(data, String.valueOf(getNum.invoke(data))); + } + } catch (Exception e) { + LogUtil.error(e); + } + } + private static List getFieldListByMethod(List list, String field) { return list.stream() .map(i -> { diff --git a/backend/src/main/java/io/metersphere/track/service/TestPlanTestCaseService.java b/backend/src/main/java/io/metersphere/track/service/TestPlanTestCaseService.java index 573b4a5bc7..39dc324a49 100644 --- a/backend/src/main/java/io/metersphere/track/service/TestPlanTestCaseService.java +++ b/backend/src/main/java/io/metersphere/track/service/TestPlanTestCaseService.java @@ -248,8 +248,9 @@ public class TestPlanTestCaseService { request.setExecutor(user.getId()); } - public TestPlanCaseDTO get(String testplanTestCaseId) { - TestPlanCaseDTO testPlanCaseDTO = extTestPlanTestCaseMapper.get(testplanTestCaseId); + public TestPlanCaseDTO get(String id) { + TestPlanCaseDTO testPlanCaseDTO = extTestPlanTestCaseMapper.get(id); + ServiceUtils.buildCustomNumInfo(testPlanCaseDTO); List testCaseTestDTOS = extTestPlanTestCaseMapper.listTestCaseTest(testPlanCaseDTO.getCaseId()); testCaseTestDTOS.forEach(dto -> { setTestName(dto); diff --git a/frontend/src/business/components/track/plan/view/comonents/functional/FunctionalTestCaseEdit.vue b/frontend/src/business/components/track/plan/view/comonents/functional/FunctionalTestCaseEdit.vue index 94cf36df56..f636215a54 100644 --- a/frontend/src/business/components/track/plan/view/comonents/functional/FunctionalTestCaseEdit.vue +++ b/frontend/src/business/components/track/plan/view/comonents/functional/FunctionalTestCaseEdit.vue @@ -599,4 +599,8 @@ p { /deep/ .el-drawer__body { overflow: unset; } + +.comment-card >>> .executeCard { + margin-bottom: 5px; +} diff --git a/frontend/src/business/components/track/plan/view/comonents/functional/TestPlanCommentInput.vue b/frontend/src/business/components/track/plan/view/comonents/functional/TestPlanCommentInput.vue index eb1634e2af..44262e3728 100644 --- a/frontend/src/business/components/track/plan/view/comonents/functional/TestPlanCommentInput.vue +++ b/frontend/src/business/components/track/plan/view/comonents/functional/TestPlanCommentInput.vue @@ -1,21 +1,26 @@