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/services/company/request/company_employee_upsert_req...

49 lines
1.6 KiB

package request
import (
"sorbet/internal/entities"
)
type CompanyEmployeeUpsertRequest struct {
ID uint `json:"id" xml:"id" form:"id" path:"id"`
CompanyID uint `json:"company_id" xml:"company_id" form:"company_id"`
Name string `json:"name" xml:"name" form:"name"`
Gender string `json:"gender" xml:"gender" form:"gender"`
Position string `json:"position" xml:"position" form:"position"`
PhoneNumber string `json:"phone_number" xml:"phone_number" form:"phone_number"`
WechatOpenid string `json:"wechat_openid" xml:"wechat_openid" form:"wechat_openid"`
WithoutStudy bool `json:"without_study" xml:"without_study" form:"without_study"`
IsAdmin bool `json:"is_admin" xml:"is_admin" form:"is_admin"`
}
func (c *CompanyEmployeeUpsertRequest) GetID() any {
return c.ID
}
func (c *CompanyEmployeeUpsertRequest) ToMap() map[string]any {
return map[string]any{
"id": c.ID,
"company_id": c.CompanyID,
"name": c.Name,
"gender": c.Gender,
"position": c.Position,
"phone_number": c.PhoneNumber,
"wechat_openid": c.WechatOpenid,
"without_study": c.WithoutStudy,
"is_admin": c.IsAdmin,
}
}
func (c *CompanyEmployeeUpsertRequest) ToEntity() any {
return &entities.CompanyEmployee{
ID: c.ID,
CompanyID: c.CompanyID,
Name: c.Name,
Gender: c.Gender,
Position: c.Position,
PhoneNumber: c.PhoneNumber,
WechatOpenid: c.WechatOpenid,
WithoutStudy: c.WithoutStudy,
IsAdmin: c.IsAdmin,
}
}