25 lines
874 B
Go
25 lines
874 B
Go
package model
|
|
|
|
import (
|
|
"time"
|
|
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
// AdminUser 后台管理员用户
|
|
type AdminUser struct {
|
|
ID uint `gorm:"primaryKey" json:"id"`
|
|
Username string `gorm:"column:username;size:64;uniqueIndex;not null" json:"username"`
|
|
PasswordHash string `gorm:"column:password_hash;size:128;not null" json:"-"`
|
|
Role string `gorm:"column:role;size:32;not null;default:admin" json:"role"` // super_admin | admin
|
|
Name string `gorm:"column:name;size:64" json:"name"`
|
|
Status string `gorm:"column:status;size:16;not null;default:active" json:"status"` // active | disabled
|
|
CreatedAt time.Time `json:"createdAt"`
|
|
UpdatedAt time.Time `json:"updatedAt"`
|
|
DeletedAt gorm.DeletedAt `gorm:"index" json:"-"`
|
|
}
|
|
|
|
func (AdminUser) TableName() string {
|
|
return "admin_users"
|
|
}
|