diff --git a/api-test/backend/src/main/java/io/metersphere/api/jmeter/ResourcePoolCalculation.java b/api-test/backend/src/main/java/io/metersphere/api/jmeter/ResourcePoolCalculation.java index be53cb58cc..38ac6b9b00 100644 --- a/api-test/backend/src/main/java/io/metersphere/api/jmeter/ResourcePoolCalculation.java +++ b/api-test/backend/src/main/java/io/metersphere/api/jmeter/ResourcePoolCalculation.java @@ -49,6 +49,7 @@ public class ResourcePoolCalculation { List poolIds = pools.stream().map(pool -> pool.getId()).collect(Collectors.toList()); TestResourceExample resourceExample = new TestResourceExample(); resourceExample.createCriteria().andTestResourcePoolIdIn(poolIds); + resourceExample.setOrderByClause("create_time"); List testResources = testResourceMapper.selectByExampleWithBLOBs(resourceExample); return testResources; } diff --git a/api-test/backend/src/main/java/io/metersphere/service/ext/ExtApiTaskService.java b/api-test/backend/src/main/java/io/metersphere/service/ext/ExtApiTaskService.java index 6b236e7e15..d0875f7966 100644 --- a/api-test/backend/src/main/java/io/metersphere/service/ext/ExtApiTaskService.java +++ b/api-test/backend/src/main/java/io/metersphere/service/ext/ExtApiTaskService.java @@ -85,6 +85,7 @@ public class ExtApiTaskService extends TaskService { List poolIds = pools.stream().map(pool -> pool.getId()).collect(Collectors.toList()); TestResourceExample resourceExample = new TestResourceExample(); resourceExample.createCriteria().andTestResourcePoolIdIn(poolIds); + resourceExample.setOrderByClause("create_time"); List testResources = testResourceMapper.selectByExampleWithBLOBs(resourceExample); for (TestResource testResource : testResources) { String configuration = testResource.getConfiguration(); diff --git a/framework/sdk-parent/sdk/src/main/java/io/metersphere/service/BaseTestResourcePoolService.java b/framework/sdk-parent/sdk/src/main/java/io/metersphere/service/BaseTestResourcePoolService.java index db3cb04605..8a48b4a1f4 100644 --- a/framework/sdk-parent/sdk/src/main/java/io/metersphere/service/BaseTestResourcePoolService.java +++ b/framework/sdk-parent/sdk/src/main/java/io/metersphere/service/BaseTestResourcePoolService.java @@ -53,6 +53,7 @@ public class BaseTestResourcePoolService { testResourcePools.forEach(pool -> { TestResourceExample example2 = new TestResourceExample(); example2.createCriteria().andTestResourcePoolIdEqualTo(pool.getId()); + example2.setOrderByClause("create_time"); List testResources = testResourceMapper.selectByExampleWithBLOBs(example2); TestResourcePoolDTO testResourcePoolDTO = new TestResourcePoolDTO(); try { @@ -77,6 +78,7 @@ public class BaseTestResourcePoolService { if (pool != null) { TestResourceExample example = new TestResourceExample(); example.createCriteria().andTestResourcePoolIdEqualTo(pool.getId()); + example.setOrderByClause("create_time"); List resources = testResourceMapper.selectByExampleWithBLOBs(example); List columns = ReflexObjectUtil.getColumns(pool, SystemReference.poolColumns); if (pool.getType().equals("NODE")) { diff --git a/framework/sdk-parent/sdk/src/main/java/io/metersphere/service/BaseTestResourceService.java b/framework/sdk-parent/sdk/src/main/java/io/metersphere/service/BaseTestResourceService.java index 7a060e341b..4c40dc102d 100644 --- a/framework/sdk-parent/sdk/src/main/java/io/metersphere/service/BaseTestResourceService.java +++ b/framework/sdk-parent/sdk/src/main/java/io/metersphere/service/BaseTestResourceService.java @@ -19,12 +19,14 @@ public class BaseTestResourceService { public List getTestResourceList(String testResourcePoolId) { TestResourceExample testResourceExample = new TestResourceExample(); testResourceExample.createCriteria().andTestResourcePoolIdEqualTo(testResourcePoolId); + testResourceExample.setOrderByClause("create_time"); return testResourceMapper.selectByExampleWithBLOBs(testResourceExample); } public List getResourcesByPoolId(String resourcePoolId) { TestResourceExample example = new TestResourceExample(); example.createCriteria().andTestResourcePoolIdEqualTo(resourcePoolId); + example.setOrderByClause("create_time"); return testResourceMapper.selectByExampleWithBLOBs(example); } diff --git a/framework/sdk-parent/sdk/src/main/java/io/metersphere/service/NodeResourcePoolService.java b/framework/sdk-parent/sdk/src/main/java/io/metersphere/service/NodeResourcePoolService.java index 02d14dccfc..5c2899d92c 100644 --- a/framework/sdk-parent/sdk/src/main/java/io/metersphere/service/NodeResourcePoolService.java +++ b/framework/sdk-parent/sdk/src/main/java/io/metersphere/service/NodeResourcePoolService.java @@ -99,6 +99,7 @@ public class NodeResourcePoolService { private List getResourcesFromDB(TestResourcePoolDTO testResourcePool) { TestResourceExample example = new TestResourceExample(); example.createCriteria().andTestResourcePoolIdEqualTo(testResourcePool.getId()); + example.setOrderByClause("create_time"); return testResourceMapper.selectByExample(example); } diff --git a/system-setting/backend/src/main/java/io/metersphere/service/TestResourcePoolService.java b/system-setting/backend/src/main/java/io/metersphere/service/TestResourcePoolService.java index 4eb13423d4..97b72fbbf5 100644 --- a/system-setting/backend/src/main/java/io/metersphere/service/TestResourcePoolService.java +++ b/system-setting/backend/src/main/java/io/metersphere/service/TestResourcePoolService.java @@ -112,6 +112,7 @@ public class TestResourcePoolService { BeanUtils.copyProperties(testResourcePoolDTO, testResourcePool); TestResourceExample example2 = new TestResourceExample(); example2.createCriteria().andTestResourcePoolIdEqualTo(poolId); + example2.setOrderByClause("create_time"); List testResources = testResourceMapper.selectByExampleWithBLOBs(example2); testResourcePoolDTO.setResources(testResources); if (validateTestResourcePool(testResourcePoolDTO)) { @@ -172,6 +173,7 @@ public class TestResourcePoolService { testResourcePools.forEach(pool -> { TestResourceExample example2 = new TestResourceExample(); example2.createCriteria().andTestResourcePoolIdEqualTo(pool.getId()); + example2.setOrderByClause("create_time"); List testResources = testResourceMapper.selectByExampleWithBLOBs(example2); TestResourcePoolDTO testResourcePoolDTO = new TestResourcePoolDTO(); try { @@ -242,6 +244,7 @@ public class TestResourcePoolService { if (pool != null) { TestResourceExample example = new TestResourceExample(); example.createCriteria().andTestResourcePoolIdEqualTo(pool.getId()); + example.setOrderByClause("create_time"); List resources = testResourceMapper.selectByExampleWithBLOBs(example); List columns = ReflexObjectUtil.getColumns(pool, SystemReference.poolColumns); if (pool.getType().equals("NODE")) {