From 28240d14942e63d05c06531f04f7f7b5530f04c3 Mon Sep 17 00:00:00 2001 From: liujiandao <274878379@qq.com> Date: 星期三, 20 九月 2023 10:46:32 +0800 Subject: [PATCH] 产品与产品类型注释添加 --- /dev/null | 294 -------------------------------- models/product_category.go | 10 models/material.go | 81 ++++---- docs/swagger.yaml | 34 +++ docs/docs.go | 40 ++++ docs/swagger.json | 40 ++++ 6 files changed, 150 insertions(+), 349 deletions(-) diff --git a/docs/docs.go b/docs/docs.go index c19f52e..9647266 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -1389,9 +1389,11 @@ "type": "object", "properties": { "HSCode": { + "description": "HS缂栫爜", "type": "string" }, "amount": { + "description": "鏁伴噺", "type": "number" }, "barcode": { @@ -1399,6 +1401,7 @@ "type": "string" }, "buyExplain": { + "description": "閲囪喘璇存槑", "type": "string" }, "canBePurchased": { @@ -1410,19 +1413,27 @@ "type": "integer" }, "companyId": { + "description": "鍏徃id", "type": "integer" }, "companyName": { + "description": "鍏徃鍚嶇О", "type": "string" }, "controlStrategy": { - "$ref": "#/definitions/constvar.InvoicingStrategy" + "description": "鎺у埗绛栫暐", + "allOf": [ + { + "$ref": "#/definitions/constvar.InvoicingStrategy" + } + ] }, "cost": { "description": "鎴愭湰", "type": "number" }, "currencyName": { + "description": "甯佺鍚嶇О", "type": "string" }, "customerTaxes": { @@ -1430,12 +1441,14 @@ "type": "number" }, "deliveryAdvanceTime": { + "description": "浜よ揣鎻愬墠鏃堕棿(澶�)", "type": "integer" }, "id": { "type": "string" }, "inStorageExplain": { + "description": "鍏ュ簱璇存槑", "type": "string" }, "internalNotes": { @@ -1447,6 +1460,7 @@ "type": "string" }, "internalTransferExplain": { + "description": "鍐呴儴璋冩嫧璇存槑", "type": "string" }, "invoicingStrategy": { @@ -1462,6 +1476,7 @@ "type": "boolean" }, "maxInventory": { + "description": "鏈�澶у簱瀛�", "type": "number" }, "minInventory": { @@ -1481,18 +1496,27 @@ ] }, "name": { + "description": "鐗╂枡鍚嶇О", "type": "string" }, "orderCreation": { - "$ref": "#/definitions/constvar.OrderCreation" + "description": "璁㈠崟鍒涘缓", + "allOf": [ + { + "$ref": "#/definitions/constvar.OrderCreation" + } + ] }, "originCountryId": { + "description": "鍘熶骇鍦癷d", "type": "integer" }, "originCountryName": { + "description": "鍘熶骇鍦板悕绉�", "type": "string" }, "outStorageExplain": { + "description": "鍑哄簱璇存槑", "type": "string" }, "principal": { @@ -1500,26 +1524,35 @@ "type": "string" }, "productTagId": { - "description": "浜у搧鏍囩", + "description": "浜у搧鏍囩id", "type": "integer" }, "productTagName": { + "description": "浜у搧鏍囩鍚嶇О", "type": "string" }, "purchasePrice": { + "description": "閲囪喘浠锋牸", "type": "number" }, "salePrice": { + "description": "閿�鍞崟浠�", "type": "number" }, "selectProduct": { + "description": "鍙�変骇鍝乮d", "type": "integer" }, "sellExplain": { + "description": "閿�鍞鏄�", "type": "string" }, "supplier": { "description": "FSource string ` + "`" + `gorm:\"type:varchar(191);comment:鐢熶骇杞﹂棿\" json:\"-\"` + "`" + `\nStatus constvar.MaterialStatus ` + "`" + `gorm:\"type:int(11);comment:鐘舵�乗" json:\"status\"` + "`" + `", + "type": "string" + }, + "templateID": { + "description": "Note string ` + "`" + `gorm:\"type:varchar(1024);comment:澶囨敞\" json:\"note\"` + "`" + `", "type": "string" }, "unit": { @@ -1689,6 +1722,7 @@ "type": "integer" }, "routeId": { + "description": "璺嚎id", "type": "integer" }, "routeName": { diff --git a/docs/swagger.json b/docs/swagger.json index a6aa289..10ca3e1 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -1377,9 +1377,11 @@ "type": "object", "properties": { "HSCode": { + "description": "HS缂栫爜", "type": "string" }, "amount": { + "description": "鏁伴噺", "type": "number" }, "barcode": { @@ -1387,6 +1389,7 @@ "type": "string" }, "buyExplain": { + "description": "閲囪喘璇存槑", "type": "string" }, "canBePurchased": { @@ -1398,19 +1401,27 @@ "type": "integer" }, "companyId": { + "description": "鍏徃id", "type": "integer" }, "companyName": { + "description": "鍏徃鍚嶇О", "type": "string" }, "controlStrategy": { - "$ref": "#/definitions/constvar.InvoicingStrategy" + "description": "鎺у埗绛栫暐", + "allOf": [ + { + "$ref": "#/definitions/constvar.InvoicingStrategy" + } + ] }, "cost": { "description": "鎴愭湰", "type": "number" }, "currencyName": { + "description": "甯佺鍚嶇О", "type": "string" }, "customerTaxes": { @@ -1418,12 +1429,14 @@ "type": "number" }, "deliveryAdvanceTime": { + "description": "浜よ揣鎻愬墠鏃堕棿(澶�)", "type": "integer" }, "id": { "type": "string" }, "inStorageExplain": { + "description": "鍏ュ簱璇存槑", "type": "string" }, "internalNotes": { @@ -1435,6 +1448,7 @@ "type": "string" }, "internalTransferExplain": { + "description": "鍐呴儴璋冩嫧璇存槑", "type": "string" }, "invoicingStrategy": { @@ -1450,6 +1464,7 @@ "type": "boolean" }, "maxInventory": { + "description": "鏈�澶у簱瀛�", "type": "number" }, "minInventory": { @@ -1469,18 +1484,27 @@ ] }, "name": { + "description": "鐗╂枡鍚嶇О", "type": "string" }, "orderCreation": { - "$ref": "#/definitions/constvar.OrderCreation" + "description": "璁㈠崟鍒涘缓", + "allOf": [ + { + "$ref": "#/definitions/constvar.OrderCreation" + } + ] }, "originCountryId": { + "description": "鍘熶骇鍦癷d", "type": "integer" }, "originCountryName": { + "description": "鍘熶骇鍦板悕绉�", "type": "string" }, "outStorageExplain": { + "description": "鍑哄簱璇存槑", "type": "string" }, "principal": { @@ -1488,26 +1512,35 @@ "type": "string" }, "productTagId": { - "description": "浜у搧鏍囩", + "description": "浜у搧鏍囩id", "type": "integer" }, "productTagName": { + "description": "浜у搧鏍囩鍚嶇О", "type": "string" }, "purchasePrice": { + "description": "閲囪喘浠锋牸", "type": "number" }, "salePrice": { + "description": "閿�鍞崟浠�", "type": "number" }, "selectProduct": { + "description": "鍙�変骇鍝乮d", "type": "integer" }, "sellExplain": { + "description": "閿�鍞鏄�", "type": "string" }, "supplier": { "description": "FSource string `gorm:\"type:varchar(191);comment:鐢熶骇杞﹂棿\" json:\"-\"`\nStatus constvar.MaterialStatus `gorm:\"type:int(11);comment:鐘舵�乗" json:\"status\"`", + "type": "string" + }, + "templateID": { + "description": "Note string `gorm:\"type:varchar(1024);comment:澶囨敞\" json:\"note\"`", "type": "string" }, "unit": { @@ -1677,6 +1710,7 @@ "type": "integer" }, "routeId": { + "description": "璺嚎id", "type": "integer" }, "routeName": { diff --git a/docs/swagger.yaml b/docs/swagger.yaml index 2dc5f06..80597bb 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -246,13 +246,16 @@ models.Material: properties: HSCode: + description: HS缂栫爜 type: string amount: + description: 鏁伴噺 type: number barcode: description: 鏉$爜 type: string buyExplain: + description: 閲囪喘璇存槑 type: string canBePurchased: description: 鏄惁鍙噰璐� @@ -261,24 +264,31 @@ description: 浜у搧绫诲埆id type: integer companyId: + description: 鍏徃id type: integer companyName: + description: 鍏徃鍚嶇О type: string controlStrategy: - $ref: '#/definitions/constvar.InvoicingStrategy' + allOf: + - $ref: '#/definitions/constvar.InvoicingStrategy' + description: 鎺у埗绛栫暐 cost: description: 鎴愭湰 type: number currencyName: + description: 甯佺鍚嶇О type: string customerTaxes: description: 瀹㈡埛绋庣櫨鍒嗘瘮 type: number deliveryAdvanceTime: + description: 浜よ揣鎻愬墠鏃堕棿(澶�) type: integer id: type: string inStorageExplain: + description: 鍏ュ簱璇存槑 type: string internalNotes: description: 鍐呴儴璇存槑 @@ -287,6 +297,7 @@ description: 鍐呴儴鍙傝�� type: string internalTransferExplain: + description: 鍐呴儴璋冩嫧璇存槑 type: string invoicingStrategy: allOf: @@ -297,6 +308,7 @@ json:"purchaseType"` type: boolean maxInventory: + description: 鏈�澶у簱瀛� type: number minInventory: description: |- @@ -316,35 +328,50 @@ description: MaterialType constvar.ProductType `gorm:"index;type:int(11);comment:鐗╂枡绫诲瀷(鏁板瓧)" json:"materialType"` name: + description: 鐗╂枡鍚嶇О type: string orderCreation: - $ref: '#/definitions/constvar.OrderCreation' + allOf: + - $ref: '#/definitions/constvar.OrderCreation' + description: 璁㈠崟鍒涘缓 originCountryId: + description: 鍘熶骇鍦癷d type: integer originCountryName: + description: 鍘熶骇鍦板悕绉� type: string outStorageExplain: + description: 鍑哄簱璇存槑 type: string principal: description: 璐熻矗浜� type: string productTagId: - description: 浜у搧鏍囩 + description: 浜у搧鏍囩id type: integer productTagName: + description: 浜у搧鏍囩鍚嶇О type: string purchasePrice: + description: 閲囪喘浠锋牸 type: number salePrice: + description: 閿�鍞崟浠� type: number selectProduct: + description: 鍙�変骇鍝乮d type: integer sellExplain: + description: 閿�鍞鏄� type: string supplier: description: |- FSource string `gorm:"type:varchar(191);comment:鐢熶骇杞﹂棿" json:"-"` Status constvar.MaterialStatus `gorm:"type:int(11);comment:鐘舵��" json:"status"` + type: string + templateID: + description: Note string `gorm:"type:varchar(1024);comment:澶囨敞" + json:"note"` type: string unit: description: LockAmount decimal.Decimal `gorm:"type:decimal(35,18);default:0;comment:閿佸畾鏁伴噺" @@ -450,6 +477,7 @@ description: 涓婄骇id type: integer routeId: + description: 璺嚎id type: integer routeName: description: 鍏徃 diff --git a/models/material.go b/models/material.go index 26bd05e..5d616be 100644 --- a/models/material.go +++ b/models/material.go @@ -12,61 +12,60 @@ // Material 鐗╂枡 Material struct { BaseModelString - Name string `gorm:"unique;type:varchar(191);not null;comment:鐗╂枡鍚嶇О" json:"name"` + Name string `gorm:"unique;type:varchar(191);not null;comment:鐗╂枡鍚嶇О" json:"name"` //鐗╂枡鍚嶇О //MaterialType constvar.ProductType `gorm:"index;type:int(11);comment:鐗╂枡绫诲瀷(鏁板瓧)" json:"materialType"` - Model constvar.MaterialMode `gorm:"type:varchar(191);not null;comment:鐗╂枡绫诲瀷(瀛楃涓�)" json:"model"` + Model constvar.MaterialMode `gorm:"type:varchar(191);not null;comment:鐗╂枡绫诲瀷(瀛楃涓�)" json:"model"` //鐗╂枡绫诲瀷(瀛楃涓�) //Explain string `gorm:"type:varchar(512);comment:缂栧彿璇存槑" json:"explain"` //CodeStandardID string `gorm:"type:varchar(191);comment:缂栫爜瑙勮寖ID" json:"codeStandardID"` //Specs string `gorm:"type:varchar(191);comment:鐗╂枡瑙勬牸" json:"specs"` //Type string `gorm:"type:varchar(191);comment:鐗╂枡鍨嬪彿" json:"type"` - MinInventory decimal.Decimal `gorm:"type:decimal(35,18);comment:鏈�灏忓簱瀛�" json:"minInventory"` - MaxInventory decimal.Decimal `gorm:"type:decimal(35,18);comment:鏈�澶у簱瀛�" json:"maxInventory"` - Amount decimal.Decimal `gorm:"type:decimal(35,18);comment:鏁伴噺" json:"amount"` + MinInventory decimal.Decimal `gorm:"type:decimal(35,18);comment:鏈�灏忓簱瀛�" json:"minInventory"` //鏈�灏忓簱瀛� + MaxInventory decimal.Decimal `gorm:"type:decimal(35,18);comment:鏈�澶у簱瀛�" json:"maxInventory"` //鏈�澶у簱瀛� + Amount decimal.Decimal `gorm:"type:decimal(35,18);comment:鏁伴噺" json:"amount"` //鏁伴噺 //LockAmount decimal.Decimal `gorm:"type:decimal(35,18);default:0;comment:閿佸畾鏁伴噺" json:"lockAmount"` - Unit string `gorm:"type:varchar(100);comment:鍗曚綅" json:"unit"` + Unit string `gorm:"type:varchar(100);comment:鍗曚綅" json:"unit"` //鍗曚綅 //Note string `gorm:"type:varchar(1024);comment:澶囨敞" json:"note"` - TemplateID string `gorm:"type:varchar(191);comment:妯℃澘ID" json:"-"` + TemplateID string `gorm:"type:varchar(191);comment:妯℃澘ID" json:"templateID"` //妯℃澘ID //FSource string `gorm:"type:varchar(191);comment:鐢熶骇杞﹂棿" json:"-"` //Status constvar.MaterialStatus `gorm:"type:int(11);comment:鐘舵��" json:"status"` - Supplier string `gorm:"type:varchar(191);comment:渚涘簲鍟�" json:"supplier"` - PurchasePrice decimal.Decimal `gorm:"type:decimal(35,18);comment:閲囪喘浠锋牸" json:"purchasePrice"` + Supplier string `gorm:"type:varchar(191);comment:渚涘簲鍟�" json:"supplier"` //渚涘簲鍟� + PurchasePrice decimal.Decimal `gorm:"type:decimal(35,18);comment:閲囪喘浠锋牸" json:"purchasePrice"` //閲囪喘浠锋牸 //PurchaseAheadDay int `gorm:"type:int(11);comment:閲囪喘鎻愬墠鏈�(澶�)" json:"purchaseAheadDay"` //ProduceAheadDay int `gorm:"type:int(11);comment:鍒堕�犳彁鍓嶆湡(澶�)" json:"produceAheadDay"` - MinPurchaseAmount decimal.Decimal `gorm:"type:decimal(35,18);comment:鏈�灏忛噰璐噺" json:"minPurchaseAmount"` + MinPurchaseAmount decimal.Decimal `gorm:"type:decimal(35,18);comment:鏈�灏忛噰璐噺" json:"minPurchaseAmount"` //鏈�灏忛噰璐噺 //PurchaseType constvar.PurchaseType `gorm:"type:int(11);comment:閲囪喘绫诲瀷" json:"purchaseType"` - IsSale bool `gorm:"type:tinyint(1);comment:鏄惁閿�鍞�" json:"isSale"` - SalePrice decimal.Decimal `gorm:"type:decimal(35,18);comment:閿�鍞崟浠�" json:"salePrice"` + IsSale bool `gorm:"type:tinyint(1);comment:鏄惁閿�鍞�" json:"isSale"` //鏄惁閿�鍞� + SalePrice decimal.Decimal `gorm:"type:decimal(35,18);comment:閿�鍞崟浠�" json:"salePrice"` //閿�鍞崟浠� AutoIncr uint `gorm:"type:int(11);comment:鑷ID;default:0;" json:"-"` //wms娣诲姞瀛楁 - InvoicingStrategy constvar.InvoicingStrategy `gorm:"type:int(11);comment:寮�绁ㄧ瓥鐣�" json:"invoicingStrategy"` - OrderCreation constvar.OrderCreation `gorm:"type:int(11);comment:璁㈠崟鍒涘缓" json:"orderCreation"` - CustomerTaxes decimal.Decimal `gorm:"type:decimal(20,2);comment:瀹㈡埛绋�" json:"customerTaxes"` //瀹㈡埛绋庣櫨鍒嗘瘮 - Cost decimal.Decimal `gorm:"type:decimal(20,2);comment:鎴愭湰" json:"cost"` //鎴愭湰 - CategoryId int `gorm:"type:int(11);comment:浜у搧绫诲埆id" json:"categoryId"` //浜у搧绫诲埆id - InternalReference string `gorm:"type:varchar(255);comment:鍐呴儴鍙傝��" json:"internalReference"` //鍐呴儴鍙傝�� - Barcode string `gorm:"type:varchar(255);comment:鏉$爜" json:"barcode"` //鏉$爜 - ProductTagId int `gorm:"type:int(11);comment:浜у搧鏍囩id" json:"productTagId"` //浜у搧鏍囩 - ProductTagName string `gorm:"type:varchar(255);comment:浜у搧鏍囩鍚嶇О" json:"productTagName"` - CompanyId int `gorm:"type:int(11);comment:鍏徃id" json:"companyId"` - CompanyName string `gorm:"type:varchar(255);comment:鍏徃鍚嶇О" json:"companyName"` - InternalNotes string `gorm:"type:varchar(512);comment:鍐呴儴璇存槑" json:"internalNotes"` //鍐呴儴璇存槑 - SelectProduct int `gorm:"type:int(11);comment:鍙�変骇鍝乮d" json:"selectProduct"` - SellExplain string `gorm:"type:varchar(512);comment:閿�鍞鏄�" json:"sellExplain"` - CanBePurchased bool `gorm:"type:int(11);comment:鏄惁鍙噰璐�" json:"canBePurchased"` //鏄惁鍙噰璐� - CurrencyName string `gorm:"type:varchar(255);comment:甯佺鍚嶇О" json:"currencyName"` - DeliveryAdvanceTime int `gorm:"type:int(11);comment:浜よ揣鎻愬墠鏃堕棿(澶�)" json:"deliveryAdvanceTime"` - ControlStrategy constvar.InvoicingStrategy `gorm:"type:int(11);comment:鎺у埗绛栫暐" json:"controlStrategy"` - BuyExplain string `gorm:"type:varchar(512);comment:閲囪喘璇存槑" json:"buyExplain"` - Principal string `gorm:"type:varchar(255);comment:璐熻矗浜�" json:"principal"` //璐熻矗浜� - Weight decimal.Decimal `gorm:"type:decimal(20,2);comment:閲嶉噺" json:"weight"` //閲嶉噺 - Volume decimal.Decimal `gorm:"type:decimal(20,2);comment:浣撶Н" json:"volume"` //浣撶Н - HSCode string `gorm:"type:varchar(255);comment:HS缂栫爜" json:"HSCode"` - OriginCountryId int `gorm:"type:int(11);comment:鍘熶骇鍦癷d" json:"originCountryId"` - OriginCountryName string `gorm:"type:varchar(255);comment:鍘熶骇鍦板悕绉�" json:"originCountryName"` - InStorageExplain string `gorm:"type:varchar(512);comment:鍏ュ簱璇存槑" json:"inStorageExplain"` - OutStorageExplain string `gorm:"type:varchar(512);comment:鍑哄簱璇存槑" json:"outStorageExplain"` - InternalTransferExplain string `gorm:"type:varchar(512);comment:鍐呴儴璋冩嫧璇存槑" json:"internalTransferExplain"` - //CompanyArr []IdAndName `gorm:"-" json:"companyArr"` + InvoicingStrategy constvar.InvoicingStrategy `gorm:"type:int(11);comment:寮�绁ㄧ瓥鐣�" json:"invoicingStrategy"` //寮�绁ㄧ瓥鐣� + OrderCreation constvar.OrderCreation `gorm:"type:int(11);comment:璁㈠崟鍒涘缓" json:"orderCreation"` //璁㈠崟鍒涘缓 + CustomerTaxes decimal.Decimal `gorm:"type:decimal(20,2);comment:瀹㈡埛绋�" json:"customerTaxes"` //瀹㈡埛绋庣櫨鍒嗘瘮 + Cost decimal.Decimal `gorm:"type:decimal(20,2);comment:鎴愭湰" json:"cost"` //鎴愭湰 + CategoryId int `gorm:"type:int(11);comment:浜у搧绫诲埆id" json:"categoryId"` //浜у搧绫诲埆id + InternalReference string `gorm:"type:varchar(255);comment:鍐呴儴鍙傝��" json:"internalReference"` //鍐呴儴鍙傝�� + Barcode string `gorm:"type:varchar(255);comment:鏉$爜" json:"barcode"` //鏉$爜 + ProductTagId int `gorm:"type:int(11);comment:浜у搧鏍囩id" json:"productTagId"` //浜у搧鏍囩id + ProductTagName string `gorm:"type:varchar(255);comment:浜у搧鏍囩鍚嶇О" json:"productTagName"` //浜у搧鏍囩鍚嶇О + CompanyId int `gorm:"type:int(11);comment:鍏徃id" json:"companyId"` //鍏徃id + CompanyName string `gorm:"type:varchar(255);comment:鍏徃鍚嶇О" json:"companyName"` //鍏徃鍚嶇О + InternalNotes string `gorm:"type:varchar(512);comment:鍐呴儴璇存槑" json:"internalNotes"` //鍐呴儴璇存槑 + SelectProduct int `gorm:"type:int(11);comment:鍙�変骇鍝乮d" json:"selectProduct"` //鍙�変骇鍝乮d + SellExplain string `gorm:"type:varchar(512);comment:閿�鍞鏄�" json:"sellExplain"` //閿�鍞鏄� + CanBePurchased bool `gorm:"type:int(11);comment:鏄惁鍙噰璐�" json:"canBePurchased"` //鏄惁鍙噰璐� + CurrencyName string `gorm:"type:varchar(255);comment:甯佺鍚嶇О" json:"currencyName"` //甯佺鍚嶇О + DeliveryAdvanceTime int `gorm:"type:int(11);comment:浜よ揣鎻愬墠鏃堕棿(澶�)" json:"deliveryAdvanceTime"` //浜よ揣鎻愬墠鏃堕棿(澶�) + ControlStrategy constvar.InvoicingStrategy `gorm:"type:int(11);comment:鎺у埗绛栫暐" json:"controlStrategy"` //鎺у埗绛栫暐 + BuyExplain string `gorm:"type:varchar(512);comment:閲囪喘璇存槑" json:"buyExplain"` //閲囪喘璇存槑 + Principal string `gorm:"type:varchar(255);comment:璐熻矗浜�" json:"principal"` //璐熻矗浜� + Weight decimal.Decimal `gorm:"type:decimal(20,2);comment:閲嶉噺" json:"weight"` //閲嶉噺 + Volume decimal.Decimal `gorm:"type:decimal(20,2);comment:浣撶Н" json:"volume"` //浣撶Н + HSCode string `gorm:"type:varchar(255);comment:HS缂栫爜" json:"HSCode"` //HS缂栫爜 + OriginCountryId int `gorm:"type:int(11);comment:鍘熶骇鍦癷d" json:"originCountryId"` //鍘熶骇鍦癷d + OriginCountryName string `gorm:"type:varchar(255);comment:鍘熶骇鍦板悕绉�" json:"originCountryName"` //鍘熶骇鍦板悕绉� + InStorageExplain string `gorm:"type:varchar(512);comment:鍏ュ簱璇存槑" json:"inStorageExplain"` //鍏ュ簱璇存槑 + OutStorageExplain string `gorm:"type:varchar(512);comment:鍑哄簱璇存槑" json:"outStorageExplain"` //鍑哄簱璇存槑 + InternalTransferExplain string `gorm:"type:varchar(512);comment:鍐呴儴璋冩嫧璇存槑" json:"internalTransferExplain"` //鍐呴儴璋冩嫧璇存槑 } MaterialSearch struct { diff --git a/models/product.go b/models/product.go deleted file mode 100644 index 373ee26..0000000 --- a/models/product.go +++ /dev/null @@ -1,294 +0,0 @@ -package models - -// -//import ( -// "fmt" -// "github.com/shopspring/decimal" -// "gorm.io/gorm" -// "wms/constvar" -// "wms/pkg/mysqlx" -//) -// -//type ( -// // Product 浜у搧 -// Product struct { -// WmsModel -// Id int `gorm:"column:id;primary_key;AUTO_INCREMENT" json:"id"` -// Name string `gorm:"index;type:varchar(255);not null;comment:浜у搧鍚嶇О" json:"name"` //浜у搧鍚嶇О -// Type constvar.ProductType `gorm:"type:int(11);comment:浜у搧绫诲瀷" json:"type"` //浜у搧绫诲瀷 -// InvoicingStrategy constvar.InvoicingStrategy `gorm:"type:int(11);comment:寮�绁ㄧ瓥鐣�" json:"invoicingStrategy"` -// OrderCreation constvar.OrderCreation `gorm:"type:int(11);comment:璁㈠崟鍒涘缓" json:"orderCreation"` -// ObjectTemplateId string `gorm:"type:varchar(191);comment:椤圭洰妯$増id" json:"objectTemplateId"` -// SalePrice decimal.Decimal `gorm:"type:decimal(35,18);comment:閿�鍞崟浠�" json:"salePrice"` //閿�鍞环鏍� -// CustomerTaxes decimal.Decimal `gorm:"type:decimal(20,2);comment:瀹㈡埛绋�" json:"customerTaxes"` //瀹㈡埛绋庣櫨鍒嗘瘮 -// Cost decimal.Decimal `gorm:"type:decimal(20,2);comment:鎴愭湰" json:"cost"` //鎴愭湰 -// CategoryId int `gorm:"type:int(11);comment:浜у搧绫诲瀷id" json:"categoryId"` //浜у搧鍒嗙被id -// InternalReference string `gorm:"type:varchar(255);comment:鍐呴儴鍙傝��" json:"internalReference"` //鍐呴儴鍙傝�� -// Barcode string `gorm:"type:varchar(255);comment:鏉$爜" json:"barcode"` //鏉$爜 -// ProductTagId int `gorm:"type:int(11);comment:浜у搧鏍囩id" json:"productTagId"` //浜у搧鏍囩 -// ProductTagName string `gorm:"type:varchar(255);comment:浜у搧鏍囩鍚嶇О" json:"productTagName"` -// CompanyId int `gorm:"type:int(11);comment:鍏徃id" json:"companyId"` -// CompanyName string `gorm:"type:varchar(255);comment:鍏徃鍚嶇О" json:"companyName"` -// InternalNotes string `gorm:"type:varchar(512);comment:鍐呴儴璇存槑" json:"internalNotes"` //鍐呴儴璇存槑 -// CanBeSell bool `gorm:"type:tinyint(1);comment:鏄惁鍙攢鍞�" json:"canBeSell"` //鏄惁閿�鍞� -// SelectProduct int `gorm:"type:int(11);comment:鍙�変骇鍝乮d" json:"selectProduct"` -// SellExplain string `gorm:"type:varchar(512);comment:閿�鍞鏄�" json:"sellExplain"` -// CanBePurchased bool `gorm:"type:int(11);comment:鏄惁鍙噰璐�" json:"canBePurchased"` //鏄惁鍙噰璐� -// SupplierId int `gorm:"type:int(11);comment:渚涘簲鍟唅d" json:"supplierId"` -// SupplierName string `gorm:"type:varchar(255);comment:渚涘簲鍟嗗悕绉�" json:"supplierName"` -// Price decimal.Decimal `gorm:"type:decimal(20,2);comment:浠锋牸" json:"price"` -// CurrencyId int `gorm:"type:int(11);comment:甯佺id" json:"currencyId"` -// CurrencyName string `gorm:"type:varchar(255);comment:甯佺鍚嶇О" json:"currencyName"` -// DeliveryAdvanceTime decimal.Decimal `gorm:"type:decimal(20,5);comment:鎻愬墠浜よ揣鏃堕棿" json:"deliveryAdvanceTime"` -// ControlStrategy constvar.InvoicingStrategy `gorm:"type:int(11);comment:鎺у埗绛栫暐" json:"controlStrategy"` -// BuyExplain string `gorm:"type:varchar(512);comment:閲囪喘璇存槑" json:"buyExplain"` -// Principal string `gorm:"type:varchar(255);comment:璐熻矗浜�" json:"principal"` //璐熻矗浜� -// Weight decimal.Decimal `gorm:"type:decimal(20,2);comment:閲嶉噺" json:"weight"` //閲嶉噺 -// Volume decimal.Decimal `gorm:"type:decimal(20,2);comment:浣撶Н" json:"volume"` //浣撶Н -// CustomerAdvanceTime decimal.Decimal `gorm:"type:decimal(20,5);comment:瀹㈡埛鍓嶇疆鏃堕棿" json:"customerAdvanceTime"` -// HSCode string `gorm:"type:varchar(255);comment:HS缂栫爜" json:"HSCode"` -// OriginCountryId int `gorm:"type:int(11);comment:鍘熶骇鍦癷d" json:"originCountryId"` -// OriginCountryName string `gorm:"type:varchar(255);comment:鍘熶骇鍦板悕绉�" json:"originCountryName"` -// InStorageExplain string `gorm:"type:varchar(512);comment:鍏ュ簱璇存槑" json:"inStorageExplain"` -// OutStorageExplain string `gorm:"type:varchar(512);comment:鍑哄簱璇存槑" json:"outStorageExplain"` -// InternalTransferExplain string `gorm:"type:varchar(512);comment:鍐呴儴璋冩嫧璇存槑" json:"internalTransferExplain"` -// } -// -// ProductSearch struct { -// Product -// Order string -// PageNum int -// PageSize int -// Keyword string -// Orm *gorm.DB -// Preload bool -// } -// -// PurchaseInfo struct { -// PurchasePrice decimal.Decimal `gorm:"type:decimal(35,18);comment:閲囪喘浠锋牸" json:"purchasePrice"` -// PurchaseAheadDay int `gorm:"type:int(11);comment:閲囪喘鎻愬墠鏈�(澶�)" json:"purchaseAheadDay"` -// ProduceAheadDay int `gorm:"type:int(11);comment:鍒堕�犳彁鍓嶆湡(澶�)" json:"produceAheadDay"` -// MinPurchaseAmount decimal.Decimal `gorm:"type:decimal(35,18);comment:鏈�灏忛噰璐噺" json:"minPurchaseAmount"` -// } -//) -// -//func (slf *Product) TableName() string { -// return "wms_product" -//} -// -//func (slf *Product) BeforeCreate(db *gorm.DB) error { -// return nil -//} -// -//func (slf *Product) AfterFind(db *gorm.DB) error { -// return nil -//} -// -//func NewProductSearch() *ProductSearch { -// return &ProductSearch{Orm: mysqlx.GetDB()} -//} -// -//func (slf *ProductSearch) SetOrm(tx *gorm.DB) *ProductSearch { -// slf.Orm = tx -// return slf -//} -// -//func (slf *ProductSearch) SetPage(page, size int) *ProductSearch { -// slf.PageNum, slf.PageSize = page, size -// return slf -//} -// -//func (slf *ProductSearch) SetOrder(order string) *ProductSearch { -// slf.Order = order -// return slf -//} -// -//func (slf *ProductSearch) SetID(id uint) *ProductSearch { -// slf.ID = id -// return slf -//} -// -//func (slf *ProductSearch) SetName(name string) *ProductSearch { -// slf.Name = name -// return slf -//} -// -//func (slf *ProductSearch) SetKeyword(keyword string) *ProductSearch { -// slf.Keyword = keyword -// return slf -//} -// -//func (slf *ProductSearch) SetPreload(preload bool) *ProductSearch { -// slf.Preload = preload -// return slf -//} -// -//func (slf *ProductSearch) build() *gorm.DB { -// var db = slf.Orm.Model(&Product{}) -// -// if slf.ID != 0 { -// db = db.Where("id = ?", slf.ID) -// } -// -// if slf.Order != "" { -// db = db.Order(slf.Order) -// } -// -// if slf.Keyword != "" { -// db = db.Where("name like ?", fmt.Sprintf("%%%v%%", slf.Keyword)) -// } -// -// if slf.Name != "" { -// db = db.Where("name = ?", slf.Name) -// } -// -// return db -//} -// -//// Create 鍗曟潯鎻掑叆 -//func (slf *ProductSearch) Create(record *Product) error { -// var db = slf.build() -// -// if err := db.Create(record).Error; err != nil { -// return err -// } -// -// return nil -//} -// -//// CreateBatch 鎵归噺鎻掑叆 -//func (slf *ProductSearch) CreateBatch(records []*Product) error { -// var db = slf.build() -// -// if err := db.Create(&records).Error; err != nil { -// return fmt.Errorf("create batch err: %v, records: %+v", err, records) -// } -// -// return nil -//} -// -//func (slf *ProductSearch) Update(record *Product) error { -// var db = slf.build() -// -// if err := db.Omit("CreatedAt").Updates(record).Error; err != nil { -// return fmt.Errorf("save err: %v, record: %+v", err, record) -// } -// -// return nil -//} -// -//func (slf *ProductSearch) UpdateByMap(upMap map[string]interface{}) error { -// var ( -// db = slf.build() -// ) -// -// if err := db.Updates(upMap).Error; err != nil { -// return fmt.Errorf("update by map err: %v, upMap: %+v", err, upMap) -// } -// -// return nil -//} -// -//func (slf *ProductSearch) UpdateByQuery(query string, args []interface{}, upMap map[string]interface{}) error { -// var ( -// db = slf.Orm.Table(slf.TableName()).Where(query, args...) -// ) -// -// if err := db.Updates(upMap).Error; err != nil { -// return fmt.Errorf("update by query err: %v, query: %s, args: %+v, upMap: %+v", err, query, args, upMap) -// } -// -// return nil -//} -// -//func (slf *ProductSearch) Delete() error { -// var db = slf.build() -// return db.Delete(&Product{}).Error -//} -// -//func (slf *ProductSearch) First() (*Product, error) { -// var ( -// record = new(Product) -// db = slf.build() -// ) -// -// if err := db.First(record).Error; err != nil { -// return record, err -// } -// -// return record, nil -//} -// -//func (slf *ProductSearch) Find() ([]*Product, int64, error) { -// var ( -// records = make([]*Product, 0) -// total int64 -// db = slf.build() -// ) -// -// if err := db.Count(&total).Error; err != nil { -// return records, total, fmt.Errorf("find count err: %v", err) -// } -// if slf.PageNum*slf.PageSize > 0 { -// db = db.Offset((slf.PageNum - 1) * slf.PageSize).Limit(slf.PageSize) -// } -// if err := db.Find(&records).Error; err != nil { -// return records, total, fmt.Errorf("find records err: %v", err) -// } -// -// return records, total, nil -//} -// -//func (slf *ProductSearch) FindNotTotal() ([]*Product, error) { -// var ( -// records = make([]*Product, 0) -// db = slf.build() -// ) -// -// if slf.PageNum*slf.PageSize > 0 { -// db = db.Offset((slf.PageNum - 1) * slf.PageSize).Limit(slf.PageSize) -// } -// if err := db.Find(&records).Error; err != nil { -// return records, fmt.Errorf("find records err: %v", err) -// } -// -// return records, nil -//} -// -//// FindByQuery 鎸囧畾鏉′欢鏌ヨ. -//func (slf *ProductSearch) FindByQuery(query string, args []interface{}) ([]*Product, int64, error) { -// var ( -// records = make([]*Product, 0) -// total int64 -// db = slf.Orm.Table(slf.TableName()).Where(query, args...) -// ) -// -// if err := db.Count(&total).Error; err != nil { -// return records, total, fmt.Errorf("find by query count err: %v", err) -// } -// if slf.PageNum*slf.PageSize > 0 { -// db = db.Offset((slf.PageNum - 1) * slf.PageSize).Limit(slf.PageSize) -// } -// if err := db.Find(&records).Error; err != nil { -// return records, total, fmt.Errorf("find by query records err: %v, query: %s, args: %+v", err, query, args) -// } -// -// return records, total, nil -//} -// -//// FindByQueryNotTotal 鎸囧畾鏉′欢鏌ヨ&涓嶆煡璇㈡�绘潯鏁�. -//func (slf *ProductSearch) FindByQueryNotTotal(query string, args []interface{}) ([]*Product, error) { -// var ( -// records = make([]*Product, 0) -// db = slf.Orm.Table(slf.TableName()).Where(query, args...) -// ) -// -// if slf.PageNum*slf.PageSize > 0 { -// db = db.Offset((slf.PageNum - 1) * slf.PageSize).Limit(slf.PageSize) -// } -// if err := db.Find(&records).Error; err != nil { -// return records, fmt.Errorf("find by query records err: %v, query: %s, args: %+v", err, query, args) -// } -// -// return records, nil -//} diff --git a/models/product_category.go b/models/product_category.go index b1985d3..5f6ebbf 100644 --- a/models/product_category.go +++ b/models/product_category.go @@ -13,11 +13,11 @@ BaseModelInt Name string `json:"name" gorm:"index;type:varchar(255);not null;comment:鍒嗙被鍚嶇О"` //浣嶇疆鍚嶇О ParentId int `json:"parentId" gorm:"type:int;comment:涓婄骇鍒嗙被id"` //涓婄骇id - RouteId int `json:"routeId" gorm:"type:int;comment:璺嚎id"` - RouteName string `json:"routeName" gorm:"type:varchar(512);comment:璺嚎鍚嶇О"` //鍏徃 - ForceRemovalStrategy constvar.ForceRemovalStrategy `json:"forceRemovalStrategy" gorm:"type:tinyint;comment:寮哄埗涓嬫灦绛栫暐"` //寮哄埗涓嬫灦绛栫暐 - CostingMethod constvar.CostingMethod `json:"costingMethod" gorm:"type:tinyint;comment:鎴愭湰鏂规硶"` //鎴愭湰鏂规硶 - InventoryValuation constvar.InventoryValuation `json:"inventoryValuation" gorm:"type:tinyint;comment:搴撳瓨璁′环"` //搴撳瓨璁′环 + RouteId int `json:"routeId" gorm:"type:int;comment:璺嚎id"` //璺嚎id + RouteName string `json:"routeName" gorm:"type:varchar(512);comment:璺嚎鍚嶇О"` //鍏徃 + ForceRemovalStrategy constvar.ForceRemovalStrategy `json:"forceRemovalStrategy" gorm:"type:tinyint;comment:寮哄埗涓嬫灦绛栫暐"` //寮哄埗涓嬫灦绛栫暐 + CostingMethod constvar.CostingMethod `json:"costingMethod" gorm:"type:tinyint;comment:鎴愭湰鏂规硶"` //鎴愭湰鏂规硶 + InventoryValuation constvar.InventoryValuation `json:"inventoryValuation" gorm:"type:tinyint;comment:搴撳瓨璁′环"` //搴撳瓨璁′环 } ProductCategorySearch struct { -- Gitblit v1.8.0