// package org.dromara.common.batch.config;
//
// import lombok.RequiredArgsConstructor;
// import org.dromara.common.batch.processer.GameAthleteProcessor;
// import org.dromara.common.batch.writer.GameAthleteWriter;
// import org.dromara.system.domain.GameAthlete;
// import org.dromara.system.mapper.GameAthleteMapper;
// import org.springframework.batch.core.Job;
// import org.springframework.batch.core.Step;
// import org.springframework.batch.core.configuration.annotation.StepScope;
// import org.springframework.batch.item.ItemProcessor;
// import org.springframework.batch.item.ItemWriter;
// import org.springframework.batch.item.support.ListItemReader;
// import org.springframework.context.annotation.Bean;
// import org.springframework.context.annotation.Configuration;
//
// import java.util.List;
//
// @Configuration
// @RequiredArgsConstructor
// public class GameAthleteBatchConfig {
//
//     // private final JobBuilderFactory  jobBuilderFactory;
//     // private final StepBuilderFactory stepBuilderFactory;
//     private final GameAthleteMapper gameAthleteMapper;
//
//     @Bean
//     public Job gameAthleteUpsertJob() {
//         return jobBuilderFactory.get("gameAthleteUpsertJob")
//                 .start(upsertStep())
//                 .build();
//     }
//
//     @Bean
//     public Step upsertStep() {
//         return stepBuilderFactory.get("upsertStep")
//                 .<GameAthlete, GameAthlete>chunk(20) // 每100条处理一次
//                 .reader(itemReader(null))
//                 .processor(itemProcessor())
//                 .writer(itemWriter())
//                 .build();
//     }
//
//     @Bean
//     @StepScope
//     public ListItemReader<GameAthlete> itemReader(@Value("#{jobParameters['athletes']}") List<GameAthlete> athletes) {
//         return new ListItemReader<>(athletes);
//     }
//
//     @Bean
//     public ItemProcessor<GameAthlete, GameAthlete> itemProcessor() {
//         return new GameAthleteProcessor();
//     }
//
//     @Bean
//     public ItemWriter<GameAthlete> itemWriter() {
//         return new GameAthleteWriter(gameAthleteMapper);
//     }
// }
