修改,兼容go-admin sdk方案
This commit is contained in:
1 parent
c541d09076
commit
25d8364bf4
151 files changed
+578
-3525
No files matched your search
@@ -6,18 +6,18 @@ import (
|
||||
|
||||
type DictData struct {
|
||||
DictCode int `gorm:"primaryKey;autoIncrement;" json:"dictCode" example:"1"` //字典编码
|
||||
DictSort int `gorm:"" json:"dictSort"` //显示顺序
|
||||
DictLabel string `gorm:"size:128;" json:"dictLabel"` //数据标签
|
||||
DictValue string `gorm:"size:255;" json:"dictValue"` //数据键值
|
||||
DictType string `gorm:"size:64;" json:"dictType"` //字典类型
|
||||
CssClass string `gorm:"size:128;" json:"cssClass"` //
|
||||
ListClass string `gorm:"size:128;" json:"listClass"` //
|
||||
IsDefault string `gorm:"size:8;" json:"isDefault"` //
|
||||
Status string `gorm:"size:4;" json:"status"` //状态
|
||||
Default string `gorm:"size:8;" json:"default"` //
|
||||
CreateBy string `gorm:"size:64;" json:"createBy"` //
|
||||
UpdateBy string `gorm:"size:64;" json:"updateBy"` //
|
||||
Remark string `gorm:"size:255;" json:"remark"` //备注
|
||||
DictSort int `gorm:"" json:"dictSort"` //显示顺序
|
||||
DictLabel string `gorm:"size:128;" json:"dictLabel"` //数据标签
|
||||
DictValue string `gorm:"size:255;" json:"dictValue"` //数据键值
|
||||
DictType string `gorm:"size:64;" json:"dictType"` //字典类型
|
||||
CssClass string `gorm:"size:128;" json:"cssClass"` //
|
||||
ListClass string `gorm:"size:128;" json:"listClass"` //
|
||||
IsDefault string `gorm:"size:8;" json:"isDefault"` //
|
||||
Status string `gorm:"size:4;" json:"status"` //状态
|
||||
Default string `gorm:"size:8;" json:"default"` //
|
||||
CreateBy string `gorm:"size:64;" json:"createBy"` //
|
||||
UpdateBy string `gorm:"size:64;" json:"updateBy"` //
|
||||
Remark string `gorm:"size:255;" json:"remark"` //备注
|
||||
models.BaseModel
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,8 @@ package migrate
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"go-admin/tools/app"
|
||||
"github.com/go-admin-team/go-admin-core/sdk"
|
||||
"github.com/go-admin-team/go-admin-core/sdk/pkg"
|
||||
"strconv"
|
||||
"text/template"
|
||||
"time"
|
||||
@@ -11,14 +12,13 @@ import (
|
||||
"github.com/go-admin-team/go-admin-core/config/source/file"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/go-admin-team/go-admin-core/sdk/config"
|
||||
"github.com/go-admin-team/go-admin-core/sdk/pkg/logger"
|
||||
"go-admin/cmd/migrate/migration"
|
||||
_ "go-admin/cmd/migrate/migration/version"
|
||||
_ "go-admin/cmd/migrate/migration/version-local"
|
||||
"go-admin/common/database"
|
||||
"go-admin/common/models"
|
||||
"go-admin/pkg/logger"
|
||||
"go-admin/tools"
|
||||
"go-admin/tools/config"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -51,7 +51,7 @@ func run() {
|
||||
//1. 读取配置
|
||||
config.Setup(file.NewSource, file.WithPath(configYml))
|
||||
//2. 设置日志
|
||||
app.Runtime.SetLogger(
|
||||
sdk.Runtime.SetLogger(
|
||||
logger.SetupLogger(
|
||||
config.LoggerConfig.Type,
|
||||
config.LoggerConfig.Path,
|
||||
@@ -68,7 +68,7 @@ func migrateModel() error {
|
||||
if host == "" {
|
||||
host = "*"
|
||||
}
|
||||
db := app.Runtime.GetDbByKey(host)
|
||||
db := sdk.Runtime.GetDbByKey(host)
|
||||
if config.DatabasesConfig[host].Driver == "mysql" {
|
||||
//初始化数据库时候用
|
||||
db.Set("gorm:table_options", "ENGINE=InnoDB CHARSET=utf8mb4")
|
||||
@@ -105,9 +105,9 @@ func genFile() error {
|
||||
var b1 bytes.Buffer
|
||||
err = t1.Execute(&b1, m)
|
||||
if goAdmin {
|
||||
tools.FileCreate(b1, "./cmd/migrate/migration/version/"+m["GenerateTime"]+"_migrate.go")
|
||||
pkg.FileCreate(b1, "./cmd/migrate/migration/version/"+m["GenerateTime"]+"_migrate.go")
|
||||
} else {
|
||||
tools.FileCreate(b1, "./cmd/migrate/migration/version-local/"+m["GenerateTime"]+"_migrate.go")
|
||||
pkg.FileCreate(b1, "./cmd/migrate/migration/version-local/"+m["GenerateTime"]+"_migrate.go")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
Reference in new issue
Block a user