| | |
| | | util.ResponseFormat(c, code.RequestParamError, err) |
| | | return |
| | | } |
| | | |
| | | if params.WarehouseId == 0 { |
| | | util.ResponseFormat(c, code.RequestParamError, "仓库ID参数缺失") |
| | | return |
| | | } |
| | | |
| | | if params.ParentId != 0 { |
| | | //查询上级名称 |
| | | first, err := models.NewLocationSearch().SetID(params.ParentId).First() |
| | |
| | | } |
| | | params.JointName = first.JointName + "/" + params.Name |
| | | if first.WarehouseId != 0 { |
| | | params.WarehouseId = first.Id |
| | | params.WarehouseId = first.WarehouseId |
| | | } else { |
| | | //根据仓库缩写查询仓库 |
| | | houseCode := strings.Split(first.JointName, "/")[0] |
| | |
| | | search.SetPage(params.Page, params.PageSize) |
| | | } |
| | | list, total, err := search.SetKeyword(params.KeyWord).SetType(params.Type).SetJointName(params.JointName). |
| | | SetIsScrapLocation(params.IsScrapLocation).SetOrder("created_at desc").Find() |
| | | SetIsScrapLocation(params.IsScrapLocation).SetOrder("created_at desc"). |
| | | SetWarehouseId(params.WarehouseId). |
| | | Find() |
| | | if err != nil { |
| | | util.ResponseFormat(c, code.RequestParamError, "查找失败") |
| | | return |