From 376674825b7d51a3daa63f45daabbb01f688ee05 Mon Sep 17 00:00:00 2001 From: songchuang <192749120@qq.com> Date: Thu, 23 Mar 2023 11:52:18 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=B9=E8=B4=A6=E5=8D=95=E8=A1=A8=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmd/model/artworkStatement.go | 39 ----------------------------- cmd/model/contract.go | 47 +++++++++++++++++++---------------- pkg/db/init.go | 2 +- 3 files changed, 26 insertions(+), 62 deletions(-) delete mode 100644 cmd/model/artworkStatement.go diff --git a/cmd/model/artworkStatement.go b/cmd/model/artworkStatement.go deleted file mode 100644 index a5f23fb..0000000 --- a/cmd/model/artworkStatement.go +++ /dev/null @@ -1,39 +0,0 @@ -package model - -// 对账单委托画作批次 -type StatementBatch struct { - Model - Uid string `gorm:"column:uid;type:varchar(100);comment:对账单表的唯一表示;NOT NULL" json:"uid"` - StType int32 `gorm:"column:st_type;unqiueIndex:sttype_uid_batchtime_idx;comment:对账单类型 1=版权 2=物权;"` - ArtistUid string `gorm:"column:artist_uid;unqiueIndex:sttype_uid_batchtime_idx;comment:画家uid"` - ArtistName string `gorm:"column:artist_name;comment:画家姓名;"` - BatchTime string `gorm:"column:batch_time;unqiueIndex:sttype_uid_batchtime_idx;comment:批次时间;"` - FlowStatus int32 `gorm:"column:flow_status;default:1;comment:流程状态 1=未生成 2=已生成未签署 3=已签署"` - - ViewUrl string `gorm:"column:view_url;type:varchar(500);comment:在线查看对账单链接" json:"view_url"` - DownloadUrl string `gorm:"column:download_url;type:varchar(500);comment:对账单下载链接" json:"download_url"` - BatchId int64 `gorm:"column:batch_id;unqiueIndex:batchid_tfnum_idx;comment:批次id;"` - EntrustList []ArtworkStatementDetail `gorm:"foreignKey:BatchId;references:ID"` //当前批次的委托单详情 -} - -func (StatementBatch) TableName() string { - return "statement_batch" -} - -// // 对账单画作委托详情 -// type ArtworkStatementDetail struct { -// Model -// Uid string `gorm:"column:uid;type:varchar(100);comment:对账单画作详情表的唯一表示;NOT NULL" json:"uid"` -// BatchId int64 `gorm:"column:batch_id;unqiueIndex:batchid_tfnum_idx;comment:批次id;"` -// TfNum string `gorm:"column:tf_num;unqiueIndex:batchid_tfnum_idx;comment:"泰丰画作编号"` -// ArtworkName string `gorm:"column:artwork_name;comment:画作名称"` -// Ruler string `gorm:"column:ruler;comment:平尺"` -// SaleNo string `gorm:"column:sale_no;comment:销售单号"` -// CompleteDate string `gorm:"column:complete_date;comment:成交日期"` -// MinPrice float32 `gorm:"column:min_price;comment:委托销售底价"` -// GuaranteePrice float32 `gorm:"column:guarantee_price;comment:已收取保证金;"` -// } - -// func (ArtworkStatementDetail) TableName() string { -// return "artwork_statement_detail" -// } diff --git a/cmd/model/contract.go b/cmd/model/contract.go index da5806d..d46c4db 100644 --- a/cmd/model/contract.go +++ b/cmd/model/contract.go @@ -4,30 +4,30 @@ import "gorm.io/plugin/soft_delete" // Contract 用户模型 type Contract struct { - ID int32 `gorm:"column:id;type:int(11);primary_key;AUTO_INCREMENT" json:"id"` - Uid string `gorm:"column:uid;type:varchar(100);comment:合同表的唯一表示;NOT NULL" json:"uid"` - ArtistUid string `gorm:"column:artist_uid;type:varchar(100);comment:画家uid;NOT NULL" json:"artist_uid"` - ArtworkUid string `gorm:"column:artwork_uid;type:varchar(1000);comment:画作uid" json:"artwork_uid"` - ContractId string `gorm:"column:contract_id;type:varchar(300);comment:合同id" json:"contract_id"` - TransactionId string `gorm:"column:transaction_id;type:varchar(300);comment:交易id" json:"transaction_id"` - Type int32 `gorm:"column:type;type:int(1);comment:合同类型 (1);NOT NULL" json:"type"` - ViewUrl string `gorm:"column:view_url;type:varchar(500);comment:在线查看合同链接" json:"view_url"` - DownloadUrl string `gorm:"column:download_url;type:varchar(500);comment:合同下载链接" json:"download_url"` - State int32 `gorm:"column:state;type:int(1);comment:合同状态,1:未签署2:已签署;NOT NULL" json:"state"` //1 未签署 2 已签署 - Status int32 `gorm:"column:status;default:2;comment:2=锁定 3=解锁" json:"status" ` //跟随用户的锁定和解锁状态,用于控制数据的展示 - LockTime string `gorm:"column:lock_time;comment:锁定时间" json:"lockTime"` - SignTime string `gorm:"column:sign_time;comment:签署时间" json:"sign_time"` - BatchName string `gorm:"column:batch_name;comment:批次名" json:"batch_name"` - StType int32 `gorm:"column:st_type;unqiueIndex:sttype_uid_batchtime_idx;comment:对账单类型 1=版权 2=物权;"` - ArtworkInfo []ArtworkStatementDetail `gorm:"column:artwork_info;foreignKey:Uid;references:BatchUid"` //当前批次的委托单详情 - CreatedAt int32 `gorm:"column:created_at;autoCreateTime"` - UpdatedAt int32 `gorm:"column:updated_at;autoCreateTime"` + ID int32 `gorm:"column:id;type:int(11);primary_key;AUTO_INCREMENT" json:"id"` + Uid string `gorm:"column:uid;type:varchar(100);comment:合同表的唯一表示;NOT NULL" json:"uid"` + ArtistUid string `gorm:"column:artist_uid;type:varchar(100);comment:画家uid;NOT NULL" json:"artist_uid"` + ArtworkUid string `gorm:"column:artwork_uid;type:varchar(1000);comment:画作uid" json:"artwork_uid"` + ContractId string `gorm:"column:contract_id;type:varchar(300);comment:合同id" json:"contract_id"` + TransactionId string `gorm:"column:transaction_id;type:varchar(300);comment:交易id" json:"transaction_id"` + Type int32 `gorm:"column:type;type:int(1);comment:合同类型 (1);NOT NULL" json:"type"` + ViewUrl string `gorm:"column:view_url;type:varchar(500);comment:在线查看合同链接" json:"view_url"` + DownloadUrl string `gorm:"column:download_url;type:varchar(500);comment:合同下载链接" json:"download_url"` + State int32 `gorm:"column:state;type:int(1);comment:合同状态,1:未签署2:已签署;NOT NULL" json:"state"` //1 未签署 2 已签署 + Status int32 `gorm:"column:status;default:2;comment:2=锁定 3=解锁" json:"status" ` //跟随用户的锁定和解锁状态,用于控制数据的展示 + LockTime string `gorm:"column:lock_time;comment:锁定时间" json:"lockTime"` + SignTime string `gorm:"column:sign_time;comment:签署时间" json:"sign_time"` + BatchName string `gorm:"column:batch_name;comment:批次名" json:"batch_name"` + StType int32 `gorm:"column:st_type;unqiueIndex:sttype_uid_batchtime_idx;comment:对账单类型 1=版权 2=物权;"` + ArtworkInfo []ArtworkTxDetail `gorm:"foreignKey:Uid;references:BatchUid"` //当前批次的物权委托单详情 + CreatedAt int32 `gorm:"column:created_at;autoCreateTime"` + UpdatedAt int32 `gorm:"column:updated_at;autoCreateTime"` DeletedAt soft_delete.DeletedAt } // 对账单画作物权委托详情 -type ArtworkStatementDetail struct { - Model +type ArtworkTxDetail struct { + ID int32 `gorm:"column:id;type:int(11);primary_key;AUTO_INCREMENT" json:"id"` Uid string `gorm:"column:uid;type:varchar(100);comment:对账单画作物权详情表的唯一表示;NOT NULL" json:"uid"` BatchUid int64 `gorm:"column:batch_id;unqiueIndex:batchid_tfnum_idx;comment:批次id;"` TfNum string `gorm:"column:tf_num;unqiueIndex:batchid_tfnum_idx;comment:"泰丰画作编号"` @@ -38,8 +38,11 @@ type ArtworkStatementDetail struct { MinPrice float32 `gorm:"column:min_price;comment:委托销售底价"` SalePrice float32 `gorm:"column:sale_price;comment:画作售价"` GuaranteePrice float32 `gorm:"column:guarantee_price;comment:已收取保证金;"` + CreatedAt int32 `gorm:"column:created_at;autoCreateTime"` + UpdatedAt int32 `gorm:"column:updated_at;autoCreateTime"` + DeletedAt soft_delete.DeletedAt } -func (ArtworkStatementDetail) TableName() string { - return "artwork_statement_detail" +func (ArtworkTxDetail) TableName() string { + return "artwork_tx_detail" } diff --git a/pkg/db/init.go b/pkg/db/init.go index 60089f3..abcf49c 100644 --- a/pkg/db/init.go +++ b/pkg/db/init.go @@ -123,7 +123,7 @@ func migration() { &model.ArtshowArtistIndex{}, //画展-画家指数 &model.ArtshowArtistSupplement{}, //画展-画家补充信息 &model.Contract{}, //合同 - &model.ArtworkStatementDetail{}, //对账单详情 + &model.ArtworkTxDetail{}, //对账单详情 // &model.StatementBatch{}, //对账单批次 // &model.ArtworkEntrustDetail{}, // // &model.ArtworkSalesDetail{}, //