fix(接口自动化): #1006813 接口自动化批量添加到测试计划失败

【【接口自动化】批量添加到测试计划后,测试计划-场景用例列表,没看到该场景】https://www.tapd.cn/55049933/bugtrace/bugs/view?bug_id=1155049933001006813
This commit is contained in:
song-tianyang 2021-09-22 15:01:07 +08:00 committed by song-tianyang
parent a7bcf2c46a
commit 41780b2e4a
2 changed files with 4 additions and 2 deletions

View File

@ -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);
});
}

View File

@ -5,8 +5,8 @@
<insert id="insertIfNotExists" parameterType="io.metersphere.base.domain.TestPlanApiScenario">
-- 查询没有数据再插入
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