All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.nebula.boxes.mould.fetcher.RecruitInputDataFetcher Maven / Gradle / Ivy

The newest version!
package com.nebula.boxes.mould.fetcher;

import java.util.List;
import java.util.concurrent.CompletableFuture;

import com.nebula.boxes.mould.fetcher.loader.RecruitInputDataLoader;
import org.dataloader.DataLoader;
import org.springframework.context.annotation.Lazy;
import org.springframework.beans.factory.annotation.Autowired;
import com.nebula.boxes.mould.entity.RecruitInput;
import com.nebula.boxes.mould.service.IRecruitInputService;
import com.netflix.graphql.dgs.DgsComponent;
import com.netflix.graphql.dgs.DgsData;
import com.netflix.graphql.dgs.DgsDataFetchingEnvironment;
import com.spring.boxes.dollar.support.ContextAwarePoolExecutor;
import graphql.schema.DataFetchingEnvironment;
import lombok.extern.slf4j.Slf4j;

/**
* 简历投递信息 Fetcher
*/
@Lazy
@Slf4j
@DgsComponent
public class RecruitInputDataFetcher {

    @Autowired
    private IRecruitInputService recruitInputService;

    @Autowired
    private ContextAwarePoolExecutor contextAwarePoolExecutor;

    @DgsData(parentType = "Query", field = "getRecruitInputById")
    public CompletableFuture getRecruitInputById(DataFetchingEnvironment dfe) {
        DgsDataFetchingEnvironment environment = (DgsDataFetchingEnvironment) dfe;
        long id = environment.getArgument("id");
        DataLoader dataLoader = environment.getDataLoader(RecruitInputDataLoader.class);
        return dataLoader.load(id);
    }

    @DgsData(parentType = "Query", field = "getRecruitInputByIds")
    public CompletableFuture> getRecruitInputByIds(DataFetchingEnvironment dfe) {
        DgsDataFetchingEnvironment environment = (DgsDataFetchingEnvironment) dfe;
        List ids = environment.getArgument("ids");
        DataLoader dataLoader = environment.getDataLoader(RecruitInputDataLoader.class);
        return dataLoader.loadMany(ids);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy