Explorar el Código

sql文件tpl文件不覆盖

zhangjq hace 6 años
padre
commit
92e0d09ca5
Se han modificado 1 ficheros con 13 adiciones y 1 borrados
  1. 13 1
      client/engineclient.go

+ 13 - 1
client/engineclient.go

@@ -150,7 +150,19 @@ func (c *EngineClient) GenerateToPath(xmlfile string,dest_path string)  {
 			} else if ft == "routers" {
 				os.MkdirAll(filepath.Dir(path), os.ModePerm)
 				ioutil.WriteFile(path, result.Data[i].Content, os.ModePerm)
-			} else {
+			} else if ft =="sql"{
+				os.MkdirAll(filepath.Dir(path), os.ModePerm)
+				if strings.Index(path, "_gen.xml") > 0 {
+					ioutil.WriteFile(path, result.Data[i].Content, os.ModePerm)
+				} else {
+					_, err := os.Stat(path)
+					if err == nil {
+						//ioutil.WriteFile(path+"_new", result.Data[i].Content, os.ModePerm)
+					} else if os.IsNotExist(err) {
+						ioutil.WriteFile(path, result.Data[i].Content, os.ModePerm)
+					}
+				}
+			} else{
 				os.MkdirAll(filepath.Dir(path), os.ModePerm)
 				err := ioutil.WriteFile(path, result.Data[i].Content, os.ModePerm)
 				if err != nil {