refactor(接口测试): 优化接口对应的mock查询方法

Signed-off-by: fit2-zhao <yong.zhao@fit2cloud.com>
This commit is contained in:
fit2-zhao 2023-04-03 19:54:46 +08:00 committed by fit2-zhao
parent 55cfbcf214
commit a2307dd428
2 changed files with 7 additions and 7 deletions

View File

@ -14,16 +14,14 @@
</select> </select>
<select id="selectByApiIdIn" resultType="io.metersphere.api.dto.mock.config.MockConfigImportDTO"> <select id="selectByApiIdIn" resultType="io.metersphere.api.dto.mock.config.MockConfigImportDTO">
SELECT SELECT
mock_expect_config.*, mock_expect_config.*,mock_config.api_id AS apiId
mock_config.api_id AS apiId
FROM FROM
mock_expect_config mock_expect_config
LEFT JOIN mock_config ON mock_expect_config.mock_config_id = mock_config.id LEFT JOIN mock_config ON mock_expect_config.mock_config_id = mock_config.id
WHERE mock_config.api_id in ( WHERE mock_config.api_id in
<foreach collection="values" item="value" separator="," open="(" close=")"> <foreach collection="values" item="value" separator="," open="(" close=")">
#{value} #{value}
</foreach> </foreach>
)
</select> </select>
<select id="selectExlectNumByMockConfigId" resultType="java.lang.String"> <select id="selectExlectNumByMockConfigId" resultType="java.lang.String">

View File

@ -1438,6 +1438,7 @@ public class ApiDefinitionService {
public ApiExportResult export(ApiBatchRequest request, String type) { public ApiExportResult export(ApiBatchRequest request, String type) {
ServiceUtils.getSelectAllIds(request, request.getCondition(), (query) -> extApiDefinitionMapper.selectIds(query)); ServiceUtils.getSelectAllIds(request, request.getCondition(), (query) -> extApiDefinitionMapper.selectIds(query));
LogUtil.info("导出总量 ",request.getIds());
List<ApiDefinitionWithBLOBs> apiDefinitions = getByIds(request.getIds()); List<ApiDefinitionWithBLOBs> apiDefinitions = getByIds(request.getIds());
@ -1450,6 +1451,7 @@ public class ApiDefinitionService {
msApiExportResult.setProtocol(request.getProtocol()); msApiExportResult.setProtocol(request.getProtocol());
msApiExportResult.setProjectId(request.getProjectId()); msApiExportResult.setProjectId(request.getProjectId());
msApiExportResult.setVersion(System.getenv("MS_VERSION")); msApiExportResult.setVersion(System.getenv("MS_VERSION"));
LogUtil.info("导出数据组装完成 ",request.getIds());
return msApiExportResult; return msApiExportResult;
} else { // 导出为 Swagger 格式 } else { // 导出为 Swagger 格式
Swagger3Parser swagger3Parser = new Swagger3Parser(); Swagger3Parser swagger3Parser = new Swagger3Parser();