mirror of https://gitee.com/y_project/RuoYi.git
代码生成表前缀配置支持多个
parent
c6c71a7e70
commit
362374d0b7
|
@ -164,7 +164,9 @@ public class GenUtils
|
|||
String tablePrefix = GenConfig.getTablePrefix();
|
||||
if (autoRemovePre && StringUtils.isNotEmpty(tablePrefix))
|
||||
{
|
||||
tableName = tableName.replaceFirst(tablePrefix, "");
|
||||
String[] searchList = StringUtils.split(tablePrefix, ",");
|
||||
String[] replacementList = emptyList(searchList.length);
|
||||
tableName = StringUtils.replaceEach(tableName, searchList, replacementList);
|
||||
}
|
||||
return StringUtils.convertToCamelCase(tableName);
|
||||
}
|
||||
|
@ -216,4 +218,20 @@ public class GenUtils
|
|||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取空数组列表
|
||||
*
|
||||
* @param length 长度
|
||||
* @return 数组信息
|
||||
*/
|
||||
public static String[] emptyList(int length)
|
||||
{
|
||||
String[] values = new String[length];
|
||||
for (int i = 0; i < length; i++)
|
||||
{
|
||||
values[i] = StringUtils.EMPTY;
|
||||
}
|
||||
return values;
|
||||
}
|
||||
}
|
|
@ -7,5 +7,5 @@ gen:
|
|||
packageName: com.ruoyi.system
|
||||
# 自动去除表前缀,默认是false
|
||||
autoRemovePre: false
|
||||
# 表前缀(类名不会包含表前缀)
|
||||
# 表前缀(生成类名不会包含表前缀,多个用逗号分隔)
|
||||
tablePrefix: sys_
|
Loading…
Reference in New Issue