Java Code Examples for com.ruoyi.common.enums.BusinessType#GENCODE
The following examples show how to use
com.ruoyi.common.enums.BusinessType#GENCODE .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GenController.java From ruoyiplus with MIT License | 6 votes |
/** * 生成代码 */ @RequiresPermissions("tool:gen:code") @Log(title = "代码生成", businessType = BusinessType.GENCODE) @GetMapping("/genCode/{tableName}") public void genCode( HttpServletRequest request, HttpServletResponse response, @PathVariable("tableName") String tableName) throws IOException { byte[] data = genService.generatorCode(tableName, null); 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()); }
Example 2
Source File: GenController.java From supplierShop with MIT License | 5 votes |
/** * 生成代码 */ @RequiresPermissions("tool:gen:code") @Log(title = "代码生成", businessType = BusinessType.GENCODE) @GetMapping("/genCode/{tableName}") public void genCode(HttpServletResponse response, @PathVariable("tableName") String tableName) throws IOException { byte[] data = genTableService.generatorCode(tableName); genCode(response, data); }
Example 3
Source File: GenController.java From supplierShop with MIT License | 5 votes |
/** * 批量生成代码 */ @RequiresPermissions("tool:gen:code") @Log(title = "代码生成", businessType = BusinessType.GENCODE) @GetMapping("/batchGenCode") @ResponseBody public void batchGenCode(HttpServletResponse response, String tables) throws IOException { String[] tableNames = Convert.toStrArray(tables); byte[] data = genTableService.generatorCode(tableNames); genCode(response, data); }
Example 4
Source File: GenController.java From ruoyiplus with MIT License | 5 votes |
@RequiresPermissions("tool:gen:code") @Log(title = "根据预览的代码下载zip包", businessType = BusinessType.GENCODE) @GetMapping("/code-download") public void codeDownload(HttpServletRequest request, HttpServletResponse response) throws IOException { String tableName = Convert.toStr(request.getParameter("table")); // byte[] data = genService.ge byte[] data = null; 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()); }
Example 5
Source File: GenController.java From ruoyiplus with MIT License | 5 votes |
/** * 批量生成代码 */ @RequiresPermissions("tool:gen:code") @Log(title = "代码生成", businessType = BusinessType.GENCODE) @GetMapping("/batchGenCode") @ResponseBody public void batchGenCode(HttpServletResponse response, String tables) throws IOException { String[] tableNames = Convert.toStrArray(tables); byte[] data = genService.generatorCode(tableNames); 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()); }
Example 6
Source File: GenController.java From RuoYi with Apache License 2.0 | 5 votes |
/** * 生成代码 */ @RequiresPermissions("tool:gen:code") @Log(title = "代码生成", businessType = BusinessType.GENCODE) @GetMapping("/genCode/{tableName}") public void genCode(HttpServletResponse response, @PathVariable("tableName") String tableName) throws IOException { byte[] data = genService.generatorCode(tableName); this.genCode(response, data); }
Example 7
Source File: GenController.java From RuoYi with Apache License 2.0 | 5 votes |
/** * 批量生成代码 */ @RequiresPermissions("tool:gen:code") @Log(title = "代码生成", businessType = BusinessType.GENCODE) @GetMapping("/batchGenCode") @ResponseBody public void batchGenCode(HttpServletResponse response, String tables) throws IOException { String[] tableNames = Convert.toStrArray(tables); byte[] data = genService.generatorCode(tableNames); this.genCode(response, data); }
Example 8
Source File: GenController.java From ruoyiplus with MIT License | 4 votes |
@RequiresPermissions("tool:gen:code") @Log(title = "下载子工程", businessType = BusinessType.GENCODE) @GetMapping("/code-download-project") @ResponseBody public Map codeDownloadProject(HttpServletRequest request, HttpServletResponse response) throws IOException { Map<String, Object> retMap = new HashMap(); retMap.put("res", true); String path = Convert.toStr(request.getParameter("dir")); String basePackage = Convert.toStr(request.getParameter("pack"), "com.ruoyi"); String version = Convert.toStr(request.getParameter("version"), "3.2"); String projectName = Convert.toStr(request.getParameter("projectName"), "test"); path += (path.endsWith(File.separator) ? "" : File.separator) + projectName; // 生成maven项目结构 File maven = new File(path); maven.mkdirs(); File src = new File(maven, "src"); src.mkdirs(); File main = new File(src, "main"); main.mkdir(); File test = new File(src, "test"); test.mkdir(); File javsSource = new File(main, "java"); javsSource.mkdir(); File resource = new File(main, "resources"); resource.mkdir(); File sql = new File(resource, "sql"); sql.mkdir(); File staticFile = new File(resource, "static"); staticFile.mkdir(); File templatesFile = new File(resource, "templates"); templatesFile.mkdir(); String codePath = basePackage.replace(".", "/"); File codeFile = new File(javsSource, codePath); codeFile.mkdirs(); Map sourceFilesMap = genService.generatorProjectCode(projectName, version, basePackage); FileWriter fw = null; // 先生成入口程序 FileUtil.writeString( Convert.toStr(sourceFilesMap.get("vm/project/main.java.vm")), new File(codeFile, "MainApplication.java"), "UTF-8"); FileUtil.writeString( Convert.toStr(sourceFilesMap.get("vm/project/pom.xml.vm")), new File(maven, "pom.xml"), "UTF-8"); // 复制当前项目的配置文件 File config = copy(resource, "application.yml"); // TODO: 给application.yml的typeAliasesPackage设置子工程基类的扫描实体包 copy(resource, "application-druid.yml"); copy(resource, "logback.xml"); copy(resource, "banner.txt"); return retMap; }