| | |
| | | Client Client `json:"client" gorm:"foreignKey:ClientId"` |
| | | Number string `json:"number" gorm:"column:number;type:varchar(255);comment:退款单号"` |
| | | SourceType constvar.RefundSourceType `gorm:"column:source_type;type:int;not null;default 0;comment:来源类型(1销售退货)" json:"sourceType"` // 来源类型(1销售退货) |
| | | SourceId int `gorm:"column:source_id;type:int;not null;default 0;comment:源单id " json:"sourceId"` // 源单id |
| | | Source SalesReturn `gorm:"foreignKey:SourceId" json:"Source"` |
| | | SalesReturnId int `gorm:"column:source_id;type:int;not null;default 0;comment:源单id " json:"sourceId"` // 源单id |
| | | SalesReturn SalesReturn `gorm:"foreignKey:SalesReturnId" json:"salesReturn"` |
| | | MemberId int `json:"memberId" gorm:"column:member_id;type:int;comment:负责人id"` |
| | | Member User `json:"member" gorm:"foreignKey:MemberId"` |
| | | RefundDate string `json:"refundDate" gorm:"column:refund_date;type:varchar(255);comment:退款日期"` |
| | |
| | | db = db.Where("source_type = ?", slf.SourceType) |
| | | } |
| | | |
| | | if slf.SourceId != 0 { |
| | | db = db.Where("source_id = ?", slf.SourceId) |
| | | if slf.SalesReturnId != 0 { |
| | | db = db.Where("source_id = ?", slf.SalesReturnId) |
| | | } |
| | | |
| | | if slf.Preload { |
| | | db = db.Preload("Client"). |
| | | Preload("PaymentType"). |
| | | Preload("BankAccount"). |
| | | Preload("Source"). |
| | | Preload("Products") |
| | | Preload("Products"). |
| | | Preload("SalesReturn") |
| | | } |
| | | if slf.KeywordType != "" { |
| | | switch slf.KeywordType { |
| | |
| | | } |
| | | |
| | | func (slf *SalesRefundSearch) SetSourceId(id int) *SalesRefundSearch { |
| | | slf.SourceId = id |
| | | slf.SalesReturnId = id |
| | | return slf |
| | | } |
| | | |