refactor: 修改缓存排序.
This commit is contained in:
@@ -18,7 +18,7 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.ArrayList;
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@@ -88,7 +88,7 @@ public class ${type}ApiImpl implements ${type}Api {
|
|||||||
public List<${type}DTO> get${type}ByIdList(List<Long> idList) {
|
public List<${type}DTO> get${type}ByIdList(List<Long> idList) {
|
||||||
log.info("${type}Api.get${type}ByIdList idList: {}", idList);
|
log.info("${type}Api.get${type}ByIdList idList: {}", idList);
|
||||||
if (Lists.isEmpty(idList)) {
|
if (Lists.isEmpty(idList)) {
|
||||||
return new ArrayList<>();
|
return Lists.empty();
|
||||||
}
|
}
|
||||||
// 查询
|
// 查询
|
||||||
List<${type}DO> rows = ${typeLower}DAO.selectBatchIds(idList);
|
List<${type}DO> rows = ${typeLower}DAO.selectBatchIds(idList);
|
||||||
@@ -112,6 +112,7 @@ public class ${type}ApiImpl implements ${type}Api {
|
|||||||
return ${typeLower}Service.get${type}ListByCache()
|
return ${typeLower}Service.get${type}ListByCache()
|
||||||
.stream()
|
.stream()
|
||||||
.map(${type}ProviderConvert.MAPPER::to)
|
.map(${type}ProviderConvert.MAPPER::to)
|
||||||
|
.sorted(Comparator.comparing(${type}DTO::getId))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
@@ -131,6 +132,7 @@ public class HostIdentityServiceImpl implements HostIdentityService {
|
|||||||
// 转换
|
// 转换
|
||||||
return list.stream()
|
return list.stream()
|
||||||
.map(HostIdentityConvert.MAPPER::to)
|
.map(HostIdentityConvert.MAPPER::to)
|
||||||
|
.sorted(Comparator.comparing(HostIdentityVO::getId))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ import org.springframework.stereotype.Service;
|
|||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@@ -145,6 +146,7 @@ public class HostKeyServiceImpl implements HostKeyService {
|
|||||||
// 转换
|
// 转换
|
||||||
return list.stream()
|
return list.stream()
|
||||||
.map(HostKeyConvert.MAPPER::to)
|
.map(HostKeyConvert.MAPPER::to)
|
||||||
|
.sorted(Comparator.comparing(HostKeyVO::getId))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.Future;
|
import java.util.concurrent.Future;
|
||||||
@@ -170,6 +171,7 @@ public class HostServiceImpl implements HostService {
|
|||||||
// 转换
|
// 转换
|
||||||
return list.stream()
|
return list.stream()
|
||||||
.map(HostConvert.MAPPER::to)
|
.map(HostConvert.MAPPER::to)
|
||||||
|
.sorted(Comparator.comparing(HostVO::getId))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ import org.springframework.scheduling.annotation.Async;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@@ -180,6 +181,7 @@ public class SystemUserServiceImpl implements SystemUserService {
|
|||||||
// 转换
|
// 转换
|
||||||
return list.stream()
|
return list.stream()
|
||||||
.map(SystemUserConvert.MAPPER::to)
|
.map(SystemUserConvert.MAPPER::to)
|
||||||
|
.sorted(Comparator.comparing(SystemUserVO::getId))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user