1.环境配置
<!--easypoi依赖,excel导入导出-->
<dependency>
<groupId>cn.afterturn</groupId>
<artifactId>easypoi-spring-boot-starter</artifactId>
<version>4.3.0</version>
</dependency>
2.先来定义两个导出数据的实体类
ExcelUser.java
public class Dept{
@Excel(name = "部门编号", width = 30 , needMerge = true)
private Integer id;
@Excel(name = "部门名称", width = 30 , needMerge = true)
private String deptName;
@ExcelCollection(name = "员工信息")
private List<EmpUtil> emps;
....省略getter、setter方法
ExcelLog.java
public class ExcelLog{
@Excel(name = "序号", width = 30, isColumnHidden = true)
private Integer id;
@Excel(name = "员工姓名"