src/main/java/com/ruoyi/framework/config/GenConfig.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/ruoyi/project/tool/gen/controller/GenController.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/resources/application.yml | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
src/main/java/com/ruoyi/framework/config/GenConfig.java
@@ -18,11 +18,14 @@ /** 生成包路径 */ public static String packageName; /** 自动去除表前缀,默认是true */ /** 自动去除表前缀 */ public static boolean autoRemovePre; /** 表前缀(类名不会包含表前缀) */ /** 表前缀 */ public static String tablePrefix; /** 是否允许生成文件覆盖到本地(自定义路径) */ public static boolean allowOverwrite; public static String getAuthor() { @@ -63,4 +66,14 @@ { GenConfig.tablePrefix = tablePrefix; } public static boolean isAllowOverwrite() { return allowOverwrite; } public void setAllowOverwrite(boolean allowOverwrite) { GenConfig.allowOverwrite = allowOverwrite; } } src/main/java/com/ruoyi/project/tool/gen/controller/GenController.java
@@ -27,6 +27,7 @@ import com.ruoyi.common.utils.sql.SqlUtil; import com.ruoyi.framework.aspectj.lang.annotation.Log; import com.ruoyi.framework.aspectj.lang.enums.BusinessType; import com.ruoyi.framework.config.GenConfig; import com.ruoyi.framework.web.controller.BaseController; import com.ruoyi.framework.web.domain.AjaxResult; import com.ruoyi.framework.web.page.TableDataInfo; @@ -213,6 +214,10 @@ @GetMapping("/genCode/{tableName}") public AjaxResult genCode(@PathVariable("tableName") String tableName) { if (!GenConfig.isAllowOverwrite()) { return AjaxResult.error("【系统预设】不允许生成文件覆盖到本地"); } genTableService.generatorCode(tableName); return success(); } src/main/resources/application.yml
@@ -137,4 +137,6 @@ # 自动去除表前缀,默认是true autoRemovePre: false # 表前缀(生成类名不会包含表前缀,多个用逗号分隔) tablePrefix: sys_ tablePrefix: sys_ # 是否允许生成文件覆盖到本地(自定义路径),默认不允许 allowOverwrite: false