代码下载的后端 api 接口,完成~

This commit is contained in:
YunaiV
2021-02-10 18:13:25 +08:00
parent 8cfb82659b
commit 6ca92b0efc
3 changed files with 10 additions and 75 deletions

View File

@@ -76,17 +76,6 @@ public class GenController extends BaseController {
return AjaxResult.success();
}
/**
* 生成代码(下载方式)
*/
@PreAuthorize("@ss.hasPermi('tool:gen:code')")
@Log(title = "代码生成", businessType = BusinessType.GENCODE)
@GetMapping("/download/{tableName}")
public void download(HttpServletResponse response, @PathVariable("tableName") String tableName) throws IOException {
byte[] data = genTableService.downloadCode(tableName);
genCode(response, data);
}
/**
* 生成代码(自定义路径)
*/

View File

@@ -127,21 +127,6 @@ public class GenTableServiceImpl implements IGenTableService {
}
}
/**
* 生成代码(下载方式)
*
* @param tableName 表名称
* @return 数据
*/
@Override
public byte[] downloadCode(String tableName) {
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
ZipOutputStream zip = new ZipOutputStream(outputStream);
generatorCode(tableName, zip);
IOUtils.closeQuietly(zip);
return outputStream.toByteArray();
}
/**
* 同步数据库