| | |
| | | //HSCode string `gorm:"type:varchar(255);comment:HS编码" json:"HSCode"` //HS编码 |
| | | //OriginCountryId int `gorm:"type:int(11);comment:原产地id" json:"originCountryId"` //原产地id |
| | | //OriginCountryName string `gorm:"type:varchar(255);comment:原产地名称" json:"originCountryName"` //原产地名称 |
| | | InStorageExplain string `gorm:"type:varchar(512);comment:入库说明" json:"inStorageExplain"` //入库说明 |
| | | OutStorageExplain string `gorm:"type:varchar(512);comment:出库说明" json:"outStorageExplain"` //出库说明 |
| | | InternalTransferExplain string `gorm:"type:varchar(512);comment:内部调拨说明" json:"internalTransferExplain"` //内部调拨说明 |
| | | InStorageExplain string `gorm:"type:varchar(512);comment:入库说明" json:"inStorageExplain"` //入库说明 |
| | | OutStorageExplain string `gorm:"type:varchar(512);comment:出库说明" json:"outStorageExplain"` //出库说明 |
| | | InternalTransferExplain string `gorm:"type:varchar(512);comment:内部调拨说明" json:"internalTransferExplain"` //内部调拨说明 |
| | | AttachmentList []*Attachment `json:"attachmentList" gorm:"many2many:material_attachment"` |
| | | AttachmentIDs []uint `json:"attachmentIDs" gorm:"-"` |
| | | } |
| | | |
| | | MaterialSearch struct { |
| | |
| | | Ids []string |
| | | Orm *gorm.DB |
| | | CategoryIds []int |
| | | Preload bool |
| | | } |
| | | |
| | | IdAndName struct { |
| | |
| | | // return slf |
| | | //} |
| | | |
| | | func (slf *MaterialSearch) SetPreload(preload bool) *MaterialSearch { |
| | | slf.Preload = preload |
| | | return slf |
| | | } |
| | | |
| | | func (slf *MaterialSearch) build() *gorm.DB { |
| | | var db = slf.Orm.Table(slf.TableName()) |
| | | |
| | |
| | | db = db.Where("category_id in ?", slf.CategoryIds) |
| | | } |
| | | |
| | | if slf.Preload { |
| | | db = db.Preload("AttachmentList") |
| | | } |
| | | |
| | | return db |
| | | } |
| | | |