update > optimize code

master
lihengming 8 years ago
parent 87ed8488e8
commit a70333bb96
  1. 5
      src/test/java/CodeGenerator.java

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

Loading…
Cancel
Save