refactor(接口测试): 避免同一个事务中多次调用获取场景详情方法,导致数据异常

--bug=1050539 --user=陈建星 【测试计划】github#34649,测试计划执行时,有时候步骤会执行多次 https://www.tapd.cn/55049933/s/1633266
This commit is contained in:
AgAngle 2024-12-18 14:58:36 +08:00 committed by Craftsman
parent 4a209eb5fe
commit bff7c3ad78
2 changed files with 7 additions and 1 deletions

View File

@ -13,6 +13,12 @@ import java.util.List;
public interface ExtApiScenarioStepMapper { public interface ExtApiScenarioStepMapper {
List<String> getStepIdsByScenarioId(@Param("scenarioId") String scenarioId); List<String> getStepIdsByScenarioId(@Param("scenarioId") String scenarioId);
/**
* 这个 sql 执行时会清理一级缓存
* 避免多次调用后数据异常
* @param scenarioIds
* @return
*/
List<ApiScenarioStepDTO> getStepDTOByScenarioIds(@Param("scenarioIds") List<String> scenarioIds); List<ApiScenarioStepDTO> getStepDTOByScenarioIds(@Param("scenarioIds") List<String> scenarioIds);
List<ApiScenarioCsvStep> getCsvStepByScenarioIds(@Param("scenarioIds") List<String> scenarioId); List<ApiScenarioCsvStep> getCsvStepByScenarioIds(@Param("scenarioIds") List<String> scenarioId);

View File

@ -5,7 +5,7 @@
<select id="getStepIdsByScenarioId" resultType="java.lang.String"> <select id="getStepIdsByScenarioId" resultType="java.lang.String">
SELECT id FROM api_scenario_step WHERE scenario_id = #{scenarioId} SELECT id FROM api_scenario_step WHERE scenario_id = #{scenarioId}
</select> </select>
<select id="getStepDTOByScenarioIds" resultType="io.metersphere.api.dto.scenario.ApiScenarioStepDTO"> <select id="getStepDTOByScenarioIds" resultType="io.metersphere.api.dto.scenario.ApiScenarioStepDTO" flushCache="true">
select select
<include refid="io.metersphere.api.mapper.ApiScenarioStepMapper.Base_Column_List"/> <include refid="io.metersphere.api.mapper.ApiScenarioStepMapper.Base_Column_List"/>
from api_scenario_step where scenario_id in from api_scenario_step where scenario_id in