From 3e2e0ba01b514a55e09eb088300967f14f163688 Mon Sep 17 00:00:00 2001 From: zhangqian <zhangqian@123.com> Date: 星期二, 26 三月 2024 13:56:15 +0800 Subject: [PATCH] fix --- models/warehouse.go | 2 +- controllers/location.go | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/controllers/location.go b/controllers/location.go index 80adda5..327c689 100644 --- a/controllers/location.go +++ b/controllers/location.go @@ -103,7 +103,10 @@ tree = append(tree, location) continue } - m[location.ParentId].Children = make([]*models.Location, 0) + if m[location.ParentId].Children == nil { + m[location.ParentId].Children = make([]*models.Location, 0) + } + m[location.ParentId].Children = append(m[location.ParentId].Children, location) } } diff --git a/models/warehouse.go b/models/warehouse.go index 5832dd7..0b1c74f 100644 --- a/models/warehouse.go +++ b/models/warehouse.go @@ -25,7 +25,7 @@ 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:鑱旂郴浜�"` //鑱旂郴浜� } -- Gitblit v1.8.0