1 Star 0 Fork 4

gaobing/easyexcel-spring-boot-starter

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
README.md 1.75 KB
一键复制 编辑 原始数据 按行查看 历史
gaobing 提交于 5年前 . Update README.md

Easyexcel Spring Boot Starter

概述

在 Spring Boot 中使用 @RequestExcel@ResponseExcel 注解轻松上传和下载 Excel 文件。

使用

下载示例,类似于 @ResponseBody

@RequestMapping("/download")
@ResponseExcel({"name", "book.name", "book.author"})
public List<Character> download() {
    return listCharacters();
}

上传示例,类似于 @RequestParam

@RequestMapping("/upload")
@ResponseBody
public List<Character> upload(@RequestExcel(value = "excel", targetClass = Character.class, 
                                    		fieldNames = {"name", "book.name", "book.author"}) 
                      		  List<Character> characters) {
    return characters;
}

已提交至 Maven 中央仓库。

Maven

<dependency>
    <groupId>com.gaoice</groupId>
    <artifactId>easyexcel-spring-boot-starter</artifactId>
    <version>2.0</version>
</dependency>

新版本

  • v 2.0,新增 @RequestExcel 注解。

示例

查看 ExcelUploadController 中的上传示例。

查看 ExcelDownloadController 中的下载示例。

运行 DemoApplication ,在 upload.html 尝试导入功能,访问相应的接口查看效果。

Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Java
1
https://gitee.com/gaoice/easyexcel-spring-boot-starter.git
git@gitee.com:gaoice/easyexcel-spring-boot-starter.git
gaoice
easyexcel-spring-boot-starter
easyexcel-spring-boot-starter
master

搜索帮助