| | |
| | | Address string `json:"address" gorm:"type:varchar(512);comment:地址"` //地址 |
| | | InboundTransportation int `json:"inboundTransportation" gorm:"type:int;comment:入向运输"` //入向运输 |
| | | OutboundTransportation int `json:"outboundTransportation" gorm:"type:int;comment:出库运输"` //出库运输 |
| | | LocationId int `json:"locationId" gorm:"type:int;comment:位置id"` //位置id |
| | | LocationId int `json:"locationId" gorm:"type:int;comment:位置id"` //默认位置id |
| | | WarehouseLocation string `json:"warehouseLocation" gorm:"-"` //库存位置 |
| | | Contacts string `json:"contacts" gorm:"type:varchar(255);comment:联系人"` //联系人 |
| | | } |
| | | |
| | | WarehouseSearch struct { |
| | |
| | | Keyword string |
| | | Orm *gorm.DB |
| | | Preload bool |
| | | Codes []string |
| | | } |
| | | ) |
| | | |
| | |
| | | return slf |
| | | } |
| | | |
| | | func (slf *WarehouseSearch) SetCodes(codes []string) *WarehouseSearch { |
| | | slf.Codes = codes |
| | | return slf |
| | | } |
| | | |
| | | func (slf *WarehouseSearch) SetName(name string) *WarehouseSearch { |
| | | slf.Name = name |
| | | return slf |
| | |
| | | if slf.Preload { |
| | | db = db.Preload("Company") |
| | | } |
| | | |
| | | if slf.Code != "" { |
| | | db = db.Where("code = ?", slf.Code) |
| | | } |
| | | |
| | | if len(slf.Codes) > 0 { |
| | | db = db.Where("code in ?", slf.Codes) |
| | | } |
| | | |
| | | return db |
| | | } |
| | | |