| | |
| | | |
| | | LocationSearch struct { |
| | | Location |
| | | Order string |
| | | PageNum int |
| | | PageSize int |
| | | Keyword string |
| | | Orm *gorm.DB |
| | | Preload bool |
| | | Codes []string |
| | | Order string |
| | | PageNum int |
| | | PageSize int |
| | | Keyword string |
| | | Orm *gorm.DB |
| | | Preload bool |
| | | JointNames []string |
| | | } |
| | | ) |
| | | |
| | |
| | | slf.Id = ID |
| | | return slf |
| | | } |
| | | func (slf *LocationSearch) SetCodes(ids []string) *LocationSearch { |
| | | slf.Codes = ids |
| | | |
| | | func (slf *LocationSearch) SetJointName(code string) *LocationSearch { |
| | | slf.JointName = code |
| | | return slf |
| | | } |
| | | |
| | | func (slf *LocationSearch) SetJointNames(codes []string) *LocationSearch { |
| | | slf.JointNames = codes |
| | | return slf |
| | | } |
| | | |
| | |
| | | if slf.CompanyId != 0 { |
| | | db = db.Where("company_id=?", slf.CompanyId) |
| | | } |
| | | if len(slf.Codes) != 0 { |
| | | db = db.Where("warehouse_code in (?)", slf.Codes) |
| | | if slf.JointName != "" { |
| | | db = db.Where("joint_name like ?", slf.JointName+"%") |
| | | } |
| | | if len(slf.JointNames) != 0 { |
| | | db = db.Where("joint_name in (?)", slf.JointNames) |
| | | } |
| | | |
| | | return db |