!90 抽取重复代码到一个方法

Merge pull request !90 from lywjlong/master
pull/90/MERGE
若依 6 years ago committed by Gitee
commit 661db11765

@ -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