MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
MultipartFile file = entity.getValue();// 获取上传文件对象
ImportParams params = new ImportParams();
params.setTitleRows(2);
params.setSecondTitleRows(2);
params.setNeedSave(true);
try {
List<CourseEntity> listCourses =
(List<CourseEntity>)ExcelImportUtil.importExcelByIs(file.getInputStream(),CourseEntity.class,params);
for (CourseEntity course : listCourses) {
if(course.getName()!=null){