|
|
@@ -75,6 +75,38 @@ public class JeecgController<T, S extends IService<T>> {
|
|
|
mv.addObject(NormalExcelConstants.DATA_LIST, exportList);
|
|
|
return mv;
|
|
|
}
|
|
|
+ /**
|
|
|
+ * 导出excel
|
|
|
+ *
|
|
|
+ * @param request
|
|
|
+ */
|
|
|
+ protected ModelAndView exportXlsEmpty(HttpServletRequest request, T object, Class<T> clazz, String title) {
|
|
|
+ // Step.1 组装查询条件
|
|
|
+// QueryWrapper<T> queryWrapper = QueryGenerator.initQueryWrapper(object, request.getParameterMap());
|
|
|
+ LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
|
+
|
|
|
+// // 过滤选中数据
|
|
|
+// String selections = request.getParameter("selections");
|
|
|
+// if (oConvertUtils.isNotEmpty(selections)) {
|
|
|
+// List<String> selectionList = Arrays.asList(selections.split(","));
|
|
|
+// queryWrapper.in("id",selectionList);
|
|
|
+// }
|
|
|
+ // Step.2 获取导出数据
|
|
|
+ List<T> exportList = new ArrayList<>();
|
|
|
+
|
|
|
+ // Step.3 AutoPoi 导出Excel
|
|
|
+ ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
|
|
|
+ //此处设置的filename无效 ,前端会重更新设置一下
|
|
|
+ mv.addObject(NormalExcelConstants.FILE_NAME, title);
|
|
|
+ mv.addObject(NormalExcelConstants.CLASS, clazz);
|
|
|
+ //update-begin--Author:liusq Date:20210126 for:图片导出报错,ImageBasePath未设置--------------------
|
|
|
+ ExportParams exportParams=new ExportParams(title + "报表", "导出人:" + sysUser.getRealname(), title);
|
|
|
+ exportParams.setImageBasePath(upLoadPath);
|
|
|
+ //update-end--Author:liusq Date:20210126 for:图片导出报错,ImageBasePath未设置----------------------
|
|
|
+ mv.addObject(NormalExcelConstants.PARAMS,exportParams);
|
|
|
+ mv.addObject(NormalExcelConstants.DATA_LIST, exportList);
|
|
|
+ return mv;
|
|
|
+ }
|
|
|
/**
|
|
|
* 根据每页sheet数量导出多sheet
|
|
|
*
|