更新去重索引

This commit is contained in:
徐俊杰 2023-03-21 11:18:11 +08:00
parent 0876153953
commit c8696a969f
4 changed files with 69 additions and 41 deletions

View File

@ -1,32 +1,32 @@
package dao package dao
// import ( import (
// "github.com/fonchain/fonchain-artistinfo/cmd/model" "github.com/fonchain/fonchain-artistinfo/cmd/model"
// "github.com/fonchain/fonchain-artistinfo/pb/artistinfoStatement" "github.com/fonchain/fonchain-artistinfo/pb/artistinfoStatement"
// db "github.com/fonchain/fonchain-artistinfo/pkg/db" db "github.com/fonchain/fonchain-artistinfo/pkg/db"
// "gorm.io/gorm/clause" "gorm.io/gorm/clause"
// ) )
// =====================================
// //
// // ===================================== // 对账单批次
// // func CreateStatementBatch(in *artistinfoStatement.StatementBatchRequest) (res model.StatementBatch, err error) {
// // 对账单批次 res = model.StatementBatch{
// func CreateStatementBatch(in *artistinfoStatement.StatementBatchRequest) (res model.StatementBatch, err error) { StType: in.StType,
// res = model.StatementBatch{ ArtistUid: in.ArtistUid,
// StType: in.StType, ArtistRealName: in.ArtistRealName,
// ArtistUid: in.ArtistUid, FlowStatus: in.FlowStatus,
// ArtistRealName: in.ArtistRealName, BatchTime: in.BatchTime,
// FlowStatus: in.FlowStatus, MinPrice: in.MinPrice,
// BatchTime: in.BatchTime, GuaranteePrice: in.GuaranteePrice,
// MinPrice: in.MinPrice, FileUrl: in.FileUrl,
// GuaranteePrice: in.GuaranteePrice, }
// FileUrl: in.FileUrl, err = db.DB.Clauses(clause.OnConflict{
// } Columns: []clause.Column{{Name: "st_type"}, {Name: "artist_uid"}, {Name: "batch_time"}},
// err = db.DB.Clauses(clause.OnConflict{ UpdateAll: true,
// Columns: []clause.Column{{Name: "st_type"}, {Name: "artist_uid"}, {Name: "batch_time"}}, }).Create(&res).Error
// UpdateAll: true, return
// }).Create(&res).Error }
// return
// }
// func BatchCreateStatementBatch(in *artistinfoStatement.BatchCreateStatementBatchRequest) error { // func BatchCreateStatementBatch(in *artistinfoStatement.BatchCreateStatementBatchRequest) error {
// var datas = []model.StatementBatch{} // var datas = []model.StatementBatch{}

View File

@ -5,13 +5,13 @@ type StatementBatch struct {
Model Model
// StType int32 `gorm:"column:st_type;unqiueIndex:sttype_uid_batchtime_idx;comment:对账单类型 1=版权 2=物权;"` // 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"` ArtistUid string `gorm:"column:artist_uid;unqiueIndex:sttype_uid_batchtime_idx;comment:画家uid"`
// ArtistRealName string `gorm:"column:artist_real_name;comment:画家真实姓名;"` ArtistName string `gorm:"column:artist_name;comment:画家姓名;"`
BatchTime string `gorm:"column:batch_time;unqiueIndex:sttype_uid_batchtime_idx;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=已签署"` FlowStatus int32 `gorm:"column:flow_status;default:1;comment:流程状态 1=未生成 2=已生成未签署 3=已签署"`
FileUrl string `gorm:"column:file_url,comment:对账单文件地址;"` // FileUrl string `gorm:"column:file_url,comment:对账单文件地址;"`
EntrustList []ArtworkEntrustDetail `gorm:"foreignKey:BatchId"` EntrustList []ArtworkEntrustDetail `gorm:"foreignKey:BatchId"` //当前批次的委托单详情
SalesList []ArtworkSalesDetail `gorm:"foreignKey:BatchId"` SalesList []ArtworkSalesDetail `gorm:"foreignKey:BatchId"` //当前批次的销售单详情
} }
func (StatementBatch) TableName() string { func (StatementBatch) TableName() string {

View File

@ -3,9 +3,9 @@ package model
// User 用户模型 // User 用户模型
type User struct { type User struct {
Model Model
MgmtAccId int64 `gorm:"column:mgmt_acc_id;not null;uniqueIndex:mgmt_acc_mgmt_artist_idx;comment:账号id"` MgmtAccId int64 `gorm:"column:mgmt_acc_id;not null;uniqueIndex:mgmt_acc_mgmt_artist_uid;comment:账号id"`
MgmtArtistId int64 `gorm:"column:mgmt_artist_id;not null;uniqueIndex:mgmt_acc_mgmt_artist_idx;comment:艺术家id"` MgmtArtistId int64 `gorm:"column:mgmt_artist_id;not null;comment:艺术家id"`
MgmtArtistUid string `gorm:"column:mgmt_artist_uid;type:varchar(256);comment:艺术家uid"` MgmtArtistUid string `gorm:"column:mgmt_artist_uid;type:varchar(256);uniqueIndex:mgmt_acc_mgmt_artist_uid;comment:艺术家uid"`
TelNum string `gorm:"column:tel_num;type:varchar(20);not null;电话号码"` TelNum string `gorm:"column:tel_num;type:varchar(20);not null;电话号码"`
InviteCode string `gorm:"column:invited_code;type:varchar(16);default:'';comment:个人邀请码"` InviteCode string `gorm:"column:invited_code;type:varchar(16);default:'';comment:个人邀请码"`
InvitedBy *Invite `gorm:"foreignKey:InvitedId"` //邀请者的相关信息 InvitedBy *Invite `gorm:"foreignKey:InvitedId"` //邀请者的相关信息

View File

@ -8,7 +8,7 @@ import "google/protobuf/empty.proto"; //使用 google.protobuf.Empty
// protoc -I . -I ./pb --proto_path=. --go_out=./pb/artistinfoStatement --go-triple_out=./pb/artistinfoStatement --validate_out="lang=go:./pb/artistinfoStatement" ./pb/artistinfoStatement.proto // protoc -I . -I ./pb --proto_path=. --go_out=./pb/artistinfoStatement --go-triple_out=./pb/artistinfoStatement --validate_out="lang=go:./pb/artistinfoStatement" ./pb/artistinfoStatement.proto
service Statement { service Statement {
rpc CreateStatementBatch(StatementBatchRequest)returns(CreateStatementBatchResponse){}; // rpc CreateOrUpdateStatementBatch(StatementBatchRequest)returns(CreateStatementBatchResponse){}; //
rpc BatchCreateStatementBatch(BatchCreateStatementBatchRequest)returns(google.protobuf.Empty){}; // rpc BatchCreateStatementBatch(BatchCreateStatementBatchRequest)returns(google.protobuf.Empty){}; //
rpc GetStatementBatchList(GetStatementBatchListRequest)returns(GetStatementBatchListResponse){}; // rpc GetStatementBatchList(GetStatementBatchListRequest)returns(GetStatementBatchListResponse){}; //
rpc GetStatementBatchTimeMenus(GetStatementBatchListRequest)returns(GetStatementBatchTimeMenusResponse){}; // rpc GetStatementBatchTimeMenus(GetStatementBatchListRequest)returns(GetStatementBatchTimeMenusResponse){}; //
@ -24,19 +24,47 @@ message StatementPageInfo{
int64 total=3; int64 total=3;
} }
message StatementBatchRequest{ enum StatementCreateType{
int32 stType=1; // cmd/model/artworkStatement.go saveEntrust=0;
saveSalse=1;
}
message StatementBatchRequest{ // cmd/model/artworkStatement.go
string artistUid=1;
string artistName=2;
string aatchTime=3;
int32 flowStatus=4;
StatementCreateType updateType=5;
repeated EntrustRequest entrustList=6;
repeated SalesRequest salesList=7;
}
message EntrustRequest{
string tfNum =1;
string artworkName =2;
string ruler =3;
string saleNo =4;
string completeDate =5;
float minPrice =6;
float guaranteePrice =7;
}
message SalesRequest {
string tfNum =1;
string artworkName =2;
string ruler =3;
string saleNo =4;
string completeDate =5;
}
message StatementBatchInfo{ // cmd/model/artworkStatement.go
// int32 stType=1;
string artistUid=2; string artistUid=2;
string artistRealName=3; string artistName=3;
int32 flowStatus=4; int32 flowStatus=4;
string batchTime=5; string batchTime=5;
float minPrice=6;
float guaranteePrice=7; float guaranteePrice=7;
int64 id = 8; int64 id = 8;
string createdAt =9; string createdAt =9;
string updatedAt =10; string updatedAt =10;
int64 deletedAt =11; int64 deletedAt =11;
string fileUrl =12;
} }
message CreateStatementBatchResponse{ message CreateStatementBatchResponse{
int64 id =1; int64 id =1;