代码生成表前缀配置支持多个

master
RuoYi 5 years ago committed by Limy
parent 62f6d2bee6
commit ef2d1476f1

@ -164,7 +164,9 @@ public class GenUtils
String tablePrefix = GenConfig.getTablePrefix(); String tablePrefix = GenConfig.getTablePrefix();
if (autoRemovePre && StringUtils.isNotEmpty(tablePrefix)) 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); return StringUtils.convertToCamelCase(tableName);
} }
@ -216,4 +218,20 @@ public class GenUtils
return 0; 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 packageName: com.ruoyi.system
# 自动去除表前缀默认是false # 自动去除表前缀默认是false
autoRemovePre: false autoRemovePre: false
# 表前缀(类名不会包含表前缀) # 表前缀(生成类名不会包含表前缀,多个用逗号分隔)
tablePrefix: sys_ tablePrefix: sys_
Loading…
Cancel
Save