From 254fe5c1f9e54ea33269a39c9c25f66c4d27e6d5 Mon Sep 17 00:00:00 2001
From: lishihai <dslsh@dscom>
Date: 星期四, 13 六月 2024 15:26:42 +0800
Subject: [PATCH] 概述(一级模块)-入库(二级模块)-新建操作(含出入库,内部调拨)的人可以删除自己创建的,不能删除别人创建的:删除时验证创建人

---
 models/location.go |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/models/location.go b/models/location.go
index be55274..bcae4ac 100644
--- a/models/location.go
+++ b/models/location.go
@@ -27,6 +27,8 @@
 		NextCount            string                        `json:"nextCount" gorm:"type:varchar(255);comment:涓嬫鐩樼偣"`       //涓嬫鐩樼偣
 		JointName            string                        `json:"jointName" gorm:"type:varchar(255);comment:鎷兼帴鍚嶇О"`       //鎷兼帴鍚嶇О
 		Children             []*Location                   `json:"children" gorm:"-"`
+		WarehouseId          int                           `json:"warehouseId" gorm:"type:int;not null;default:0;comment:浠撳簱ID"` //浠撳簱ID
+		Warehouse            Warehouse                     `json:"warehouse" gorm:"foreignKey:WarehouseId"`                     //浠撳簱
 	}
 
 	LocationSearch struct {
@@ -164,6 +166,10 @@
 		db = db.Where("is_scrap_location = ?", slf.IsScrapLocation)
 	}
 
+	if slf.Preload {
+		db = db.Preload("Warehouse")
+	}
+
 	return db
 }
 

--
Gitblit v1.8.0