抽取重复代码到一个方法

dep_wangsr
wangjianlong 6 years ago committed by Limy
parent a111552365
commit 57000c133a

@ -60,12 +60,7 @@ public class GenController extends BaseController
public void genCode(HttpServletResponse response, @PathVariable("tableName") String tableName) throws IOException
{
byte[] data = genService.generatorCode(tableName);
response.reset();
response.setHeader("Content-Disposition", "attachment; filename=\"ruoyi.zip\"");
response.addHeader("Content-Length", "" + data.length);
response.setContentType("application/octet-stream; charset=UTF-8");
IOUtils.write(data, response.getOutputStream());
genCode(response, data);
}
/**
@ -79,6 +74,16 @@ public class GenController extends BaseController
{
String[] tableNames = Convert.toStrArray(tables);
byte[] data = genService.generatorCode(tableNames);
genCode(response, data);
}
/**
* zip
* @param response
* @param data
* @throws IOException
*/
private void genCode(HttpServletResponse response, byte[] data) throws IOException {
response.reset();
response.setHeader("Content-Disposition", "attachment; filename=\"ruoyi.zip\"");
response.addHeader("Content-Length", "" + data.length);

Loading…
Cancel
Save