Files
platforms/backend/api/internal/models/staff_account.go
2026-07-30 18:04:34 +08:00

23 lines
1.9 KiB
Go
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package models
import "git.apinb.com/bsm-sdk/core/database"
// StaffAccount 对应 staff_account是服务人员唯一的档案和 App 登录账户。
type StaffAccount struct {
Entity // 公共实体字段
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"` // 在岗接单状态
}
func init() { database.AppendMigrate(&StaffAccount{}) }
// TableName 返回与模型、文件名一致的单数数据表名。
func (table *StaffAccount) TableName() string { return "staff_account" }