package model import ( "time" "gorm.io/gorm" ) // AccountRole 账号-角色关联模型 type AccountRole struct { ID uint `gorm:"primarykey" json:"id"` AccountID uint `gorm:"not null;index;uniqueIndex:idx_account_role_unique,where:deleted_at IS NULL" json:"account_id"` RoleID uint `gorm:"not null;index;uniqueIndex:idx_account_role_unique,where:deleted_at IS NULL" json:"role_id"` 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"` } // TableName 指定表名 func (AccountRole) TableName() string { return "tb_account_role" }