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.
42 lines
1.2 KiB
42 lines
1.2 KiB
package request
|
|
|
|
import (
|
|
"sorbet/internal/entities"
|
|
"sorbet/pkg/db"
|
|
)
|
|
|
|
type CompanyDepartmentUpsertRequest struct {
|
|
ID uint `json:"id" xml:"id" form:"id" path:"id"`
|
|
PID uint `json:"pid" xml:"pid" form:"pid"`
|
|
CompanyID uint `json:"company_id" xml:"company_id" form:"company_id"`
|
|
PrincipalID uint `json:"principal_id" xml:"principal_id" form:"principal_id"`
|
|
Name string `json:"name" xml:"name" form:"name"`
|
|
Sort int32 `json:"sort" xml:"sort" form:"sort"`
|
|
}
|
|
|
|
func (c *CompanyDepartmentUpsertRequest) GetID() any {
|
|
return c.ID
|
|
}
|
|
|
|
func (c *CompanyDepartmentUpsertRequest) ToEntity() any {
|
|
return &entities.CompanyDepartment{
|
|
ID: c.ID,
|
|
PID: &c.PID,
|
|
CompanyID: c.CompanyID,
|
|
PrincipalID: &c.PrincipalID,
|
|
Name: c.Name,
|
|
Sort: c.Sort,
|
|
Version: db.Version{Int64: 1, Valid: true},
|
|
}
|
|
}
|
|
|
|
func (c *CompanyDepartmentUpsertRequest) ToMap() map[string]any {
|
|
return map[string]any{
|
|
"id": c.ID,
|
|
"pid": c.PID,
|
|
"company_id": c.CompanyID,
|
|
"principal_id": c.PrincipalID,
|
|
"name": c.Name,
|
|
"sort": c.Sort,
|
|
}
|
|
}
|
|
|