package com.sysu.admin.controller.analyse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @author shu hao
 * @description:
 * @date 2022/5/19 16:32
 */
@Component
public class AnalyseServiceManager {

    @Autowired
    private TownsAnalyseService townsAnalyseService;
    @Autowired
    private VillageAnalyseService villageAnalyseService;
    @Autowired
    private CropAnalyseService cropAnalyseService;

    public AnalyseService newInstance(AnalyseType analyseType) {
        switch (analyseType){
            case towns:
                return townsAnalyseService;
            case village:
                return villageAnalyseService;
            case crop:
                return cropAnalyseService;
        }
        throw new RuntimeException("无效的 AnalyseType");
    }

}
