@@ -2,7 +2,6 @@ package service
2
2
3
3
import (
4
4
"errors"
5
- "fmt"
6
5
"gin-vue-admin/global"
7
6
"gin-vue-admin/model"
8
7
"gin-vue-admin/model/request"
@@ -132,7 +131,6 @@ func CreateTemp(autoCode model.AutoCodeStruct) (err error) {
132
131
}
133
132
for _ , value := range dataList { // 移动文件
134
133
if err := utils .FileMove (value .autoCodePath , value .autoMoveFilePath ); err != nil {
135
- fmt .Println (err )
136
134
return err
137
135
}
138
136
}
@@ -212,7 +210,6 @@ func GetColumn(tableName string, dbName string) (err error, Columns []request.Co
212
210
//@return: null
213
211
214
212
func addAutoMoveFile (data * tplData ) {
215
- dir := filepath .Base (filepath .Dir (data .autoCodePath ))
216
213
base := filepath .Base (data .autoCodePath )
217
214
fileSlice := strings .Split (data .autoCodePath , string (os .PathSeparator ))
218
215
n := len (fileSlice )
@@ -221,25 +218,34 @@ func addAutoMoveFile(data *tplData) {
221
218
}
222
219
if strings .Contains (fileSlice [1 ], "server" ) {
223
220
if strings .Contains (fileSlice [n - 2 ], "router" ) {
224
- data .autoMoveFilePath = filepath .Join (dir , base )
221
+ data .autoMoveFilePath = filepath .Join (global .GVA_CONFIG .AutoCode .Root , global .GVA_CONFIG .AutoCode .Server ,
222
+ global .GVA_CONFIG .AutoCode .SRouter , base )
225
223
} else if strings .Contains (fileSlice [n - 2 ], "api" ) {
226
- data .autoMoveFilePath = filepath .Join (dir , "v1" , base )
224
+ data .autoMoveFilePath = filepath .Join (global .GVA_CONFIG .AutoCode .Root ,
225
+ global .GVA_CONFIG .AutoCode .Server , global .GVA_CONFIG .AutoCode .SApi , base )
227
226
} else if strings .Contains (fileSlice [n - 2 ], "service" ) {
228
- data .autoMoveFilePath = filepath .Join (dir , base )
227
+ data .autoMoveFilePath = filepath .Join (global .GVA_CONFIG .AutoCode .Root ,
228
+ global .GVA_CONFIG .AutoCode .Server , global .GVA_CONFIG .AutoCode .SService , base )
229
229
} else if strings .Contains (fileSlice [n - 2 ], "model" ) {
230
- data .autoMoveFilePath = filepath .Join (dir , base )
230
+ data .autoMoveFilePath = filepath .Join (global .GVA_CONFIG .AutoCode .Root ,
231
+ global .GVA_CONFIG .AutoCode .Server , global .GVA_CONFIG .AutoCode .SModel , base )
231
232
} else if strings .Contains (fileSlice [n - 2 ], "request" ) {
232
- data .autoMoveFilePath = filepath .Join ("model" , dir , base )
233
+ data .autoMoveFilePath = filepath .Join (global .GVA_CONFIG .AutoCode .Root ,
234
+ global .GVA_CONFIG .AutoCode .Server , global .GVA_CONFIG .AutoCode .SRequest , base )
233
235
}
234
236
} else if strings .Contains (fileSlice [1 ], "web" ) {
235
237
if strings .Contains (fileSlice [n - 1 ], "js" ) {
236
- data .autoMoveFilePath = filepath .Join ("../" , "web" , "src" , dir , base )
238
+ data .autoMoveFilePath = filepath .Join (global .GVA_CONFIG .AutoCode .Root ,
239
+ global .GVA_CONFIG .AutoCode .Web , global .GVA_CONFIG .AutoCode .WApi , base )
237
240
} else if strings .Contains (fileSlice [n - 2 ], "workflowForm" ) {
238
- data .autoMoveFilePath = filepath .Join ("../" , "web" , "src" , "view" , filepath .Base (filepath .Dir (filepath .Dir (data .autoCodePath ))), strings .TrimSuffix (base , filepath .Ext (base ))+ "WorkflowForm.vue" )
241
+ data .autoMoveFilePath = filepath .Join (global .GVA_CONFIG .AutoCode .Root ,
242
+ global .GVA_CONFIG .AutoCode .Web , global .GVA_CONFIG .AutoCode .WFlow , filepath .Base (filepath .Dir (filepath .Dir (data .autoCodePath ))), strings .TrimSuffix (base , filepath .Ext (base ))+ "WorkflowForm.vue" )
239
243
} else if strings .Contains (fileSlice [n - 2 ], "form" ) {
240
- data .autoMoveFilePath = filepath .Join ("../" , "web" , "src" , "view" , filepath .Base (filepath .Dir (filepath .Dir (data .autoCodePath ))), strings .TrimSuffix (base , filepath .Ext (base ))+ "Form.vue" )
244
+ data .autoMoveFilePath = filepath .Join (global .GVA_CONFIG .AutoCode .Root ,
245
+ global .GVA_CONFIG .AutoCode .Web , global .GVA_CONFIG .AutoCode .WForm , filepath .Base (filepath .Dir (filepath .Dir (data .autoCodePath ))), strings .TrimSuffix (base , filepath .Ext (base ))+ "Form.vue" )
241
246
} else if strings .Contains (fileSlice [n - 2 ], "table" ) {
242
- data .autoMoveFilePath = filepath .Join ("../" , "web" , "src" , "view" , filepath .Base (filepath .Dir (filepath .Dir (data .autoCodePath ))), base )
247
+ data .autoMoveFilePath = filepath .Join (global .GVA_CONFIG .AutoCode .Root ,
248
+ global .GVA_CONFIG .AutoCode .Web , global .GVA_CONFIG .AutoCode .WTable , filepath .Base (filepath .Dir (filepath .Dir (data .autoCodePath ))), base )
243
249
}
244
250
}
245
251
}
0 commit comments