Bootstrap

SpringBoot整合easyExcel——数据导出

这几天修改公司系统里的导出功能,因而接触到了easyExcel,也在easyExcel的官方文档里浅看了两天,但也是一知半解,不过经主管的指点,也完成了导出功能的修改,这里做个完整的记录:

 pom配置文件

        <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>easyexcel</artifactId>
            <version>2.2.6</version>
        </dependency>

实体类:

实体类不引用了,就是正常写,无需特殊照顾

controller层:

@ResponseBody
	@RequestMapping(value = "/export", method = RequestMethod.POST)
	public ResponseData export(@RequestParam Map<String, Object> params) {
		String fileName = "服装信息";
    	fileName = UUID.randomUUID().toString() + "_" + fileName + ".xlsx";
    	String folder = Global.getTempPath() + File.separator + "pio" + File.separator;
    	FileUtil.touch(folder + fileName);
    	List<BusinessClothingEntity> listData = businessClothingService.export(params);
    	List<ClothingExcel> excels = new ArrayList<>();
    	for (BusinessClothingEntity number : listData) {
    		ClothingExcel c
;