diff --git a/api-test/backend/src/main/java/io/metersphere/service/MsHashTreeService.java b/api-test/backend/src/main/java/io/metersphere/service/MsHashTreeService.java index 93413e2e6f..c1c56d090f 100644 --- a/api-test/backend/src/main/java/io/metersphere/service/MsHashTreeService.java +++ b/api-test/backend/src/main/java/io/metersphere/service/MsHashTreeService.java @@ -16,6 +16,7 @@ import io.metersphere.commons.constants.PropertyConstant; import io.metersphere.commons.utils.JSON; import io.metersphere.commons.utils.JSONUtil; import io.metersphere.commons.utils.LogUtil; +import io.metersphere.dto.ProjectConfig; import io.metersphere.service.definition.ApiDefinitionService; import io.metersphere.service.definition.ApiTestCaseService; import org.apache.commons.collections.CollectionUtils; @@ -41,6 +42,8 @@ public class MsHashTreeService { private ApiDefinitionMapper apiDefinitionMapper; @Resource private ExtApiScenarioMapper extApiScenarioMapper; + @Resource + private BaseProjectApplicationService baseProjectApplicationService; @Resource private ProjectMapper projectMapper; @@ -77,6 +80,8 @@ public class MsHashTreeService { private static final String PRE = "PRE"; private static final String POST = "POST"; private static final String ASSERTIONS = ElementConstants.ASSERTIONS; + public static final String CUSTOMNUM = "customNum"; + public static final String SHOWCUSTOMNUM = "showCustomNum"; public void setHashTree(JSONArray hashTree) { // 将引用转成复制 @@ -214,6 +219,10 @@ public class MsHashTreeService { if (!element.has(VARIABLE_ENABLE)) { element.put(VARIABLE_ENABLE, variableEnable); } + //获取场景的当前项目是否开启了自定义id + ProjectConfig projectApplication = baseProjectApplicationService.getSpecificTypeValue(scenarioWithBLOBs.getProjectId(), "SCENARIO_CUSTOM_NUM"); + element.put(SHOWCUSTOMNUM, projectApplication.getScenarioCustomNum()); + element.put(CUSTOMNUM, scenarioWithBLOBs.getCustomNum()); this.setElement(element, scenarioWithBLOBs.getNum(), enable, scenarioWithBLOBs.getVersionName(), scenarioWithBLOBs.getVersionEnable()); } else { if (StringUtils.equalsIgnoreCase(element.optString(REFERENCED), REF)) { diff --git a/api-test/frontend/src/business/automation/scenario/api/ScenarioRelevance.vue b/api-test/frontend/src/business/automation/scenario/api/ScenarioRelevance.vue index b84bb2ed97..c5e8629ca7 100644 --- a/api-test/frontend/src/business/automation/scenario/api/ScenarioRelevance.vue +++ b/api-test/frontend/src/business/automation/scenario/api/ScenarioRelevance.vue @@ -134,6 +134,8 @@ export default { hashTree: scenarioDefinition.hashTree, projectId: item.projectId, num: item.num, + customNum: item.customNum, + showCustomNum: scenarioDefinition.showCustomNum, versionName: item.versionName, versionEnable: item.versionEnable, }; diff --git a/api-test/frontend/src/business/automation/scenario/component/ApiScenarioComponent.vue b/api-test/frontend/src/business/automation/scenario/component/ApiScenarioComponent.vue index 9193c7c035..aabe2d5727 100644 --- a/api-test/frontend/src/business/automation/scenario/component/ApiScenarioComponent.vue +++ b/api-test/frontend/src/business/automation/scenario/component/ApiScenarioComponent.vue @@ -21,9 +21,12 @@ :envMap="envMap" :title="$t('commons.scenario')">