com.nebula.boxes.mould.fetcher.async.ResumeEduTrunkApi Maven / Gradle / Ivy
The newest version!
package com.nebula.boxes.mould.fetcher.async;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import java.util.Optional;
import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.function.Function;
import java.util.stream.Collectors;
import com.nebula.boxes.mould.entity.ResumeEdu;
import com.nebula.boxes.mould.service.IResumeEduService;
import com.spring.boxes.dollar.enums.EnableEnum;
import com.spring.boxes.dollar.support.ContextAwarePoolExecutor;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import lombok.extern.slf4j.Slf4j;
@Lazy
@Slf4j
@Service
public class ResumeEduTrunkApi {
@Autowired
private IResumeEduService resumeEduService;
@Autowired
private ContextAwarePoolExecutor contextAwarePoolExecutor;
public CompletableFuture selectOneById(Long id) {
ResumeEdu one = Optional.ofNullable(id)
.map(x -> resumeEduService.getById(id))
.orElse(null);
return CompletableFuture.supplyAsync(() -> one, contextAwarePoolExecutor);
}
public CompletableFuture> selectListByIds(Collection ids) {
if (CollectionUtils.isEmpty(ids)) {
return CompletableFuture.supplyAsync(ArrayList::new, contextAwarePoolExecutor);
}
Collection list = resumeEduService.listByIds(ids);
return CompletableFuture.supplyAsync(() -> list, contextAwarePoolExecutor);
}
public CompletableFuture