From 8d59cfaeb9b2896f8fa2a3ed4dddb6693d5f197e Mon Sep 17 00:00:00 2001 From: CaptainB Date: Thu, 3 Nov 2022 11:21:29 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E6=9F=A5=E8=AF=A2=E8=B5=84?= =?UTF-8?q?=E6=BA=90=E6=B1=A0=E8=8A=82=E7=82=B9=E6=97=B6=E6=8C=89=E7=85=A7?= =?UTF-8?q?=E5=88=9B=E5=BB=BA=E6=97=B6=E9=97=B4=E6=8E=92=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/metersphere/api/jmeter/ResourcePoolCalculation.java | 1 + .../java/io/metersphere/service/ext/ExtApiTaskService.java | 1 + .../io/metersphere/service/BaseTestResourcePoolService.java | 2 ++ .../java/io/metersphere/service/BaseTestResourceService.java | 2 ++ .../java/io/metersphere/service/NodeResourcePoolService.java | 1 + .../java/io/metersphere/service/TestResourcePoolService.java | 3 +++ 6 files changed, 10 insertions(+) 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")) {