|
@@ -5,11 +5,35 @@
|
|
*/
|
|
*/
|
|
package com.aizuda.generator;
|
|
package com.aizuda.generator;
|
|
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|
|
|
+
|
|
|
|
+import java.util.Scanner;
|
|
|
|
+
|
|
public class TestCodeGenerator {
|
|
public class TestCodeGenerator {
|
|
|
|
+ /**
|
|
|
|
+ * 读取控制台输入内容
|
|
|
|
+ */
|
|
|
|
+ private static final Scanner scanner = new Scanner(System.in);
|
|
|
|
|
|
public static void main(String[] args) {
|
|
public static void main(String[] args) {
|
|
// 代码生成
|
|
// 代码生成
|
|
- CodeGenerator.execute("jdbc:postgresql://127.0.0.1:5432/aizuda",
|
|
|
|
- "postgres", "123456", "com.aizuda.generate");
|
|
|
|
|
|
+ CodeGenerator.execute("jdbc:postgresql://127.0.0.1:5432/aizuda-boot",
|
|
|
|
+ "postgres", "123456", "com.aizuda.boot.modules." + scannerNext("请输入模块名称"));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 控制台输入内容读取并打印提示信息
|
|
|
|
+ *
|
|
|
|
+ * @param message 提示信息
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ public static String scannerNext(String message) {
|
|
|
|
+ System.out.println(message);
|
|
|
|
+ String nextLine = scanner.nextLine();
|
|
|
|
+ if (StringUtils.isBlank(nextLine)) {
|
|
|
|
+ // 如果输入空行继续等待
|
|
|
|
+ return scanner.next();
|
|
|
|
+ }
|
|
|
|
+ return nextLine;
|
|
}
|
|
}
|
|
}
|
|
}
|