fix:优化行程规划分页查询的逻辑

This commit is contained in:
lulz1 2024-07-08 16:34:25 +08:00
parent 11394fc723
commit 391ec93f27
2 changed files with 6 additions and 1 deletions

View File

@ -36,6 +36,11 @@ public class RouteCacheService {
public List<RouteOrder> preloadUserRoutes(String employeeNo) { public List<RouteOrder> preloadUserRoutes(String employeeNo) {
List<Long> routeIdsByEmployeeNo = routeCacheManage
.getRouteIdsByEmployeeNo(employeeNo, null, null).stream().filter(Objects::nonNull).toList();
if (!routeIdsByEmployeeNo.isEmpty()) {
return routeCacheManage.getRouteListByIds(routeIdsByEmployeeNo);
}
log.info("开始缓存用户行程规划单"); log.info("开始缓存用户行程规划单");
List<RouteOrder> routeOrders = jdbcRouteRepository.findByUserIdOrApproveOrderNo_Creator(employeeNo, employeeNo); List<RouteOrder> routeOrders = jdbcRouteRepository.findByUserIdOrApproveOrderNo_Creator(employeeNo, employeeNo);
for (RouteOrder routeOrder : routeOrders) { for (RouteOrder routeOrder : routeOrders) {

View File

@ -114,7 +114,7 @@ public abstract class AbstractGenericRepository<T, ID> {
} }
// Step 4: Return the complete list // Step 4: Return the complete list
return inCacheList; return inCacheList.stream().filter(Objects::nonNull).collect(Collectors.toList());
} }
public List<T> findByFieldsIn(String fieldPrefix, public List<T> findByFieldsIn(String fieldPrefix,