|
|
|
@ -38,7 +38,6 @@ public class CodeGenerator { |
|
|
|
|
genCode("输入表名"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static void genCode(String... tableNames) { |
|
|
|
|
for (String tableName : tableNames) { |
|
|
|
|
//根据需求生成,不需要的注掉,模板有问题的话可以自己修改。
|
|
|
|
@ -48,7 +47,6 @@ public class CodeGenerator { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static void genModelAndMapper(String tableName) { |
|
|
|
|
Context context = new Context(ModelType.FLAT); |
|
|
|
|
context.setId("Potato"); |
|
|
|
@ -155,7 +153,6 @@ public class CodeGenerator { |
|
|
|
|
data.put("modelNameLowerCamel", tableNameConvertLowerCamel(tableName)); |
|
|
|
|
data.put("basePackage", ProjectConstant.BASE_PACKAGE); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
File file = new File(PROJECT_PATH + JAVA_PATH + PACKAGE_PATH_CONTROLLER + modelNameUpperCamel + "Controller.java"); |
|
|
|
|
if (!file.getParentFile().exists()) { |
|
|
|
|
file.getParentFile().mkdirs(); |
|
|
|
@ -178,7 +175,6 @@ public class CodeGenerator { |
|
|
|
|
return cfg; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static String tableNameConvertLowerCamel(String tableName) { |
|
|
|
|
StringBuilder result = new StringBuilder(); |
|
|
|
|
if (tableName != null && tableName.length() > 0) { |
|
|
|
@ -206,7 +202,6 @@ public class CodeGenerator { |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static String tableNameConvertMappingPath(String tableName) { |
|
|
|
|
return "/" + (tableName.contains("_") ? tableName.replaceAll("_", "/") : tableName); |
|
|
|
|
} |
|
|
|
|