tanghc 3 years ago
parent
commit
56fb97a606

+ 0 - 1
build.sh

@@ -25,7 +25,6 @@ mkdir -p $target_dir
 
 cp -r gen/target/*.jar $target_dir/gen.jar
 cp -r script/* $target_dir
-cp -r db/gen.db $target_dir/gen.db
 
 echo "打成zip包"
 

+ 1 - 0
front/src/views/generate/index.vue

@@ -35,6 +35,7 @@
         <el-input
           v-model="tableSearch"
           prefix-icon="el-icon-search"
+          clearable
           size="mini"
           placeholder="过滤表"
           style="margin-bottom: 10px;width: 100%;"

+ 21 - 0
gen/src/main/java/com/gitee/gen/GenApplication.java

@@ -3,13 +3,34 @@ package com.gitee.gen;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.boot.web.servlet.ServletComponentScan;
+import org.springframework.core.io.ClassPathResource;
+import org.springframework.util.FileCopyUtils;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
 
 @ServletComponentScan
 @SpringBootApplication
 public class GenApplication {
 
     public static void main(String[] args) {
+        initDatabase();
         SpringApplication.run(GenApplication.class, args);
     }
 
+    public static void initDatabase() {
+        String filename = "gen.db";
+        String filepath = System.getProperty("user.dir") + "/" + filename;
+        File dbFile = new File(filepath);
+        if (!dbFile.exists()) {
+            ClassPathResource resource = new ClassPathResource(filename);
+            try {
+                FileCopyUtils.copy(resource.getInputStream(), new FileOutputStream(dbFile));
+            } catch (IOException e) {
+                throw new RuntimeException("初始化数据库失败", e);
+            }
+        }
+    }
+
 }

BIN
gen/src/main/resources/gen.db


File diff suppressed because it is too large
+ 1 - 1
gen/src/main/resources/public/index.html


File diff suppressed because it is too large
+ 1 - 0
gen/src/main/resources/public/static/js/chunk-5fb3a2ba.79829237.js


File diff suppressed because it is too large
+ 0 - 1
gen/src/main/resources/public/static/js/chunk-5fb3a2ba.9c802263.js