From 2def11ba83760b5be1361f10c3756cc0e9cfd165 Mon Sep 17 00:00:00 2001
From: zhangqian <zhangqian@123.com>
Date: 星期一, 14 八月 2023 09:32:13 +0800
Subject: [PATCH] merge

---
 model/receipt.go |   28 +++++++++++++++++-----------
 1 files changed, 17 insertions(+), 11 deletions(-)

diff --git a/model/receipt.go b/model/receipt.go
index 60d1d2a..c93385f 100644
--- a/model/receipt.go
+++ b/model/receipt.go
@@ -5,23 +5,29 @@
 	"aps_crm/pkg/mysqlx"
 	"errors"
 	"fmt"
+	"github.com/shopspring/decimal"
 	"gorm.io/gorm"
 )
 
 type (
 	// Receipt 鏀舵鍗�
 	Receipt struct {
-		Id            int    `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"`
-		ClientId      int    `gorm:"client_id" json:"clientId"`            // 瀹㈡埛id
-		SourceType    int    `gorm:"source_type" json:"sourceType"`        // 鏉ユ簮绫诲瀷锛�1閿�鍞槑缁嗗崟2鏈嶅姟鍚堝悓3閿�鍞彂绁�4鏀舵璁″垝5鍑哄簱鍗曪級
-		SourceId      int    `gorm:"source_id" json:"sourceId"`            // 婧愬崟id
-		PrincipalId   int    `gorm:"principal_id" json:"principalId"`      // 璐熻矗浜篿d
-		ReceiptDate   string `gorm:"receipt_date" json:"receiptDate"`      // 鏀舵鏃ユ湡
-		MoneyType     string `gorm:"money_type" json:"moneyType"`          // 甯佺
-		PaymentTypeId int    `gorm:"payment_type_id" json:"paymentTypeId"` // 鏀舵鏂瑰紡ID
-		BankAccountId int    `gorm:"bank_account_id" json:"bankAccountId"` // 璐︽埛id
-		Remark        string `gorm:"remark" json:"remark"`                 // 澶囨敞
-		FileId        int    `gorm:"file_id" json:"fileId"`                // 闄勪欢id
+		Id            int                        `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"`
+		ClientId      int                        `gorm:"column:client_id;type:int;not null;default 0;comment:瀹㈡埛id" json:"clientId"`                                // 瀹㈡埛id
+		SourceType    constvar.ReceiptSourceType `gorm:"column:source_type;type:int;not null;default 0;comment:鏉ユ簮绫诲瀷锛�1閿�鍞槑缁嗗崟2鏈嶅姟鍚堝悓3閿�鍞彂绁�4鏀舵璁″垝5鍑哄簱鍗曪級" json:"sourceType"` // 鏉ユ簮绫诲瀷锛�1閿�鍞槑缁嗗崟2鏈嶅姟鍚堝悓3閿�鍞彂绁�4鏀舵璁″垝5鍑哄簱鍗曪級
+		SourceId      int                        `gorm:"column:source_id;type:int;not null;default 0;comment:婧愬崟id " json:"sourceId"`                               // 婧愬崟id
+		PrincipalId   int                        `gorm:"column:principal_id;type:int;not null;default 0;comment:璐熻矗浜篿d" json:"principalId"`                         // 璐熻矗浜篿d
+		Principal     User                       `gorm:"foreignKey:PrincipalId" json:"principal"`                                                                  // 璐熻矗浜篿d
+		ReceiptDate   string                     `gorm:"column:receipt_date;type:varchar(255);not null;default '';comment:鏀舵鏃ユ湡" json:"receiptDate"`                // 鏀舵鏃ユ湡
+		MoneyType     string                     `gorm:"column:money_type;type:varchar(255);not null;default '';comment:甯佺" json:"moneyType"`                      // 甯佺
+		Amount        decimal.Decimal            `gorm:"column:amount;type:decimal(12,2);not null;default '0.00';comment:鏀舵閲戦" json:"amount"`                      // 鏀舵閲戦
+		PaymentTypeId int                        `gorm:"column:payment_type_id;type:int;not null;default 0;comment:鏀舵鏂瑰紡ID" json:"paymentTypeId"`                   // 鏀舵鏂瑰紡ID
+		PaymentType   PaymentType                `gorm:"foreignKey:PaymentTypeId" json:"paymentType"`
+		BankAccountId int                        `gorm:"column:bank_account_id;type:int;not null;default 0;comment:璐︽埛id" json:"bankAccountId"` // 璐︽埛id
+		BankAccount   BankAccount                `gorm:"foreignKey:BankAccountId" json:"bankAccount"`
+		Remark        string                     `gorm:"column:remark;type:varchar(255);not null;default '';comment:澶囨敞" json:"remark"` // 澶囨敞
+		FileId        int                        `gorm:"column:file_id;type:int;not null;default 0;comment:闄勪欢id" json:"fileId"`        // 闄勪欢id
+		gorm.Model    `json:"-"`
 	}
 
 	// ReceiptSearch 鏀舵鍗曟悳绱㈡潯浠�

--
Gitblit v1.8.0