From 7fbc0d68d0468c5e440dd1acf69626f2495776e8 Mon Sep 17 00:00:00 2001 From: fit2-zhao Date: Wed, 28 Sep 2022 10:00:30 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=AC=A1=E6=95=B0=E5=BE=AA=E7=8E=AF=E5=BD=93?= =?UTF-8?q?=E6=9D=A1=E4=BB=B6=E4=B8=BA=E8=B4=9F=E6=95=B0=E6=97=B6=E9=80=A0?= =?UTF-8?q?=E6=88=90=E6=AD=BB=E5=BE=AA=E7=8E=AF=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://github.com/metersphere/metersphere/issues/18290 --- .../dto/definition/request/controller/MsLoopController.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/backend/src/main/java/io/metersphere/api/dto/definition/request/controller/MsLoopController.java b/backend/src/main/java/io/metersphere/api/dto/definition/request/controller/MsLoopController.java index a2cff56acd..064b35d48a 100644 --- a/backend/src/main/java/io/metersphere/api/dto/definition/request/controller/MsLoopController.java +++ b/backend/src/main/java/io/metersphere/api/dto/definition/request/controller/MsLoopController.java @@ -173,7 +173,7 @@ public class MsLoopController extends MsTestElement { private IfController ifController(String condition) { IfController ifController = new IfController(); ifController.setEnabled(this.isEnable()); - ifController.setName("while ifController"); + ifController.setName("Loop ifController"); ifController.setProperty(TestElement.TEST_CLASS, IfController.class.getName()); ifController.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass("IfControllerPanel")); ifController.setCondition(condition); @@ -281,7 +281,9 @@ public class MsLoopController extends MsTestElement { return tree.add(initForeachController()); } if (StringUtils.equals(this.loopType, LoopConstants.LOOP_COUNT.name()) && this.countController != null) { - return tree.add(initLoopController()); + String ifCondition = StringUtils.join("${__jexl3(", countController.getLoops(), " > 0 ", ")}"); + HashTree ifHashTree = tree.add(ifController(ifCondition)); + return ifHashTree.add(initLoopController()); } return null; }