2026-07-27 00:18:42 +08:00
|
|
|
|
package models
|
|
|
|
|
|
|
|
|
|
|
|
import "git.apinb.com/bsm-sdk/core/database"
|
|
|
|
|
|
|
|
|
|
|
|
// StaffAccount 对应 staff_account,是服务人员唯一的档案和 App 登录账户。
|
|
|
|
|
|
type StaffAccount struct {
|
2026-07-27 12:02:08 +08:00
|
|
|
|
Entity // 公共实体字段
|
2026-07-30 18:04:34 +08:00
|
|
|
|
Username string `gorm:"column:username;type:varchar(64);not null;uniqueIndex" json:"username"` // 登录名称
|
|
|
|
|
|
PasswordHash string `gorm:"column:password_hash;type:varchar(255);not null" json:"-"` // 密码哈希
|
|
|
|
|
|
Name string `gorm:"column:name;type:varchar(64);not null" json:"name"` // 人员姓名
|
|
|
|
|
|
Phone string `gorm:"column:phone;type:varchar(32);not null;default:'';uniqueIndex:idx_staff_account_phone,where:phone <> ''" json:"phone"` // 唯一登录手机号
|
|
|
|
|
|
Avatar string `gorm:"column:avatar;type:varchar(512);not null;default:''" json:"avatar"` // 头像资源地址
|
|
|
|
|
|
RoleCode string `gorm:"column:role_code;type:varchar(64);not null;default:''" json:"role_code"` // 服务角色编码
|
|
|
|
|
|
GasBasicID uint64 `gorm:"column:gas_basic_id;not null;default:0;index" json:"gas_basic_id"` // 所属可燃气体站主键
|
|
|
|
|
|
DeliveryBasicID uint64 `gorm:"column:delivery_basic_id;not null;default:0;index" json:"delivery_basic_id"` // 所属配送点主键
|
|
|
|
|
|
WorkStatus string `gorm:"column:work_status;type:varchar(32);not null;default:'off_duty'" json:"work_status"` // 在岗接单状态
|
2026-07-27 00:18:42 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func init() { database.AppendMigrate(&StaffAccount{}) }
|
|
|
|
|
|
|
|
|
|
|
|
// TableName 返回与模型、文件名一致的单数数据表名。
|
|
|
|
|
|
func (table *StaffAccount) TableName() string { return "staff_account" }
|