| | |
| | | package model |
| | | |
| | | import ( |
| | | "aps_crm/constvar" |
| | | "aps_crm/pkg/mysqlx" |
| | | "gorm.io/gorm" |
| | | "time" |
| | | ) |
| | | |
| | | type ( |
| | | SalesReturn struct { |
| | | Id int `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"` |
| | | ClientId int `json:"clientId" gorm:"column:client_id;type:int;comment:客户id"` |
| | | Number string `json:"number" gorm:"column:number;type:varchar(255);comment:退货单号"` |
| | | Repository string `json:"repository" gorm:"column:repository;type:varchar(255);comment:仓库"` |
| | | MemberId int `json:"memberId" gorm:"column:member_id;type:int;comment:负责人id"` |
| | | ReturnDate time.Time `json:"returnDate" gorm:"column:return_date;type:datetime;comment:退货日期"` |
| | | SalesReturnStatus int `json:"salesReturnStatus" gorm:"column:sales_return_status;type:int;comment:退货状态"` |
| | | Reason string `json:"reason" gorm:"column:reason;type:varchar(255);comment:退货原因"` |
| | | Products []Product `json:"products" gorm:"many2many:salesReturn_product;"` |
| | | Id int `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"` |
| | | ClientId int `json:"clientId" gorm:"column:client_id;type:int;comment:客户id"` |
| | | Client Client `json:"client" gorm:"foreignKey:ClientId"` |
| | | SourceType constvar.SalesReturnSourceType `gorm:"source_type" json:"sourceType"` // 源单类型(1销售明细) |
| | | SourceId int `gorm:"source_id" json:"sourceId"` // 源单id |
| | | Number string `json:"number" gorm:"column:number;type:varchar(255);comment:退货单号"` |
| | | Repository string `json:"repository" gorm:"column:repository;type:varchar(255);comment:仓库"` |
| | | MemberId int `json:"memberId" gorm:"column:member_id;type:int;comment:负责人id"` |
| | | Member User `json:"Member" gorm:"foreignKey:MemberId"` |
| | | ReturnDate string `json:"returnDate" gorm:"column:return_date;type:datetime(3);comment:退货日期"` //退货日期 |
| | | SalesReturnStatusId int `json:"salesReturnStatusId" gorm:"column:sales_return_status;type:int;comment:退货状态"` //退货状态id |
| | | SalesReturnStatus SalesReturnStatus `json:"SalesReturnStatus" gorm:"foreignKey:SalesReturnStatusId"` //退货状态 |
| | | CreatorId int `json:"-" gorm:"column:creator_id;type:int;comment:创建人id"` //创建人ID |
| | | Creator User `json:"-" gorm:"foreignKey:CreatorId"` //创建人信息 |
| | | Reason string `json:"reason" gorm:"column:reason;type:varchar(255);comment:退货原因"` //退货原因 |
| | | Products []*Product `json:"products" gorm:"many2many:salesReturn_product;"` //退货产品 |
| | | CrmModel |
| | | } |
| | | |
| | | SalesReturnSearch struct { |
| | |
| | | } |
| | | ) |
| | | |
| | | func (SalesReturn) TableName() string { |
| | | func (*SalesReturn) TableName() string { |
| | | return "sales_return" |
| | | } |
| | | |
| | | func NewSalesReturnSearch() *SalesReturnSearch { |
| | | return &SalesReturnSearch{ |
| | | Orm: mysqlx.GetDB(), |
| | |
| | | func (slf *SalesReturnSearch) SetOrder(order string) *SalesReturnSearch { |
| | | slf.OrderBy = order |
| | | return slf |
| | | } |
| | | } |