refactor: 查询资源池节点时按照创建时间排序
This commit is contained in:
parent
7902ef7f4e
commit
e11ccdb355
|
@ -49,6 +49,7 @@ public class ResourcePoolCalculation {
|
||||||
List<String> poolIds = pools.stream().map(pool -> pool.getId()).collect(Collectors.toList());
|
List<String> poolIds = pools.stream().map(pool -> pool.getId()).collect(Collectors.toList());
|
||||||
TestResourceExample resourceExample = new TestResourceExample();
|
TestResourceExample resourceExample = new TestResourceExample();
|
||||||
resourceExample.createCriteria().andTestResourcePoolIdIn(poolIds);
|
resourceExample.createCriteria().andTestResourcePoolIdIn(poolIds);
|
||||||
|
resourceExample.setOrderByClause("create_time");
|
||||||
List<TestResource> testResources = testResourceMapper.selectByExampleWithBLOBs(resourceExample);
|
List<TestResource> testResources = testResourceMapper.selectByExampleWithBLOBs(resourceExample);
|
||||||
return testResources;
|
return testResources;
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,6 +85,7 @@ public class ExtApiTaskService extends TaskService {
|
||||||
List<String> poolIds = pools.stream().map(pool -> pool.getId()).collect(Collectors.toList());
|
List<String> poolIds = pools.stream().map(pool -> pool.getId()).collect(Collectors.toList());
|
||||||
TestResourceExample resourceExample = new TestResourceExample();
|
TestResourceExample resourceExample = new TestResourceExample();
|
||||||
resourceExample.createCriteria().andTestResourcePoolIdIn(poolIds);
|
resourceExample.createCriteria().andTestResourcePoolIdIn(poolIds);
|
||||||
|
resourceExample.setOrderByClause("create_time");
|
||||||
List<TestResource> testResources = testResourceMapper.selectByExampleWithBLOBs(resourceExample);
|
List<TestResource> testResources = testResourceMapper.selectByExampleWithBLOBs(resourceExample);
|
||||||
for (TestResource testResource : testResources) {
|
for (TestResource testResource : testResources) {
|
||||||
String configuration = testResource.getConfiguration();
|
String configuration = testResource.getConfiguration();
|
||||||
|
|
|
@ -53,6 +53,7 @@ public class BaseTestResourcePoolService {
|
||||||
testResourcePools.forEach(pool -> {
|
testResourcePools.forEach(pool -> {
|
||||||
TestResourceExample example2 = new TestResourceExample();
|
TestResourceExample example2 = new TestResourceExample();
|
||||||
example2.createCriteria().andTestResourcePoolIdEqualTo(pool.getId());
|
example2.createCriteria().andTestResourcePoolIdEqualTo(pool.getId());
|
||||||
|
example2.setOrderByClause("create_time");
|
||||||
List<TestResource> testResources = testResourceMapper.selectByExampleWithBLOBs(example2);
|
List<TestResource> testResources = testResourceMapper.selectByExampleWithBLOBs(example2);
|
||||||
TestResourcePoolDTO testResourcePoolDTO = new TestResourcePoolDTO();
|
TestResourcePoolDTO testResourcePoolDTO = new TestResourcePoolDTO();
|
||||||
try {
|
try {
|
||||||
|
@ -77,6 +78,7 @@ public class BaseTestResourcePoolService {
|
||||||
if (pool != null) {
|
if (pool != null) {
|
||||||
TestResourceExample example = new TestResourceExample();
|
TestResourceExample example = new TestResourceExample();
|
||||||
example.createCriteria().andTestResourcePoolIdEqualTo(pool.getId());
|
example.createCriteria().andTestResourcePoolIdEqualTo(pool.getId());
|
||||||
|
example.setOrderByClause("create_time");
|
||||||
List<TestResource> resources = testResourceMapper.selectByExampleWithBLOBs(example);
|
List<TestResource> resources = testResourceMapper.selectByExampleWithBLOBs(example);
|
||||||
List<DetailColumn> columns = ReflexObjectUtil.getColumns(pool, SystemReference.poolColumns);
|
List<DetailColumn> columns = ReflexObjectUtil.getColumns(pool, SystemReference.poolColumns);
|
||||||
if (pool.getType().equals("NODE")) {
|
if (pool.getType().equals("NODE")) {
|
||||||
|
|
|
@ -19,12 +19,14 @@ public class BaseTestResourceService {
|
||||||
public List<TestResource> getTestResourceList(String testResourcePoolId) {
|
public List<TestResource> getTestResourceList(String testResourcePoolId) {
|
||||||
TestResourceExample testResourceExample = new TestResourceExample();
|
TestResourceExample testResourceExample = new TestResourceExample();
|
||||||
testResourceExample.createCriteria().andTestResourcePoolIdEqualTo(testResourcePoolId);
|
testResourceExample.createCriteria().andTestResourcePoolIdEqualTo(testResourcePoolId);
|
||||||
|
testResourceExample.setOrderByClause("create_time");
|
||||||
return testResourceMapper.selectByExampleWithBLOBs(testResourceExample);
|
return testResourceMapper.selectByExampleWithBLOBs(testResourceExample);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<TestResource> getResourcesByPoolId(String resourcePoolId) {
|
public List<TestResource> getResourcesByPoolId(String resourcePoolId) {
|
||||||
TestResourceExample example = new TestResourceExample();
|
TestResourceExample example = new TestResourceExample();
|
||||||
example.createCriteria().andTestResourcePoolIdEqualTo(resourcePoolId);
|
example.createCriteria().andTestResourcePoolIdEqualTo(resourcePoolId);
|
||||||
|
example.setOrderByClause("create_time");
|
||||||
return testResourceMapper.selectByExampleWithBLOBs(example);
|
return testResourceMapper.selectByExampleWithBLOBs(example);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -99,6 +99,7 @@ public class NodeResourcePoolService {
|
||||||
private List<TestResource> getResourcesFromDB(TestResourcePoolDTO testResourcePool) {
|
private List<TestResource> getResourcesFromDB(TestResourcePoolDTO testResourcePool) {
|
||||||
TestResourceExample example = new TestResourceExample();
|
TestResourceExample example = new TestResourceExample();
|
||||||
example.createCriteria().andTestResourcePoolIdEqualTo(testResourcePool.getId());
|
example.createCriteria().andTestResourcePoolIdEqualTo(testResourcePool.getId());
|
||||||
|
example.setOrderByClause("create_time");
|
||||||
return testResourceMapper.selectByExample(example);
|
return testResourceMapper.selectByExample(example);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -112,6 +112,7 @@ public class TestResourcePoolService {
|
||||||
BeanUtils.copyProperties(testResourcePoolDTO, testResourcePool);
|
BeanUtils.copyProperties(testResourcePoolDTO, testResourcePool);
|
||||||
TestResourceExample example2 = new TestResourceExample();
|
TestResourceExample example2 = new TestResourceExample();
|
||||||
example2.createCriteria().andTestResourcePoolIdEqualTo(poolId);
|
example2.createCriteria().andTestResourcePoolIdEqualTo(poolId);
|
||||||
|
example2.setOrderByClause("create_time");
|
||||||
List<TestResource> testResources = testResourceMapper.selectByExampleWithBLOBs(example2);
|
List<TestResource> testResources = testResourceMapper.selectByExampleWithBLOBs(example2);
|
||||||
testResourcePoolDTO.setResources(testResources);
|
testResourcePoolDTO.setResources(testResources);
|
||||||
if (validateTestResourcePool(testResourcePoolDTO)) {
|
if (validateTestResourcePool(testResourcePoolDTO)) {
|
||||||
|
@ -172,6 +173,7 @@ public class TestResourcePoolService {
|
||||||
testResourcePools.forEach(pool -> {
|
testResourcePools.forEach(pool -> {
|
||||||
TestResourceExample example2 = new TestResourceExample();
|
TestResourceExample example2 = new TestResourceExample();
|
||||||
example2.createCriteria().andTestResourcePoolIdEqualTo(pool.getId());
|
example2.createCriteria().andTestResourcePoolIdEqualTo(pool.getId());
|
||||||
|
example2.setOrderByClause("create_time");
|
||||||
List<TestResource> testResources = testResourceMapper.selectByExampleWithBLOBs(example2);
|
List<TestResource> testResources = testResourceMapper.selectByExampleWithBLOBs(example2);
|
||||||
TestResourcePoolDTO testResourcePoolDTO = new TestResourcePoolDTO();
|
TestResourcePoolDTO testResourcePoolDTO = new TestResourcePoolDTO();
|
||||||
try {
|
try {
|
||||||
|
@ -242,6 +244,7 @@ public class TestResourcePoolService {
|
||||||
if (pool != null) {
|
if (pool != null) {
|
||||||
TestResourceExample example = new TestResourceExample();
|
TestResourceExample example = new TestResourceExample();
|
||||||
example.createCriteria().andTestResourcePoolIdEqualTo(pool.getId());
|
example.createCriteria().andTestResourcePoolIdEqualTo(pool.getId());
|
||||||
|
example.setOrderByClause("create_time");
|
||||||
List<TestResource> resources = testResourceMapper.selectByExampleWithBLOBs(example);
|
List<TestResource> resources = testResourceMapper.selectByExampleWithBLOBs(example);
|
||||||
List<DetailColumn> columns = ReflexObjectUtil.getColumns(pool, SystemReference.poolColumns);
|
List<DetailColumn> columns = ReflexObjectUtil.getColumns(pool, SystemReference.poolColumns);
|
||||||
if (pool.getType().equals("NODE")) {
|
if (pool.getType().equals("NODE")) {
|
||||||
|
|
Loading…
Reference in New Issue