Commit 362374d0 by RuoYi

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

parent c6c71a7e
......@@ -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;
}
}
\ No newline at end of file
......@@ -7,5 +7,5 @@ gen:
packageName: com.ruoyi.system
# 自动去除表前缀,默认是false
autoRemovePre: false
# 表前缀(类名不会包含表前缀)
# 表前缀(生成类名不会包含表前缀,多个用逗号分隔)
tablePrefix: sys_
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment