現在的能跑,但是肯定寫的不好。
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的初始化,不初始化會報錯。求指導。
習慣沉默2017-05-17 10:10:39
List<? extends WeatherData> data = null;
或想辦法把weatherENUM的某個值當作參數傳到dao
List<? extends WeatherData> data = weatherReportDao.getReportData(reportType,dataType);