daShangDao_psiServer/models/employee.go

48 lines
3.6 KiB
Go

package models
// Employee 员工
type Employee struct {
ID int64 `json:"id" gorm:"primarykey;comment:自增ID"` // 自增ID
EmployeeIDStr string `json:"employee_id_str" gorm:"size:10;not null;uniqueIndex"` // 工号
Fid int64 `json:"fid" gorm:"not null;default:0;comment:父级id"` // 父级id
AboutId int64 `json:"about_id" gorm:"not null;default:0;comment:关联id"` // 关联id
Code string `json:"code" gorm:"size:64;not null;default:'';comment:机械码"` // 机械码
Username string `json:"username" gorm:"size:50;not null;default:'';comment:登录账号 (init_工号)"` // 登录账号 (init_工号)
Password string `json:"password" gorm:"size:100;not null;default:'';comment:密码"` // 密码
Name string `json:"name" gorm:"size:50;not null;default:'';comment:姓名"` // 姓名
Phone string `json:"phone" gorm:"size:11;not null;default:'';comment:手机号"` // 手机号
Role int64 `json:"role" gorm:"not null;default:0;comment:权限"` // 权限
Status int8 `json:"status" gorm:"not null;default:1;comment:状态 1正常 0禁用"` // 状态 1正常 0禁用
Score int64 `json:"score" gorm:"not null;default:0;comment:积分"` // 积分
SplitAccountConfigId int64 `json:"split_account_config_id" gorm:"not null;default:0;comment:分账配置ID"` // 分账配置ID
From string `json:"from" gorm:"size:50;not null;default:'';comment:来源"` // 来源
TypeId int8 `json:"type_id" gorm:"not null;default:0;comment:关联类型"` // 关联类型
LastLoginAt int64 `json:"last_login_at" gorm:"not null;default:0;comment:最后登录时间"` // 最后登录时间
LastLoginIp string `json:"last_login_ip" gorm:"size:20;not null;default:'';comment:最后登录ip"` // 最后登录ip
CreatedAt int64 `json:"created_at" gorm:"not null;default:0;comment:创建时间"` // 创建时间
UpdatedAt int64 `json:"updated_at" gorm:"not null;default:0;comment:更新时间"` // 更新时间
DeletedAt int64 `json:"deleted_at" gorm:"not null;default:0;comment:删除时间"` // 删除时间
ExpireTime int64 `json:"expire_time" gorm:"not null;default:0;comment:过期时间"` // 过期时间
}
// UpdateEmployeeSplitAccountConfigResponse 更新员工分账配置响应
type UpdateEmployeeSplitAccountConfigResponse struct {
ID int64 `json:"id"` // 自增ID
EmployeeIDStr string `json:"employee_id_str"` // 工号
Username string `json:"username"` // 登录账号 (init_工号)
Name string `json:"name"` // 姓名
Phone string `json:"phone"` // 手机号
AboutId int64 `json:"about_id"` // 关联id
SplitAccountConfigId int64 `json:"split_account_config_id"` // 分账配置ID
Status int8 `json:"status"` // 状态 1正常 0禁用
UpdatedAt int64 `json:"updated_at"` // 更新时间
}
func (Employee) TableName() string {
return "employees"
}
func (Employee) TableOptions() string {
return "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='员工表'"
}