{"id":208756,"date":"2020-11-22T14:43:45","date_gmt":"2020-11-22T06:43:45","guid":{"rendered":"http:\/\/4563.org\/?p=208756"},"modified":"2020-11-22T14:43:45","modified_gmt":"2020-11-22T06:43:45","slug":"java-%e4%bd%bf%e7%94%a8-requestexcel-%e5%92%8c-responseexcel-%e6%b3%a8%e8%a7%a3%e8%bd%bb%e6%9d%be%e4%b8%8a%e4%bc%a0%e5%92%8c%e4%b8%8b%e8%bd%bd-excel-%e6%96%87%e4%bb%b6","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=208756","title":{"rendered":"Java &#8211; \u4f7f\u7528 @RequestExcel \u548c @ResponseExcel \u6ce8\u89e3\u8f7b\u677e\u4e0a\u4f20\u548c\u4e0b\u8f7d Excel \u6587\u4ef6"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  Java &#8211; \u4f7f\u7528 @RequestExcel \u548c @ResponseExcel \u6ce8\u89e3\u8f7b\u677e\u4e0a\u4f20\u548c\u4e0b\u8f7d Excel \u6587\u4ef6               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : gaobing <\/span>  <span><i><\/i> 3<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>\u505a\u6210\u4e86 Spring Boot Starter \u7684\u5f62\u5f0f\uff0c\u65b9\u4fbf\u5f15\u5165\u4f7f\u7528\u3002<\/p>\n<p>\u4e0b\u8f7d\u793a\u4f8b\uff0c\u7c7b\u4f3c\u4e8e <code>@ResponseBody<\/code> \uff1a<\/p>\n<pre><code>@RequestMapping(\"\/download\") @ResponseExcel({\"name\", \"book.name\", \"book.author\"}) public List&lt;Character&gt; download() {     return listCharacters(); } <\/code><\/pre>\n<p>\u4e0a\u4f20\u793a\u4f8b\uff0c\u7c7b\u4f3c\u4e8e <code>@RequestParam<\/code> \uff1a<\/p>\n<pre><code>@RequestMapping(\"\/upload\") @ResponseBody public List&lt;Character&gt; upload(@RequestExcel(value = \"excel\", targetClass = Character.class,                                        fieldNames = {\"name\", \"book.name\", \"book.author\"})                            List&lt;Character&gt; characters) {     return characters; } <\/code><\/pre>\n<p>\u5df2\u63d0\u4ea4\u81f3 <code>Maven<\/code> \u4e2d\u592e\u4ed3\u5e93\u3002<\/p>\n<pre><code>&lt;dependency&gt;     &lt;groupId&gt;com.gaoice&lt;\/groupId&gt;     &lt;artifactId&gt;easyexcel-spring-boot-starter&lt;\/artifactId&gt;     &lt;version&gt;2.0&lt;\/version&gt; &lt;\/dependency&gt; <\/code><\/pre>\n<p>\u6b22\u8fce\u4f7f\u7528\u548c Star ^_^<\/p>\n<p><strong>GitHub\uff1a<\/strong> https:\/\/github.com\/gaoice\/easyexcel-spring-boot-starter<\/p>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>6<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"4341770\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : ychost <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u8d5e\uff01\uff01                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4341771\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : fd7917931e <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u8fd9\u4e2a\u4e0d\u9519!                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4341772\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : shuige <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             2.0 \u54ea\u91cc\u4e0b\u8f7d\uff1f                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4341773\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : zsl199512101234 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u8d5e,\u4e00\u5f00\u59cb\u4ee5\u4e3a\u5565 Alibaba \u7684\u90a3\u4e2a easyexcel \u5462                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4341774\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : 2han9wen71an <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u8bf7\u95ee\u53ea\u80fd\u5728 spring \u4e0a\u7528\u5417?\u6211\u4eec\u5e73\u5e38\u4f7f\u7528\u7684 resteasy \u52a0 guice \u6765\u5f00\u53d1\u80fd\u4f7f\u7528\u5417?                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4341775\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : gaobing <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @shuige \u73b0\u5728\u4e2d\u592e\u4ed3\u5e93\u5e94\u8be5\u53ef\u4ee5\u4e86\uff0c[https:\/\/search.maven.org\/artifact\/com.gaoice\/easyexcel-spring-boot-starter\/2.0\/jar]( https:\/\/search.maven.org\/artifact\/com.gaoice\/easyexcel-spring-boot-starter\/2.0\/jar) \uff0c\u5176\u5b83\u4ed3\u5e93\u7b49\u540c\u6b65\u8fc7\u53bb\u624d\u53ef\u4ee5<\/p>\n<p>@2han9wen71an \u6ce8\u89e3\u662f\u53ea\u80fd\u5728 Spring \u4e2d\u4f7f\u7528\u3002\u5de5\u5177\u7c7b\u53ef\u4ee5\u5728\u5176\u5b83\u6846\u67b6\u4f7f\u7528\uff1a[https:\/\/github.com\/gaoice\/easyexcel]( https:\/\/github.com\/gaoice\/easyexcel)                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>Java &#8211; \u4f7f\u7528 @&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/208756"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=208756"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/208756\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=208756"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=208756"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=208756"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}