add: 提交部分表设计
update: 1.所有model嵌入gorm公用model 2.所有model嵌入BaseModel
This commit is contained in:
@@ -1,26 +1,21 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
// Permission 权限模型
|
||||
type Permission struct {
|
||||
ID uint `gorm:"primarykey" json:"id"`
|
||||
PermName string `gorm:"not null;size:50" json:"perm_name"`
|
||||
PermCode string `gorm:"uniqueIndex:idx_permission_code,where:deleted_at IS NULL;not null;size:100" json:"perm_code"`
|
||||
PermType int `gorm:"not null;index" json:"perm_type"` // 1=菜单, 2=按钮
|
||||
URL string `gorm:"size:255" json:"url,omitempty"`
|
||||
ParentID *uint `gorm:"index" json:"parent_id,omitempty"`
|
||||
Sort int `gorm:"not null;default:0" json:"sort"`
|
||||
Status int `gorm:"not null;default:1" json:"status"`
|
||||
Creator uint `gorm:"not null" json:"creator"`
|
||||
Updater uint `gorm:"not null" json:"updater"`
|
||||
CreatedAt time.Time `gorm:"not null" json:"created_at"`
|
||||
UpdatedAt time.Time `gorm:"not null" json:"updated_at"`
|
||||
DeletedAt gorm.DeletedAt `gorm:"index" json:"deleted_at,omitempty"`
|
||||
gorm.Model
|
||||
BaseModel
|
||||
|
||||
PermName string `gorm:"not null;size:50" json:"perm_name"`
|
||||
PermCode string `gorm:"uniqueIndex:idx_permission_code,where:deleted_at IS NULL;not null;size:100" json:"perm_code"`
|
||||
PermType int `gorm:"not null;index" json:"perm_type"` // 1=菜单, 2=按钮
|
||||
URL string `gorm:"size:255" json:"url,omitempty"`
|
||||
ParentID *uint `gorm:"index" json:"parent_id,omitempty"`
|
||||
Sort int `gorm:"not null;default:0" json:"sort"`
|
||||
Status int `gorm:"not null;default:1" json:"status"`
|
||||
}
|
||||
|
||||
// TableName 指定表名
|
||||
|
||||
Reference in New Issue
Block a user