Commit 666e319c by 独孤求胜 Committed by Gitee

!2 支持多个tablePrefix,以逗号隔开

Merge pull request !2 from minbyte/master
parents 4a9e0530 3201600b
...@@ -57,7 +57,7 @@ public class GenUtils { ...@@ -57,7 +57,7 @@ public class GenUtils {
tableEntity.setTableName(table.get("tableName" )); tableEntity.setTableName(table.get("tableName" ));
tableEntity.setComments(table.get("tableComment" )); tableEntity.setComments(table.get("tableComment" ));
//表名转换成Java类名 //表名转换成Java类名
String className = tableToJava(tableEntity.getTableName(), config.getString("tablePrefix" )); String className = tableToJava(tableEntity.getTableName(), config.getStringArray("tablePrefix"));
tableEntity.setClassName(className); tableEntity.setClassName(className);
tableEntity.setClassname(StringUtils.uncapitalize(className)); tableEntity.setClassname(StringUtils.uncapitalize(className));
...@@ -150,9 +150,11 @@ public class GenUtils { ...@@ -150,9 +150,11 @@ public class GenUtils {
/** /**
* 表名转换成Java类名 * 表名转换成Java类名
*/ */
public static String tableToJava(String tableName, String tablePrefix) { public static String tableToJava(String tableName, String[] tablePrefixArray) {
if (StringUtils.isNotBlank(tablePrefix)) { if(null != tablePrefixArray && tablePrefixArray.length>0){
tableName = tableName.replaceFirst(tablePrefix, "" ); for(String tablePrefix : tablePrefixArray){
tableName = tableName.replace(tablePrefix, "");
}
} }
return columnToJava(tableName); return columnToJava(tableName);
} }
......
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