現在的能跑,但是肯定寫的不好。
List<? extends WeatherData> data = weatherReportDao.getCoviReportData(reportType);
WeatherENUM weatherENUM = WeatherENUM.valueOf(reportFunction);
switch (weatherENUM){
case atmosphere:
data = atmosphereReportDao.getAtmosphereReportData(reportType);
break;
case covi:
data = weatherReportDao.getCoviReportData(reportType);
break;
case windSpeed:
data = windSpeedReportDao.getWindSpeedReportData(reportType);
break;
}
return data;
關鍵就是data的初始化,不初始化會報錯。求指導。
或想辦法把weatherENUM的某個值當作參數傳到dao
定義成全域量就不用初始化了。