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

pull/130/head
RuoYi 5 years ago
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…
Cancel
Save