use of com.hb0730.boot.admin.exceptions.ExportExceptions in project boot-admin by hb0730.
the class PostController method export.
/**
* 导出
*
* @param response 响应
* @param params 请求参数,用于导出过滤
* @throws ExportExceptions 导出异常
*/
@Override
@PostMapping("/export")
@Log(value = "导出", paramsName = { "params" }, businessType = BusinessTypeEnum.EXPORT)
@PreAuthorize("hasAnyAuthority('ROLE_ADMINISTRATOR','post:export')")
public void export(HttpServletResponse response, @RequestBody PostParams params) throws ExportExceptions {
List<PostExcelDTO> export = service.export(params);
HashMap<String, Object> map = Maps.newHashMap();
try {
map.put(ExcelConstant.FILE_NAME, "post_excel");
map.put(ExcelConstant.DATA_LIST, export);
ExcelUtils.writeWeb(response, map, ExcelTypeEnum.XLS, PostExcelDTO.class);
} catch (Exception e) {
e.printStackTrace();
throw new ExportExceptions("岗位导出失败", e);
}
}
Aggregations