代码生成新增配置是否允许文件覆盖到本地
This commit is contained in:
parent
1234683bdb
commit
cdfd9fd81e
@ -18,12 +18,15 @@ public class GenConfig
|
|||||||
/** 生成包路径 */
|
/** 生成包路径 */
|
||||||
public static String packageName;
|
public static String packageName;
|
||||||
|
|
||||||
/** 自动去除表前缀,默认是true */
|
/** 自动去除表前缀 */
|
||||||
public static boolean autoRemovePre;
|
public static boolean autoRemovePre;
|
||||||
|
|
||||||
/** 表前缀(类名不会包含表前缀) */
|
/** 表前缀 */
|
||||||
public static String tablePrefix;
|
public static String tablePrefix;
|
||||||
|
|
||||||
|
/** 是否允许生成文件覆盖到本地(自定义路径) */
|
||||||
|
public static boolean allowOverwrite;
|
||||||
|
|
||||||
public static String getAuthor()
|
public static String getAuthor()
|
||||||
{
|
{
|
||||||
return author;
|
return author;
|
||||||
@ -63,4 +66,14 @@ public class GenConfig
|
|||||||
{
|
{
|
||||||
GenConfig.tablePrefix = tablePrefix;
|
GenConfig.tablePrefix = tablePrefix;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isAllowOverwrite()
|
||||||
|
{
|
||||||
|
return allowOverwrite;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAllowOverwrite(boolean allowOverwrite)
|
||||||
|
{
|
||||||
|
GenConfig.allowOverwrite = allowOverwrite;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,7 @@ import com.ruoyi.common.utils.SecurityUtils;
|
|||||||
import com.ruoyi.common.utils.sql.SqlUtil;
|
import com.ruoyi.common.utils.sql.SqlUtil;
|
||||||
import com.ruoyi.framework.aspectj.lang.annotation.Log;
|
import com.ruoyi.framework.aspectj.lang.annotation.Log;
|
||||||
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
|
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.controller.BaseController;
|
||||||
import com.ruoyi.framework.web.domain.AjaxResult;
|
import com.ruoyi.framework.web.domain.AjaxResult;
|
||||||
import com.ruoyi.framework.web.page.TableDataInfo;
|
import com.ruoyi.framework.web.page.TableDataInfo;
|
||||||
@ -213,6 +214,10 @@ public class GenController extends BaseController
|
|||||||
@GetMapping("/genCode/{tableName}")
|
@GetMapping("/genCode/{tableName}")
|
||||||
public AjaxResult genCode(@PathVariable("tableName") String tableName)
|
public AjaxResult genCode(@PathVariable("tableName") String tableName)
|
||||||
{
|
{
|
||||||
|
if (!GenConfig.isAllowOverwrite())
|
||||||
|
{
|
||||||
|
return AjaxResult.error("【系统预设】不允许生成文件覆盖到本地");
|
||||||
|
}
|
||||||
genTableService.generatorCode(tableName);
|
genTableService.generatorCode(tableName);
|
||||||
return success();
|
return success();
|
||||||
}
|
}
|
||||||
|
@ -137,4 +137,6 @@ gen:
|
|||||||
# 自动去除表前缀,默认是true
|
# 自动去除表前缀,默认是true
|
||||||
autoRemovePre: false
|
autoRemovePre: false
|
||||||
# 表前缀(生成类名不会包含表前缀,多个用逗号分隔)
|
# 表前缀(生成类名不会包含表前缀,多个用逗号分隔)
|
||||||
tablePrefix: sys_
|
tablePrefix: sys_
|
||||||
|
# 是否允许生成文件覆盖到本地(自定义路径),默认不允许
|
||||||
|
allowOverwrite: false
|
Loading…
Reference in New Issue
Block a user