fix
This commit is contained in:
24
models/group.go
Normal file
24
models/group.go
Normal file
@@ -0,0 +1,24 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
var SuperGroup Group
|
||||
|
||||
type Group struct {
|
||||
gorm.Model
|
||||
Name string `json:"name" gorm:"not null;uniqueIndex;size:500"`
|
||||
}
|
||||
|
||||
func (g *Group) Save() error {
|
||||
if g.ID == 0 {
|
||||
return DB().Create(g).Error
|
||||
}
|
||||
return DB().Save(g).Error
|
||||
}
|
||||
|
||||
func init() {
|
||||
SuperGroup.ID = 1
|
||||
SuperGroup.Name = "超级管理员"
|
||||
}
|
||||
Reference in New Issue
Block a user