161 lines
5.5 KiB
Go
161 lines
5.5 KiB
Go
package dao
|
|
|
|
// import (
|
|
// "github.com/fonchain/fonchain-artistinfo/cmd/model"
|
|
// "github.com/fonchain/fonchain-artistinfo/pb/artistinfoStatement"
|
|
// )
|
|
|
|
// =====================================
|
|
//
|
|
// 对账单批次
|
|
// 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{}
|
|
// for _, in := range in.Data {
|
|
// datas = append(datas, 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(&datas).Error
|
|
// return err
|
|
// }
|
|
|
|
// func GetStatementBatchList(in *artistinfoStatement.GetStatementBatchListRequest) (res []model.StatementBatch, total int64, err error) {
|
|
// res = []model.StatementBatch{}
|
|
// var orm = db.DB.Model(model.StatementBatch{}).Order("created_at desc").Preload("ArtworkList")
|
|
// if in.Condition.StType != 0 {
|
|
// orm = orm.Where("st_type = ?", in.Condition.StType)
|
|
// }
|
|
// if in.Condition.ArtistUid != "" {
|
|
// orm = orm.Where("artist_uid = ?", in.Condition.ArtistUid)
|
|
// }
|
|
// if in.Condition.ArtistRealName != "" {
|
|
// orm = orm.Where("artist_real_name = ?", in.Condition.ArtistRealName)
|
|
// }
|
|
// if in.Condition.FlowStatus != 0 {
|
|
// orm = orm.Where("flow_status = ?", in.Condition.FlowStatus)
|
|
// }
|
|
// if in.Condition.BatchTime != "" {
|
|
// orm = orm.Where("batch_time = ?", in.Condition.BatchTime)
|
|
// }
|
|
// if in.Condition.MinPrice != 0 {
|
|
// orm = orm.Where("min_price = ?", in.Condition.MinPrice)
|
|
// }
|
|
// if in.Condition.GuaranteePrice != 0 {
|
|
// orm = orm.Where("guarantee_price = ?", in.Condition.GuaranteePrice)
|
|
// }
|
|
// if in.Condition.Id != 0 {
|
|
// orm = orm.Where("id = ?", in.Condition.Id)
|
|
// }
|
|
// if in.Condition.FileUrl != "" {
|
|
// orm = orm.Where("file_url = ?", in.Condition.FileUrl)
|
|
// }
|
|
// if len(in.Ids) > 0 {
|
|
// orm = orm.Where("id in ?", in.Ids)
|
|
// }
|
|
// if len(in.BatchTimeList) > 0 {
|
|
// orm = orm.Where("batch_time in ?", in.BatchTimeList)
|
|
// }
|
|
// err = orm.Count(&total).Scopes(db.Pagination(in.Page, in.PageSize)).Find(&res).Error
|
|
// return
|
|
// }
|
|
|
|
// func GetStatementBatchTimeMenus(in *artistinfoStatement.GetStatementBatchListRequest) (res []string, err error) {
|
|
// res = []string{}
|
|
// err = db.DB.Model(model.StatementBatch{}).Pluck("batch_time", &res).Error
|
|
// return
|
|
// }
|
|
|
|
// //=====================================
|
|
// // 对账单详情
|
|
|
|
// func CreateStatementDetail(in *artistinfoStatement.StatementDetailRequest) (res model.StatementDetail, err error) {
|
|
// res = model.StatementDetail{
|
|
// BatchId: in.BatchId,
|
|
// TfNum: in.TfNum,
|
|
// ArtworkName: in.ArtworkName,
|
|
// Ruler: in.Ruler,
|
|
// SaleNo: in.SaleNo,
|
|
// CompleteDate: in.CompleteDate,
|
|
// }
|
|
// err = db.DB.Clauses(clause.OnConflict{
|
|
// Columns: []clause.Column{{Name: "tf_num"}, {Name: "batch_id"}},
|
|
// UpdateAll: true,
|
|
// }).Create(&res).Error
|
|
// return
|
|
// }
|
|
|
|
// func BatchCreateStatementDetail(in *artistinfoStatement.BatchCreateStatementDetailRequest) error {
|
|
// var datas = []model.StatementDetail{}
|
|
// for _, in := range in.Data {
|
|
// datas = append(datas, model.StatementDetail{
|
|
// BatchId: in.BatchId,
|
|
// TfNum: in.TfNum,
|
|
// ArtworkName: in.ArtworkName,
|
|
// Ruler: in.Ruler,
|
|
// SaleNo: in.SaleNo,
|
|
// CompleteDate: in.CompleteDate,
|
|
// })
|
|
// }
|
|
// err := db.DB.Clauses(clause.OnConflict{
|
|
// Columns: []clause.Column{{Name: "tf_num"}, {Name: "batch_id"}},
|
|
// UpdateAll: true,
|
|
// }).Create(&datas).Error
|
|
// return err
|
|
// }
|
|
|
|
// func GetStatementDetailList(in *artistinfoStatement.GetStatementDetailListRequest) (res []model.StatementDetail, total int64, err error) {
|
|
// res = []model.StatementDetail{}
|
|
// var orm = db.DB.Model(model.StatementDetail{}).Order("created_at desc")
|
|
// if in.Condition.BatchId != 0 {
|
|
// orm = orm.Where("batch_id = ?", in.Condition.BatchId)
|
|
// }
|
|
// if in.Condition.TfNum != "" {
|
|
// orm = orm.Where("tf_num = ?", in.Condition.TfNum)
|
|
// }
|
|
// if in.Condition.ArtworkName != "" {
|
|
// orm = orm.Where("artwork_name like = ?", "%"+in.Condition.ArtworkName+"%")
|
|
// }
|
|
// if in.Condition.Ruler != "" {
|
|
// orm = orm.Where("ruler = ?", in.Condition.Ruler)
|
|
// }
|
|
// if in.Condition.SaleNo != "" {
|
|
// orm = orm.Where("sale_no = ?", in.Condition.SaleNo)
|
|
// }
|
|
// if in.Condition.CompleteDate != "" {
|
|
// orm = orm.Where("complete_date = ?", in.Condition.CompleteDate)
|
|
// }
|
|
// if in.Condition.Id != 0 {
|
|
// orm = orm.Where("id = ?", in.Condition.Id)
|
|
// }
|
|
// err = orm.Count(&total).Scopes(db.Pagination(in.Page, in.PageSize)).Find(&res).Error
|
|
// return
|
|
// }
|