package model import "time" // User 用户表 type User struct { ID uint `gorm:"primaryKey" json:"id"` Username string `gorm:"size:64;uniqueIndex;not null" json:"username"` PasswordHash string `gorm:"size:256;not null" json:"-"` FullName string `gorm:"size:64;not null" json:"full_name"` Role string `gorm:"size:16;not null;default:employee;index" json:"role"` // employee / admin Status string `gorm:"size:16;not null;default:active;index" json:"status"` // active / disabled AiPoints int `gorm:"not null;default:100" json:"ai_points"` // 剩余 AI 算力点 LearningPoints int `gorm:"not null;default:0;index" json:"learning_points"` // 学习积分(游戏化成长值) Department string `gorm:"size:64;default:''" json:"department"` // 部门 Position string `gorm:"size:64;default:''" json:"position"` // 岗位(文本,历史遗留) PositionID *uint `gorm:"index" json:"position_id"` // 所属岗位,可空(历史用户/管理员可为空) HireBatch string `gorm:"size:64;default:''" json:"hire_batch"` // 入职批次 CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` } func (User) TableName() string { return "user" }