pom..xml

<dependency>
<groupId>com.alibaba</groupId>
<artifactId>easyexcel</artifactId>
<version>1.1.2-beat1</version>
</dependency>
AddCasesBindExl.java
package com.zjjw.cases.mode.exl;

import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.metadata.BaseRowModel;
import lombok.Data; /**
* @author tongzuqi
* @date: 2019/12/10 9:26 AM
*/
@Data
public class AddCasesBindExl extends BaseRowModel { /**
* 案件类型
*/
private String casesTypeName;
/**
* 律师
*/
@ExcelProperty(value ="律师",index = 0)
private String lawyerName;
/**
* 律师电话
*/
@ExcelProperty(value ="律师电话",index = 1)
private String lawyerMobile;
/**
* 所属律所
*/
@ExcelProperty(value ="所属律所",index = 2)
private String lawyerOffice;
/**
* 单位编号
*/
private String deptCode;
/**
* 单位名称
*/
@ExcelProperty(value ="单位名称",index = 3)
private String deptName;
/**
* 审核状态
*/
private int auditStatus;
/**
* 审核状态名称
*/
@ExcelProperty(value ="审核状态名称",index = 4)
private String auditStatusStr;
/**
* 案件编号
*/
private String casesCode;
/**
* 案件名称
*/
@ExcelProperty(value ="案件名称",index = 5)
private String casesName;
/**
* 创建时间
*/
@ExcelProperty(value ="创建时间",index = 6)
private String createTime; }
ExportController.java
    /**
* 新增案件列表统计
* @return
*/
@GetMapping("/addCasesBind")
public void addCasesBindPage(HttpServletResponse response , StatisticsCasesBindFo statisticsRegisterFo) throws Exception {
ExcelWriter writer = null;
OutputStream outputStream = response.getOutputStream();
long startTime=System.currentTimeMillis();
try {
//添加响应头信息
response.setHeader("Content-disposition", "attachment; filename=" + "新增案件列表.xlsx");
response.setContentType("application/msexcel;charset=UTF-8");//设置类型
response.setHeader("Pragma", "No-cache");//设置头
response.setHeader("Cache-Control", "no-cache");//设置头
response.setDateHeader("Expires", 0);//设置日期头 //实例化 ExcelWriter
writer = new ExcelWriter(outputStream, ExcelTypeEnum.XLSX, true); //实例化表单
Sheet sheet = new Sheet(1, 0, AddCasesBindExl.class);
sheet.setSheetName("sheel");
//获取数据
List<AddCasesBindExl> list = exportService.addCasesBindExport(statisticsRegisterFo);
log.info("查询时间:{}s.条数:{}",(float)(System.currentTimeMillis()-startTime)/1000,list.size()); startTime=System.currentTimeMillis();
//输出
writer.write(list, sheet);
writer.finish();
outputStream.flush();
} catch (IOException e) {
log.info("导出异常",e);
} finally {
try {
response.getOutputStream().close();
} catch (IOException e) {
log.info("导出异常",e);
}
}
log.info("导出:{}s",(float)(System.currentTimeMillis()-startTime)/1000);
}

springboot easyexcel的更多相关文章

  1. 使用VUE+SpringBoot+EasyExcel 整合导入导出数据

    使用VUE+SpringBoot+EasyExcel 整合导入导出数据 创建一个普通的maven项目即可 项目目录结构 1 前端 存放在resources/static 下 index.html &l ...

  2. SpringBoot基于EasyExcel解析Excel实现文件导出导入、读取写入

    1. 简介   Java解析.生成Excel比较有名的框架有Apache poi.jxl.但他们都存在一个严重的问题就是非常的耗内存,poi有一套SAX模式的API可以一定程度的解决一些内存溢出的问题 ...

  3. SpringBoot整合easyexcel实现Excel的导入与导出

    导出 在一般不管大的或者小的系统中,各家的产品都一样,闲的无聊的时候都喜欢让我们这些程序员导出一些数据出来供他观赏,非说这是必须需求,非做不可,那么我们就只能苦逼的哼哧哼哧的写bug喽. 之前使用PO ...

  4. springboot整合easyexcel实现Excel导入导出

    easyexcel:快速.简单避免OOM的java处理Excel工具 Java解析.生成Excel比较有名的框架有Apache poi.jxl.但他们都存在一个严重的问题就是非常的耗内存,poi有一套 ...

  5. SpringBoot基于easyexcel导出和写入Excel

      easyexcel是阿里巴巴旗下开源项目,主要用于Excel文件的导入和导出处理,今天我们利用SpringBoot和easyexcel实战演示如何导出和写入Excel文件. 一.加入我们需要的ea ...

  6. SpringBoot图文教程14—SpringBoot集成EasyExcel「上」

    有天上飞的概念,就要有落地的实现 概念十遍不如代码一遍,朋友,希望你把文中所有的代码案例都敲一遍 先赞后看,养成习惯 SpringBoot 图文教程系列文章目录 SpringBoot图文教程1「概念+ ...

  7. 使用Layui、Axios、Springboot(Java) 实现EasyExcel的导入导出(浏览器下载)

    实现EasyExcel的导入导出(浏览器下载) 实现三个按钮的功能,但是却花费了一天的时间包括总结. 使用到的技术:springboot layui axios EasyExcel mybatis-p ...

  8. SpringBoot整合Easyexcel操作Excel,闲暇之余,让我们学习更多

    关于封面:晚饭后回自习室的路上 Easyexcel 官方文档 Easyexcel | github 前言 最近也是在写的一个小练习中,需要用到这个.趁着这次就将写个整合的Demo给大家. 希望能够让大 ...

  9. Springboot使用EasyExcel(仅限自己收藏)

    pom文件依赖 <dependency> <groupId>com.alibaba</groupId> <artifactId>easyexcel< ...

随机推荐

  1. 电脑出现了一块tap window adapter v9 网卡 以及虚拟机桥接模式无法通信原因

    计算机与外界局域网的连接是通过主机箱内插入一块网络接口板(或者是在笔记本电脑中插入一块PCMCIA卡).网络接口板又称为通信适配器或网络适配器(network adapter)或网络接口卡NIC(Ne ...

  2. ES6正则拓展

    字符串的正则方法 字符串对象共有 4 个方法,可以使用正则表达式:match().replace().search()和split(). ES6 将这 4 个方法,在语言内部全部调用RegExp的实例 ...

  3. 纯css闪烁效果

    .i-i-box-active{ -webkit-animation: shan666 1s infinite ease-in-out; animation: shan666 1s infinite ...

  4. spring(二) JDBC

    一.配置 bean.xml , 链接数据库. c3p0数据库连接池 <?xml version="1.0" encoding="UTF-8"?> & ...

  5. 【MM系列】SAP MM模块-分析采购收货完成标识

    公众号:SAP Technical 本文作者:matinal 原文出处:http://www.cnblogs.com/SAPmatinal/ 原文链接:[MM系列]SAP MM模块-分析采购收货完成标 ...

  6. javascript 异常处理

    <!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8" ...

  7. 【监控笔记】【2.3】扩展事件——慢查询SQL(执行超过3S的SQL)

    --sql server 2008及以上才支持,2012及以上才支持GUI界面 msdn 扩展事件:点击打开链接 [1]T-SQL实现 基于 rpc_completed(远程过程调用已完成时发生) 事 ...

  8. Element-ui 使用详细介绍

    一.后台搭建 使用 vue-admin-template 来快速搭建后台管理,它包含了 Element UI & axios & iconfont & permission c ...

  9. Tomcat 一台机器运行多个Tomcat

    转 https://www.cnblogs.com/andy1234/p/8866588.html 在一台Win10 PC 上面同时开启两个Tomcat系统为例. 1. 硬件环境 2. 到Tomcat ...

  10. 使用before和after双伪元素清除浮动

    使用方法: .clearfix:before,.clearfix:after { content:"."; display:table; } .clearfix:after { c ...