From 886b1ae4bdaac1fc9a2eb98b91dc333f14f70c50 Mon Sep 17 00:00:00 2001 From: zhangqian <zhangqian@123.com> Date: 星期三, 09 八月 2023 17:41:42 +0800 Subject: [PATCH] 新增和编辑服务合同时更新应收款金额,新增服务合同发票时更新已开票金额 --- model/product.go | 19 +++++++++++-------- 1 files changed, 11 insertions(+), 8 deletions(-) diff --git a/model/product.go b/model/product.go index 029857b..20f0fc2 100644 --- a/model/product.go +++ b/model/product.go @@ -1,15 +1,18 @@ package model -import "gorm.io/gorm" +import ( + "github.com/shopspring/decimal" + "gorm.io/gorm" +) type Product struct { - Id int `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"` - Name string `json:"name" gorm:"column:name;type:varchar(255);comment:浜у搧鍚嶇О"` - Price float64 `json:"price" gorm:"column:price;type:decimal(10,2);comment:浜у搧浠锋牸"` - Number string `json:"number" gorm:"column:number;type:varchar(255);comment:浜у搧缂栧彿"` - Amount int `json:"amount" gorm:"column:amount;type:int;comment:浜у搧鏁伴噺"` - Total float64 `json:"total" gorm:"column:total;type:decimal(10,2);comment:浜у搧鎬讳环"` - Desc string `json:"desc" gorm:"column:desc;type:varchar(255);comment:浜у搧鎻忚堪"` + Id int `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"` + Name string `json:"name" gorm:"column:name;type:varchar(255);comment:浜у搧鍚嶇О"` + Price decimal.Decimal `json:"price" gorm:"column:price;type:decimal(10,2);comment:浜у搧浠锋牸"` + Number string `json:"number" gorm:"column:number;type:varchar(255);comment:浜у搧缂栧彿"` + Amount decimal.Decimal `json:"amount" gorm:"column:amount;type:int;comment:浜у搧鏁伴噺"` + Total decimal.Decimal `json:"total" gorm:"column:total;type:decimal(10,2);comment:浜у搧鎬讳环"` + Desc string `json:"desc" gorm:"column:desc;type:varchar(255);comment:浜у搧鎻忚堪"` gorm.Model `json:"-"` } -- Gitblit v1.8.0