From 41780b2e4a6634302c67d08a65fa1b20dfbe08dc Mon Sep 17 00:00:00 2001 From: song-tianyang Date: Wed, 22 Sep 2021 15:01:07 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E5=8C=96):=20#1006813=20=E6=8E=A5=E5=8F=A3=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E5=8C=96=E6=89=B9=E9=87=8F=E6=B7=BB=E5=8A=A0=E5=88=B0=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E8=AE=A1=E5=88=92=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【【接口自动化】批量添加到测试计划后,测试计划-场景用例列表,没看到该场景】https://www.tapd.cn/55049933/bugtrace/bugs/view?bug_id=1155049933001006813 --- .../java/io/metersphere/api/service/ApiAutomationService.java | 2 ++ .../base/mapper/ext/ExtTestPlanScenarioCaseMapper.xml | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java b/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java index ed0b0f7706..265f138ded 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java @@ -1556,6 +1556,8 @@ public class ApiAutomationService { testPlanApiScenario.setCreateTime(System.currentTimeMillis()); testPlanApiScenario.setUpdateTime(System.currentTimeMillis()); testPlanApiScenario.setEnvironment(JSON.toJSONString(newEnvMap)); + Long nextScenarioOrder = ServiceUtils.getNextOrder(testPlan.getId(), extTestPlanScenarioCaseMapper::getLastOrder); + testPlanApiScenario.setOrder(nextScenarioOrder); scenarioBatchMapper.insertIfNotExists(testPlanApiScenario); }); } diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanScenarioCaseMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanScenarioCaseMapper.xml index 698d3ef559..650c572d6e 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanScenarioCaseMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanScenarioCaseMapper.xml @@ -5,8 +5,8 @@ -- 查询没有数据再插入 - INSERT INTO test_plan_api_scenario(id, test_plan_id, api_scenario_id, create_time, update_time, environment) - SELECT #{request.id}, #{request.testPlanId}, #{request.apiScenarioId}, #{request.createTime}, #{request.updateTime}, #{request.environment} + INSERT INTO test_plan_api_scenario(id, test_plan_id, api_scenario_id, create_time, update_time, environment, `order`) + SELECT #{request.id}, #{request.testPlanId}, #{request.apiScenarioId}, #{request.createTime}, #{request.updateTime}, #{request.environment}, #{request.order} FROM DUAL WHERE NOT EXISTS( SELECT id FROM