package model import pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow" type SaleDealer struct { Id int32 `json:"id"` PastureId int64 `json:"pastureId"` Name string `json:"name"` Contacts string `json:"contacts"` Phone string `json:"phone"` Address string `json:"address"` Remarks string `json:"remarks"` IsShow pasturePb.IsShow_Kind `json:"isShow"` CreatedAt int64 `json:"createdAt"` UpdatedAt int64 `json:"updatedAt"` } func (s *SaleDealer) TableName() string { return "sale_dealer" } func NewSaleDealer(pastureId int64, name, phone string) *SaleDealer { return &SaleDealer{ PastureId: pastureId, Name: name, Contacts: "", Phone: phone, Address: "", Remarks: "", IsShow: pasturePb.IsShow_Ok, } } type SaleDealerSlice []*SaleDealer func (s SaleDealerSlice) ToPB() []*pasturePb.DealerItem { res := make([]*pasturePb.DealerItem, len(s)) for i, v := range s { res[i] = &pasturePb.DealerItem{ Id: v.Id, Name: v.Name, Contacts: v.Contacts, Address: v.Address, Phone: v.Phone, IsShow: v.IsShow, Remarks: v.Remarks, } } return res }