go项目脚手架
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
sorbet/internal/entities/company_employee.go

28 lines
1.8 KiB

package entities
import (
"gorm.io/gorm"
"sorbet/pkg/db"
"time"
)
// CompanyEmployee 公司员工表
type CompanyEmployee struct {
ID uint `json:"id" xml:"id" gorm:"primaryKey;not null;comment:员工编号"`
CompanyID uint `json:"company_id" xml:"company_id" gorm:"comment:所属公司编号"`
Name string `json:"name" xml:"name" gorm:"size:20;not null;comment:员工姓名"`
Gender string `json:"gender" xml:"gender" gorm:"not null;default:'unknown';check:gender IN('female','male','unknown');comment:员工性别"`
Position string `json:"position" xml:"position" gorm:"size:100;not null;comment:员工职务"`
PhoneNumber string `json:"phone_number" xml:"phone_number" gorm:"size:11;not null;comment:手机号码"`
WechatOpenid string `json:"wechat_openid" xml:"wechat_openid" gorm:"size:100;not null;comment:微信号"`
WithoutStudy bool `json:"without_study" xml:"without_study" gorm:"comment:是否可以不用学习"`
IsAdmin bool `json:"is_admin" xml:"is_admin" gorm:"comment:是否管理员"`
Version db.Version `json:"-" xml:"-" gorm:"comment:乐观锁"`
CreatedAt time.Time `json:"create_time" xml:"create_time" gorm:"<-:false;comment:创建时间"`
UpdatedAt time.Time `json:"update_time" xml:"update_time" gorm:"<-:false;comment:更新时间"`
1 year ago
DeletedAt gorm.DeletedAt `json:"-" xml:"-" gorm:"comment:删除时间"`
Company *Company `json:"company" xml:"company" gorm:"foreignKey:CompanyID"`
Departments []*CompanyDepartment `json:"departments" xml:"departments" gorm:"many2many:company_employee_to_department_relations"`
}