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

com.nebula.boxes.mould.fetcher.ResumePairDataFetcher 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.ResumePairDataLoader;
import org.dataloader.DataLoader;
import org.springframework.context.annotation.Lazy;
import org.springframework.beans.factory.annotation.Autowired;
import com.nebula.boxes.mould.entity.ResumePair;
import com.nebula.boxes.mould.service.IResumePairService;
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 ResumePairDataFetcher {

    @Autowired
    private IResumePairService resumePairService;

    @Autowired
    private ContextAwarePoolExecutor contextAwarePoolExecutor;

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

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

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy