Merge branch 'gva_gormv2_dev' of https://github.com/flipped-aurora/gin-vue-admin into gva_workflow

 Conflicts:
	server/cmd/datas/init.go
This commit is contained in:
pixel
2020-11-17 17:41:12 +08:00
22 changed files with 532 additions and 123 deletions
+7 -3
View File
@@ -3,6 +3,7 @@ package datas
import (
"github.com/gookit/color"
"gorm.io/gorm"
"os"
)
type SysAuthorityMenus struct {
@@ -72,8 +73,8 @@ var AuthorityMenus = []SysAuthorityMenus{
{"9528", 20},
}
func InitSysAuthorityMenus(db *gorm.DB) (err error) {
return db.Table("sys_authority_menus").Transaction(func(tx *gorm.DB) error {
func InitSysAuthorityMenus(db *gorm.DB) {
if err := db.Table("sys_authority_menus").Transaction(func(tx *gorm.DB) error {
if tx.Where("sys_authority_authority_id IN ?", []string{"888", "8881", "9528"}).Find(&[]SysAuthorityMenus{}).RowsAffected == 53 {
color.Danger.Println("sys_authority_menus表的初始数据已存在!")
return nil
@@ -82,5 +83,8 @@ func InitSysAuthorityMenus(db *gorm.DB) (err error) {
return err
}
return nil
})
}); err != nil {
color.Warn.Printf("[Mysql]--> sys_authority_menus 表的初始数据失败,err: %v\n", err)
os.Exit(0)
}
}