haibei/internal/mods/common/schema/receptionCenter.go
2025-06-19 10:33:58 +08:00

57 lines
1.5 KiB
Go

package schema
import (
"github.guxuan/haibei/pkg/util"
)
// Defining the `Company` struct.
type ReceptionCenter struct {
util.BaseModel
Name string `json:"name" gorm:"size:128;not null;index"`
Introduce string `json:"introduce" gorm:"size:1024;comment:介绍"`
AreaID uint `json:"areaId" gorm:"index;comment:城市id"`
Status string `json:"status" gorm:"size:20;index"`
}
// Defining the query parameters for the `Company` struct.
type ReceptionCenterQueryParam struct {
util.PaginationParam
AreaID uint `form:"areaId"`
}
// Defining the query options for the `Company` struct.
type ReceptionCenterQueryOptions struct {
util.QueryOptions
}
// Defining the query result for the `Company` struct.
type ReceptionCenterQueryResult struct {
Data ReceptionCenters
PageResult *util.PaginationResult
}
// Defining the slice of `Company` struct.
type ReceptionCenters []*ReceptionCenter
// Defining the data structure for creating a `Company` struct.
type ReceptionCenterForm struct {
Name string `json:"name" `
Introduce string `json:"introduce" `
AreaID uint `json:"areaId" `
Status string `json:"status" `
}
// A validation function for the `CompanyForm` struct.
func (a *ReceptionCenterForm) Validate() error {
return nil
}
// Convert `CompanyForm` to `Company` object.
func (a *ReceptionCenterForm) FillTo(receptionCenter *ReceptionCenter) error {
receptionCenter.Name = a.Name
receptionCenter.Introduce = a.Introduce
receptionCenter.AreaID = a.AreaID
receptionCenter.Status = a.Status
return nil
}