|
@@ -0,0 +1,36 @@
|
|
|
|
+package main
|
|
|
|
+
|
|
|
|
+import (
|
|
|
|
+ "a"
|
|
|
|
+ "fmt"
|
|
|
|
+ "log"
|
|
|
|
+ "qfw/util"
|
|
|
|
+ "strings"
|
|
|
|
+)
|
|
|
|
+
|
|
|
|
+func main() {
|
|
|
|
+ // 1. 次数
|
|
|
|
+ log.Println(a.Sysconfig)
|
|
|
|
+ start := util.IntAll(a.Sysconfig["start"])
|
|
|
|
+ end := util.IntAll(a.Sysconfig["end"])
|
|
|
|
+ prefix := a.Sysconfig["table_prefix"].(string)
|
|
|
|
+ tmpName := a.Sysconfig["tmpName"].(string)
|
|
|
|
+ createTableStr := a.Sysconfig["createSql"].(string)
|
|
|
|
+ // for 循环执行语句
|
|
|
|
+ if start<0{
|
|
|
|
+ start=0
|
|
|
|
+ }
|
|
|
|
+ for i := start; i < end; i++ {
|
|
|
|
+ tableName := prefix + fmt.Sprintf("%03d", i)
|
|
|
|
+ log.Println(tableName)
|
|
|
|
+ createSql := strings.Replace(createTableStr, tmpName, tableName, -1)
|
|
|
|
+ log.Println(createSql)
|
|
|
|
+ _, err := a.JyMysql.ExecBySql(createSql)
|
|
|
|
+ if err == nil {
|
|
|
|
+ log.Println(tableName, "执行成功")
|
|
|
|
+ } else {
|
|
|
|
+ log.Println(tableName, "执行失败", err)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+}
|