From b13834f8c0b4a0fe9928cb07a721e6ec7df86ae1 Mon Sep 17 00:00:00 2001 From: jiangshuai <291802688@qq.com> Date: 星期三, 15 十一月 2023 17:01:51 +0800 Subject: [PATCH] Merge branch 'master' of http://192.168.5.5:10010/r/aps/WMS --- models/location.go | 11 ++++++++++- docs/swagger.yaml | 3 +++ controllers/location.go | 3 ++- docs/docs.go | 4 ++++ docs/swagger.json | 4 ++++ request/location.go | 7 ++++--- 6 files changed, 27 insertions(+), 5 deletions(-) diff --git a/controllers/location.go b/controllers/location.go index 29ad83b..80adda5 100644 --- a/controllers/location.go +++ b/controllers/location.go @@ -68,7 +68,8 @@ if params.PageInfo.Check() { search.SetPage(params.Page, params.PageSize) } - list, total, err := search.SetKeyword(params.KeyWord).SetType(params.Type).SetJointName(params.JointName).SetOrder("created_at desc").Find() + list, total, err := search.SetKeyword(params.KeyWord).SetType(params.Type).SetJointName(params.JointName). + SetIsScrapLocation(params.IsScrapLocation).SetOrder("created_at desc").Find() if err != nil { util.ResponseFormat(c, code.RequestParamError, "鏌ユ壘澶辫触") return diff --git a/docs/docs.go b/docs/docs.go index a77f4a4..73253d7 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -3938,6 +3938,10 @@ "request.GetLocationList": { "type": "object", "properties": { + "isScrapLocation": { + "description": "鏄惁鎶ュ簾", + "type": "boolean" + }, "jointName": { "description": "鎷兼帴鍚嶇О", "type": "string" diff --git a/docs/swagger.json b/docs/swagger.json index d545fcc..bfa1ebf 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -3926,6 +3926,10 @@ "request.GetLocationList": { "type": "object", "properties": { + "isScrapLocation": { + "description": "鏄惁鎶ュ簾", + "type": "boolean" + }, "jointName": { "description": "鎷兼帴鍚嶇О", "type": "string" diff --git a/docs/swagger.yaml b/docs/swagger.yaml index e097e09..0072923 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -1089,6 +1089,9 @@ type: object request.GetLocationList: properties: + isScrapLocation: + description: 鏄惁鎶ュ簾 + type: boolean jointName: description: 鎷兼帴鍚嶇О type: string diff --git a/models/location.go b/models/location.go index ad60d86..be55274 100644 --- a/models/location.go +++ b/models/location.go @@ -115,6 +115,11 @@ return slf } +func (slf *LocationSearch) SetIsScrapLocation(isScrapLocation bool) *LocationSearch { + slf.IsScrapLocation = isScrapLocation + return slf +} + func (slf *LocationSearch) build() *gorm.DB { var db = slf.Orm.Table(slf.TableName()) @@ -153,6 +158,10 @@ } if len(slf.JointNames) != 0 { db = db.Where("joint_name in (?)", slf.JointNames) + } + + if slf.IsScrapLocation { + db = db.Where("is_scrap_location = ?", slf.IsScrapLocation) } return db @@ -348,7 +357,7 @@ locations = append(locations, &Location{Name: "搴撳瓨鎹熷け", Type: 5, JointName: "搴撳瓨鎹熷け"}) locations = append(locations, &Location{Name: "鐢熶骇", Type: 6, JointName: "鐢熶骇"}) locations = append(locations, &Location{Name: "涓浆浣嶇疆", Type: 7, JointName: "涓浆浣嶇疆"}) - locations = append(locations, &Location{Name: "鎶ュ簾浣嶇疆", Type: 8, JointName: "鎶ュ簾浣嶇疆"}) + locations = append(locations, &Location{Name: "鎶ュ簾浣嶇疆", Type: 8, JointName: "鎶ュ簾浣嶇疆", IsScrapLocation: true}) locations = append(locations, &Location{Name: "搴撳瓨鐩樼偣", Type: 9, JointName: "搴撳瓨鐩樼偣"}) return slf.CreateBatch(locations) } diff --git a/request/location.go b/request/location.go index b12f724..8f6546d 100644 --- a/request/location.go +++ b/request/location.go @@ -9,7 +9,8 @@ type GetLocationList struct { PageInfo - Type int `json:"type"` - KeyWord string `json:"keyWord"` - JointName string `json:"jointName"` //鎷兼帴鍚嶇О + Type int `json:"type"` + KeyWord string `json:"keyWord"` + JointName string `json:"jointName"` //鎷兼帴鍚嶇О + IsScrapLocation bool `json:"isScrapLocation"` //鏄惁鎶ュ簾 } -- Gitblit v1.8.0