| | |
| | | CompanyName string `json:"companyName" gorm:"type:varchar(127);comment:公司名称-客户"` |
| | | Comment string `json:"comment" gorm:"type:text;comment:备注"` |
| | | |
| | | Details []*OperationDetails `json:"details" gorm:"foreignKey:OperationID;references:Id"` |
| | | |
| | | //Weight decimal.Decimal `json:"weight" gorm:"type:decimal(20,2);comment:重量(kg)"` |
| | | //TransferWeight decimal.Decimal `json:"transferWeight" gorm:"type:decimal(20,2);comment:物流重量(kg)"` |
| | | //CarrierID int `json:"carrierID" gorm:"type:int;comment:承运商ID"` |
| | | //CarrierName string `json:"carrierName" gorm:"type:varchar(63);comment:承运商名称"` |
| | | //Tracking string `json:"tracking" gorm:"type:varchar(127);comment:追踪参考"` |
| | | Details []*OperationDetails `json:"details" gorm:"foreignKey:OperationID;references:Id"` |
| | | BaseOperationType constvar.BaseOperationType `json:"baseOperationType" gorm:"type:tinyint;not null;comment:基础作业类型"` //基础作业类型 |
| | | } |
| | | |
| | | OperationSearch struct { |
| | |
| | | Keyword string |
| | | Orm *gorm.DB |
| | | Preload bool |
| | | Disuse bool |
| | | } |
| | | ) |
| | | |
| | |
| | | return slf |
| | | } |
| | | |
| | | func (slf *OperationSearch) SetDisuse(disuse bool) *OperationSearch { |
| | | slf.Disuse = disuse |
| | | return slf |
| | | } |
| | | |
| | | func (slf *OperationSearch) build() *gorm.DB { |
| | | var db = slf.Orm.Model(&Operation{}) |
| | | |
| | |
| | | } |
| | | |
| | | if slf.Preload { |
| | | db = db.Model(&Operation{}).Preload("Details").Preload("FromLocation").Preload("ToLocation") |
| | | db = db.Model(&Operation{}).Preload("Details").Preload("Details.Product").Preload("FromLocation").Preload("ToLocation") |
| | | } |
| | | |
| | | if slf.Disuse { |
| | | db = db.Where("operation_type_id = ?", 0) |
| | | } |
| | | |
| | | return db |