package models import ( "ims/util/db/dts" "time" "gorm.io/gorm" ) // Employee 员工 // 必须通过微信来初始化 type Employee struct { ID uint `json:"id" gorm:"primarykey"` // 员工编号 AccountID dts.NullUint `json:"account_id"` // 账号编号 Name string `json:"name"` // 员工姓名 PhoneNumber string `json:"phone_number" gorm:"uniqueIndex"` // 联系电话 WechatOpenid dts.NullString `json:"wechat_openid" gorm:"uniqueIndex"` // 微信openid Email dts.NullString `json:"email" gorm:"uniqueIndex"` // 电子邮箱 Departments []Department `json:"departments,omitempty" gorm:"many2many:department_employees;"` // 所在部门 CreatedBy uint `json:"created_by"` // 创建者(员工编号) CreatedAt time.Time `json:"created_at"` // 创建时间 UpdatedBy dts.NullUint `json:"updated_by"` // 创建者(员工编号) UpdatedAt time.Time `json:"updated_at"` // 上次操作时间 DeletedBy dts.NullUint `json:"deleted_by"` // 删除者(员工编号) DeletedAt gorm.DeletedAt `json:"deleted_at" gorm:"index"` // 删除数据时间 Creator *Employee `json:"creator,omitempty" gorm:"foreignKey:CreatedBy"` Updater *Employee `json:"updater,omitempty" gorm:"foreignKey:UpdatedBy"` Deleter *Employee `json:"deleter,omitempty" gorm:"foreignKey:DeletedBy"` }