Browse Source
fixed:
fixed:
- pgsql 修复初始化数据失败的bug - pgsql 获取角色菜单时 报错 - SysOperationRecord longtext 改为 textmain
SliverHorn
3 years ago
8 changed files with 76 additions and 58 deletions
-
4server/model/system/sys_operation_record.go
-
4server/service/system/sys_authority.go
-
26server/service/system/sys_initdb.go
-
24server/service/system/sys_initdb_mysql.go
-
26server/service/system/sys_initdb_pgsql.go
-
10server/source/example/file_mysql.go
-
34server/source/example/file_pgsql.go
-
6server/source/system/view_authority_menu_postgres.go
@ -0,0 +1,34 @@ |
|||
package example |
|||
|
|||
import ( |
|||
"github.com/flipped-aurora/gin-vue-admin/server/global" |
|||
"github.com/flipped-aurora/gin-vue-admin/server/model/example" |
|||
"github.com/pkg/errors" |
|||
"gorm.io/gorm" |
|||
) |
|||
|
|||
var FilePgsql = new(fileMysql) |
|||
|
|||
type filePgsql struct{} |
|||
|
|||
func (f *filePgsql) TableName() string { |
|||
return "exa_file_upload_and_downloads" |
|||
} |
|||
|
|||
func (f *filePgsql) Initialize() error { |
|||
entities := []example.ExaFileUploadAndDownload{ |
|||
{Name: "10.png", Url: "https://qmplusimg.henrongyi.top/gvalogo.png", Tag: "png", Key: "158787308910.png"}, |
|||
{Name: "logo.png", Url: "https://qmplusimg.henrongyi.top/1576554439myAvatar.png", Tag: "png", Key: "1587973709logo.png"}, |
|||
} |
|||
if err := global.GVA_DB.Create(&entities).Error; err != nil { |
|||
return errors.Wrap(err, f.TableName()+"表数据初始化失败!") |
|||
} |
|||
return nil |
|||
} |
|||
|
|||
func (f *filePgsql) CheckDataExist() bool { |
|||
if errors.Is(global.GVA_DB.Where("name = ? AND key = ?", "logo.png", "1587973709logo.png").First(&example.ExaFileUploadAndDownload{}).Error, gorm.ErrRecordNotFound) { |
|||
return false |
|||
} |
|||
return true |
|||
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue