springboot easyexcel
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的更多相关文章
- 使用VUE+SpringBoot+EasyExcel 整合导入导出数据
使用VUE+SpringBoot+EasyExcel 整合导入导出数据 创建一个普通的maven项目即可 项目目录结构 1 前端 存放在resources/static 下 index.html &l ...
- SpringBoot基于EasyExcel解析Excel实现文件导出导入、读取写入
1. 简介 Java解析.生成Excel比较有名的框架有Apache poi.jxl.但他们都存在一个严重的问题就是非常的耗内存,poi有一套SAX模式的API可以一定程度的解决一些内存溢出的问题 ...
- SpringBoot整合easyexcel实现Excel的导入与导出
导出 在一般不管大的或者小的系统中,各家的产品都一样,闲的无聊的时候都喜欢让我们这些程序员导出一些数据出来供他观赏,非说这是必须需求,非做不可,那么我们就只能苦逼的哼哧哼哧的写bug喽. 之前使用PO ...
- springboot整合easyexcel实现Excel导入导出
easyexcel:快速.简单避免OOM的java处理Excel工具 Java解析.生成Excel比较有名的框架有Apache poi.jxl.但他们都存在一个严重的问题就是非常的耗内存,poi有一套 ...
- SpringBoot基于easyexcel导出和写入Excel
easyexcel是阿里巴巴旗下开源项目,主要用于Excel文件的导入和导出处理,今天我们利用SpringBoot和easyexcel实战演示如何导出和写入Excel文件. 一.加入我们需要的ea ...
- SpringBoot图文教程14—SpringBoot集成EasyExcel「上」
有天上飞的概念,就要有落地的实现 概念十遍不如代码一遍,朋友,希望你把文中所有的代码案例都敲一遍 先赞后看,养成习惯 SpringBoot 图文教程系列文章目录 SpringBoot图文教程1「概念+ ...
- 使用Layui、Axios、Springboot(Java) 实现EasyExcel的导入导出(浏览器下载)
实现EasyExcel的导入导出(浏览器下载) 实现三个按钮的功能,但是却花费了一天的时间包括总结. 使用到的技术:springboot layui axios EasyExcel mybatis-p ...
- SpringBoot整合Easyexcel操作Excel,闲暇之余,让我们学习更多
关于封面:晚饭后回自习室的路上 Easyexcel 官方文档 Easyexcel | github 前言 最近也是在写的一个小练习中,需要用到这个.趁着这次就将写个整合的Demo给大家. 希望能够让大 ...
- Springboot使用EasyExcel(仅限自己收藏)
pom文件依赖 <dependency> <groupId>com.alibaba</groupId> <artifactId>easyexcel< ...
随机推荐
- 通过helm 安装 harbor 不成功问题处理
helm 安装 harbor 安装不成功处理过程 通过安装脚本 helm install c7n/harbor \ --set expose.ingress.hosts.core=harbor.ls. ...
- WPF/UWP 模板选择器 DataTemplateSelector
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.T ...
- 五、RF中UI自动化操作基础
列表分类 1.打开浏览器 Open Browser url browser [ url | browser=firefox | alias=None | remote_url=False | ...
- http-server 建立 HTTPS 服务
1. 创建证书 进入要建立 HTTPS 服务的目录 openssl genrsa -out key.pem 1024 openssl req -new -key key.pem -out csr.pe ...
- np.random.shuffle(x)与np.random.permutation(x)
来自:https://blog.csdn.net/brucewong0516/article/details/79012233 将数组打乱随机排列 两种方法: np.random.shuffle(x) ...
- C#接口的实现和继承实践
1.基本概念 接口是一种契约规范,类似于抽象基类.包括方法,属性,索引器和事件作为成员,这些成员只是作为定义,并不在接口中具体实现. 接口创建时注意以下事项: 继承接口的任何非抽象类都必须实现接口的所 ...
- 【Linux 应用编程】进程管理 - 进程间通信IPC之管道 pipe 和 FIFO
IPC(InterProcess Communication,进程间通信)是进程中的重要概念.Linux 进程之间常用的通信方式有: 文件:简单,低效,需要代码控制同步 管道:使用简单,默认阻塞 匿名 ...
- 远程桌面 虚拟打印 到本地打印机(虚拟化 终端 远程接入 RemoteApp)
使用远程桌面或remoteapp进行打印时,若需使用本地的打印机,需要通过重定向方式,但本地打印机如果五花八门比较杂,那给服务器安装打印机驱动很麻烦. 其实可以借助虚拟打印机简化操作,省去给服务器安装 ...
- WEB技术发展简史
一.Web技术发展的第一阶段——静态文档 第一阶段的Web,主要是用于静态Web页面的浏览.用户使用客户机端的Web浏览器,可以访问Internet上各个Web站点,在每一个站点上都有一个主页(Hom ...
- jyputer notebook 、jypyter、IPython basics
1 .修改jupyter默认工作目录:打开cmd,在命令行下指定想要进的工作目录,即键入“cd d/ G:\0工作面试\学习记录”标红部分是想要进入的工作目录. 2.Tab补全 a.在命令行输入表达 ...