更新去重索引
This commit is contained in:
parent
0876153953
commit
c8696a969f
@ -1,32 +1,32 @@
|
||||
package dao
|
||||
|
||||
// import (
|
||||
// "github.com/fonchain/fonchain-artistinfo/cmd/model"
|
||||
// "github.com/fonchain/fonchain-artistinfo/pb/artistinfoStatement"
|
||||
// db "github.com/fonchain/fonchain-artistinfo/pkg/db"
|
||||
// "gorm.io/gorm/clause"
|
||||
// )
|
||||
import (
|
||||
"github.com/fonchain/fonchain-artistinfo/cmd/model"
|
||||
"github.com/fonchain/fonchain-artistinfo/pb/artistinfoStatement"
|
||||
db "github.com/fonchain/fonchain-artistinfo/pkg/db"
|
||||
"gorm.io/gorm/clause"
|
||||
)
|
||||
|
||||
// =====================================
|
||||
//
|
||||
// // =====================================
|
||||
// //
|
||||
// // 对账单批次
|
||||
// func CreateStatementBatch(in *artistinfoStatement.StatementBatchRequest) (res model.StatementBatch, err error) {
|
||||
// res = model.StatementBatch{
|
||||
// StType: in.StType,
|
||||
// ArtistUid: in.ArtistUid,
|
||||
// ArtistRealName: in.ArtistRealName,
|
||||
// FlowStatus: in.FlowStatus,
|
||||
// BatchTime: in.BatchTime,
|
||||
// MinPrice: in.MinPrice,
|
||||
// GuaranteePrice: in.GuaranteePrice,
|
||||
// FileUrl: in.FileUrl,
|
||||
// }
|
||||
// err = db.DB.Clauses(clause.OnConflict{
|
||||
// Columns: []clause.Column{{Name: "st_type"}, {Name: "artist_uid"}, {Name: "batch_time"}},
|
||||
// UpdateAll: true,
|
||||
// }).Create(&res).Error
|
||||
// return
|
||||
// }
|
||||
// 对账单批次
|
||||
func CreateStatementBatch(in *artistinfoStatement.StatementBatchRequest) (res model.StatementBatch, err error) {
|
||||
res = model.StatementBatch{
|
||||
StType: in.StType,
|
||||
ArtistUid: in.ArtistUid,
|
||||
ArtistRealName: in.ArtistRealName,
|
||||
FlowStatus: in.FlowStatus,
|
||||
BatchTime: in.BatchTime,
|
||||
MinPrice: in.MinPrice,
|
||||
GuaranteePrice: in.GuaranteePrice,
|
||||
FileUrl: in.FileUrl,
|
||||
}
|
||||
err = db.DB.Clauses(clause.OnConflict{
|
||||
Columns: []clause.Column{{Name: "st_type"}, {Name: "artist_uid"}, {Name: "batch_time"}},
|
||||
UpdateAll: true,
|
||||
}).Create(&res).Error
|
||||
return
|
||||
}
|
||||
|
||||
// func BatchCreateStatementBatch(in *artistinfoStatement.BatchCreateStatementBatchRequest) error {
|
||||
// var datas = []model.StatementBatch{}
|
||||
|
@ -5,13 +5,13 @@ type StatementBatch struct {
|
||||
Model
|
||||
// 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"`
|
||||
// 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:批次时间;"`
|
||||
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"`
|
||||
SalesList []ArtworkSalesDetail `gorm:"foreignKey:BatchId"`
|
||||
EntrustList []ArtworkEntrustDetail `gorm:"foreignKey:BatchId"` //当前批次的委托单详情
|
||||
SalesList []ArtworkSalesDetail `gorm:"foreignKey:BatchId"` //当前批次的销售单详情
|
||||
}
|
||||
|
||||
func (StatementBatch) TableName() string {
|
||||
|
@ -3,9 +3,9 @@ package model
|
||||
// User 用户模型
|
||||
type User struct {
|
||||
Model
|
||||
MgmtAccId int64 `gorm:"column:mgmt_acc_id;not null;uniqueIndex:mgmt_acc_mgmt_artist_idx;comment:账号id"`
|
||||
MgmtArtistId int64 `gorm:"column:mgmt_artist_id;not null;uniqueIndex:mgmt_acc_mgmt_artist_idx;comment:艺术家id"`
|
||||
MgmtArtistUid string `gorm:"column:mgmt_artist_uid;type:varchar(256);comment:艺术家uid"`
|
||||
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;comment:艺术家id"`
|
||||
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;电话号码"`
|
||||
InviteCode string `gorm:"column:invited_code;type:varchar(16);default:'';comment:个人邀请码"`
|
||||
InvitedBy *Invite `gorm:"foreignKey:InvitedId"` //邀请者的相关信息
|
||||
|
@ -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
|
||||
service Statement {
|
||||
rpc CreateStatementBatch(StatementBatchRequest)returns(CreateStatementBatchResponse){}; //创建对账单批次
|
||||
rpc CreateOrUpdateStatementBatch(StatementBatchRequest)returns(CreateStatementBatchResponse){}; //创建或更新对账单,包括更新委托明细和销售明细
|
||||
rpc BatchCreateStatementBatch(BatchCreateStatementBatchRequest)returns(google.protobuf.Empty){}; //批量创建对账单批次
|
||||
rpc GetStatementBatchList(GetStatementBatchListRequest)returns(GetStatementBatchListResponse){}; //批量查询对账单批次
|
||||
rpc GetStatementBatchTimeMenus(GetStatementBatchListRequest)returns(GetStatementBatchTimeMenusResponse){}; //获取对账单批次时间菜单列表
|
||||
@ -24,19 +24,47 @@ message StatementPageInfo{
|
||||
int64 total=3;
|
||||
}
|
||||
|
||||
message StatementBatchRequest{
|
||||
int32 stType=1; // 字段注释请查看对账单结构体模型 cmd/model/artworkStatement.go
|
||||
enum StatementCreateType{
|
||||
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 artistRealName=3;
|
||||
string artistName=3;
|
||||
int32 flowStatus=4;
|
||||
string batchTime=5;
|
||||
float minPrice=6;
|
||||
float guaranteePrice=7;
|
||||
int64 id = 8;
|
||||
string createdAt =9;
|
||||
string updatedAt =10;
|
||||
int64 deletedAt =11;
|
||||
string fileUrl =12;
|
||||
}
|
||||
message CreateStatementBatchResponse{
|
||||
int64 id =1;
|
||||
|
Loading…
Reference in New Issue
Block a user