重构自动化代码,修复皮肤bug (#1355)

* 增加读取ast方法和AddImport 方法来增加引用包功能

* 增加在指定方法中添加头部声明global.DB业务库的方法

* 增加了自动添加AutoMigrate方法。

* 将自动化产生自动迁移功能替换为新ast

* 增加了自动注册router块的功能

* 废除旧的对router和gorm的处理方法,替换为新的自动化方法

* 修复开发模式下皮肤失效的问题
This commit is contained in:
奇淼(piexlmax
2023-02-25 14:46:02 +08:00
committed by GitHub
parent ca7bdc913e
commit 0abcb5aba1
17 changed files with 637 additions and 229 deletions

View File

@@ -21,7 +21,7 @@ func Gorm() *gorm.DB {
return GormPgSql()
case "oracle":
return GormOracle()
case "mssql":
case "mssql":
return GormMssql()
default:
return GormMysql()
@@ -30,7 +30,8 @@ func Gorm() *gorm.DB {
// RegisterTables 注册数据库表专用
// Author SliverHorn
func RegisterTables(db *gorm.DB) {
func RegisterTables() {
db := global.GVA_DB
err := db.AutoMigrate(
// 系统模块表
system.SysApi{},
@@ -47,16 +48,10 @@ func RegisterTables(db *gorm.DB) {
system.SysAuthorityBtn{},
system.SysAutoCode{},
// 示例模块表
example.ExaFile{},
example.ExaCustomer{},
example.ExaFileChunk{},
example.ExaFileUploadAndDownload{},
// 自动化模块表
// Code generated by github.com/flipped-aurora/gin-vue-admin/server Begin; DO NOT EDIT.
// Code generated by github.com/flipped-aurora/gin-vue-admin/server End; DO NOT EDIT.
)
if err != nil {
global.GVA_LOG.Error("register table failed", zap.Error(err))