
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, Human human) {
// Step.1 组装查询条件
QueryWrapper<Human> queryWrapper = QueryGenerator.initQueryWrapper(human, request.getParameterMap());
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
// Step.2 获取导出数据
if (human.getStatus()==null) {
queryWrapper.ne("status",5);
} else {
queryWrapper.eq("status", 5);
}
List<Human> pageList = humanService.list(queryWrapper);
List<Human> exportList = null;
// 过滤选中数据
String selections = request.getParameter("selections");
if (oConvertUtils.isNotEmpty(selections)) {
List<String> selectionList = Arrays.asList(selections.split(","));
exportList = pageList.stream().filter(item -> selectionList.contains(getId(item))).collect(Collectors.toList());
} else {
exportList = pageList;
}
int no = 1;
Map<String,Object> map = new HashMap<>();
List<Map<String,String>> listMap = new ArrayList<>();
for (Human humanObj : exportList) {
Map<String, String> lm = new HashMap<String, String>();
int age = DateUtils.getFullAgeByIdCard(humanObj.getIdNumber());
humanObj.setAge(age);
humanObj.setNo(String.valueOf(no++));
map.put("maplist",exportList);
}
System.out.println(exportList);
System.out.println(map);
// Step.3 AutoPoi 导出Excel
TemplateExportParams params = new TemplateExportParams();
String url = upLoadPath + File.separator + "template" + File.separator + "花名册模版.xls";
params.setTemplateUrl(url);
ModelAndView mv = new ModelAndView(new JeecgTemplateExcelView());
mv.addObject(TemplateExcelConstants.CLASS,Human.class);
mv.addObject(TemplateExcelConstants.PARAMS,params);
mv.addObject(TemplateExcelConstants.MAP_DATA,map);
mv.addObject(TemplateExcelConstants.FILE_NAME,"导出花名册");
return mv;
}

不知道你这个问题是否已经解决, 如果还没有解决的话:
如果你已经解决了该问题, 非常希望你能够分享一下解决方案, 写成博客, 将相关链接放在评论区, 以帮助更多的人 ^-^