yunzer_go/server/models/employee.go
2025-11-06 15:56:29 +08:00

40 lines
1.8 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 (
"time"
"github.com/beego/beego/v2/client/orm"
)
// Employee 员工模型
type Employee struct {
Id int `orm:"auto" json:"id"`
TenantId int `orm:"column(tenant_id);default(0)" json:"tenant_id"`
EmployeeNo string `orm:"column(employee_no);size(50)" json:"employee_no"`
Name string `orm:"size(50)" json:"name"`
Phone string `orm:"size(20);null" json:"phone"`
Email string `orm:"size(100);null" json:"email"`
DepartmentId int `orm:"column(department_id);null;default(0)" json:"department_id"`
PositionId int `orm:"column(position_id);null;default(0)" json:"position_id"`
Role int `orm:"column(role);null;default(0)" json:"role"` // 角色ID
BankName string `orm:"column(bank_name);size(100);null" json:"bank_name"`
BankAccount string `orm:"column(bank_account);size(50);null" json:"bank_account"`
Password string `orm:"size(255);null" json:"-"` // 不返回给前端
Salt string `orm:"size(100);null" json:"-"` // 不返回给前端
LastLoginTime *time.Time `orm:"column(last_login_time);null;type(datetime)" json:"last_login_time,omitempty"`
LastLoginIp string `orm:"column(last_login_ip);null;size(50)" json:"last_login_ip,omitempty"`
Status int8 `orm:"column(status);default(1)" json:"status"` // 1-在职0-离职
CreateTime time.Time `orm:"column(create_time);type(datetime);auto_now_add" json:"create_time"`
UpdateTime time.Time `orm:"column(update_time);type(datetime);auto_now" json:"update_time"`
DeleteTime *time.Time `orm:"column(delete_time);null;type(datetime)" json:"delete_time,omitempty"`
}
// TableName 设置表名
func (e *Employee) TableName() string {
return "yz_tenant_employees"
}
func init() {
orm.RegisterModel(new(Employee))
}