From 5cb6b8bceb2cd0d26c01ffc91a33ce2aa6dc619b Mon Sep 17 00:00:00 2001 From: dengbiao Date: Mon, 22 Jul 2024 17:52:40 +0800 Subject: [PATCH] update --- .../db_master_b2c_mall_order_statistics.go | 44 +++++++++++++++++++ .../db_master_mall_order_statistics.go | 44 +++++++++++++++++++ .../db_master_o2o_mall_order_statistics.go | 44 +++++++++++++++++++ .../db_master_o2o_pay_order_statistics.go | 44 +++++++++++++++++++ .../model/master_b2c_order_statistics.go | 22 ++++++++++ .../model/master_mall_order_statistics.go | 22 ++++++++++ .../model/master_o2o_order_statistics.go | 22 ++++++++++ .../model/master_o2o_pay_order_statistics.go | 15 +++++++ 8 files changed, 257 insertions(+) create mode 100644 src/models/official/db_master_b2c_mall_order_statistics.go create mode 100644 src/models/official/db_master_mall_order_statistics.go create mode 100644 src/models/official/db_master_o2o_mall_order_statistics.go create mode 100644 src/models/official/db_master_o2o_pay_order_statistics.go create mode 100644 src/models/official/model/master_b2c_order_statistics.go create mode 100644 src/models/official/model/master_mall_order_statistics.go create mode 100644 src/models/official/model/master_o2o_order_statistics.go create mode 100644 src/models/official/model/master_o2o_pay_order_statistics.go diff --git a/src/models/official/db_master_b2c_mall_order_statistics.go b/src/models/official/db_master_b2c_mall_order_statistics.go new file mode 100644 index 0000000..1b1c355 --- /dev/null +++ b/src/models/official/db_master_b2c_mall_order_statistics.go @@ -0,0 +1,44 @@ +package db + +import ( + "code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/models/official/model" + zhios_order_relate_logx "code.fnuoos.com/go_rely_warehouse/zyos_model.git/utils/logx" + "xorm.io/xorm" +) + +// MasterB2cOrderStatisticsInsert 插入单条数据 +func MasterB2cOrderStatisticsInsert(officialDb *xorm.Engine, MasterB2cOrderStatistics *model.MasterB2cOrderStatistics) (int, error) { + _, err := officialDb.InsertOne(MasterB2cOrderStatistics) + if err != nil { + return 0, err + } + return MasterB2cOrderStatistics.Id, nil +} + +func GetMasterB2cOrderStatistics(officialDb *xorm.Engine, masterId int, date string) (m *model.MasterB2cOrderStatistics, err error) { + m = new(model.MasterB2cOrderStatistics) + has, err := officialDb.Where("master_id =?", masterId).And("date =?", date).Get(m) + if err != nil { + return nil, zhios_order_relate_logx.Error(err) + } + if has == false { + return nil, nil + } + return m, nil +} + +func MasterB2cOrderStatisticsUpdate(officialDb *xorm.Engine, id interface{}, m *model.MasterB2cOrderStatistics, forceColums ...string) (int64, error) { + var ( + affected int64 + err error + ) + if forceColums != nil { + affected, err = officialDb.Where("id=?", id).Cols(forceColums...).Update(m) + } else { + affected, err = officialDb.Where("id=?", id).Update(m) + } + if err != nil { + return 0, err + } + return affected, nil +} diff --git a/src/models/official/db_master_mall_order_statistics.go b/src/models/official/db_master_mall_order_statistics.go new file mode 100644 index 0000000..ac86117 --- /dev/null +++ b/src/models/official/db_master_mall_order_statistics.go @@ -0,0 +1,44 @@ +package db + +import ( + "code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/models/official/model" + zhios_order_relate_logx "code.fnuoos.com/go_rely_warehouse/zyos_model.git/utils/logx" + "xorm.io/xorm" +) + +// MasterMallOrderStatisticsInsert 插入单条数据 +func MasterMallOrderStatisticsInsert(officialDb *xorm.Engine, MasterMallOrderStatistics *model.MasterMallOrderStatistics) (int, error) { + _, err := officialDb.InsertOne(MasterMallOrderStatistics) + if err != nil { + return 0, err + } + return MasterMallOrderStatistics.Id, nil +} + +func GetMasterMallOrderStatistics(officialDb *xorm.Engine, masterId int, date string) (m *model.MasterMallOrderStatistics, err error) { + m = new(model.MasterMallOrderStatistics) + has, err := officialDb.Where("master_id =?", masterId).And("date =?", date).Get(m) + if err != nil { + return nil, zhios_order_relate_logx.Error(err) + } + if has == false { + return nil, nil + } + return m, nil +} + +func MasterMallOrderStatisticsUpdate(officialDb *xorm.Engine, id interface{}, m *model.MasterMallOrderStatistics, forceColums ...string) (int64, error) { + var ( + affected int64 + err error + ) + if forceColums != nil { + affected, err = officialDb.Where("id=?", id).Cols(forceColums...).Update(m) + } else { + affected, err = officialDb.Where("id=?", id).Update(m) + } + if err != nil { + return 0, err + } + return affected, nil +} diff --git a/src/models/official/db_master_o2o_mall_order_statistics.go b/src/models/official/db_master_o2o_mall_order_statistics.go new file mode 100644 index 0000000..f5f6ce9 --- /dev/null +++ b/src/models/official/db_master_o2o_mall_order_statistics.go @@ -0,0 +1,44 @@ +package db + +import ( + "code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/models/official/model" + zhios_order_relate_logx "code.fnuoos.com/go_rely_warehouse/zyos_model.git/utils/logx" + "xorm.io/xorm" +) + +// MasterO2oOrderStatisticsInsert 插入单条数据 +func MasterO2oOrderStatisticsInsert(officialDb *xorm.Engine, MasterO2oOrderStatistics *model.MasterO2oOrderStatistics) (int, error) { + _, err := officialDb.InsertOne(MasterO2oOrderStatistics) + if err != nil { + return 0, err + } + return MasterO2oOrderStatistics.Id, nil +} + +func GetMasterO2oOrderStatistics(officialDb *xorm.Engine, masterId int, date string) (m *model.MasterO2oOrderStatistics, err error) { + m = new(model.MasterO2oOrderStatistics) + has, err := officialDb.Where("master_id =?", masterId).And("date =?", date).Get(m) + if err != nil { + return nil, zhios_order_relate_logx.Error(err) + } + if has == false { + return nil, nil + } + return m, nil +} + +func MasterO2oOrderStatisticsUpdate(officialDb *xorm.Engine, id interface{}, m *model.MasterO2oOrderStatistics, forceColums ...string) (int64, error) { + var ( + affected int64 + err error + ) + if forceColums != nil { + affected, err = officialDb.Where("id=?", id).Cols(forceColums...).Update(m) + } else { + affected, err = officialDb.Where("id=?", id).Update(m) + } + if err != nil { + return 0, err + } + return affected, nil +} diff --git a/src/models/official/db_master_o2o_pay_order_statistics.go b/src/models/official/db_master_o2o_pay_order_statistics.go new file mode 100644 index 0000000..e3df76f --- /dev/null +++ b/src/models/official/db_master_o2o_pay_order_statistics.go @@ -0,0 +1,44 @@ +package db + +import ( + "code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/models/official/model" + zhios_order_relate_logx "code.fnuoos.com/go_rely_warehouse/zyos_model.git/utils/logx" + "xorm.io/xorm" +) + +// MasterO2oPayOrderStatisticsInsert 插入单条数据 +func MasterO2oPayOrderStatisticsInsert(officialDb *xorm.Engine, MasterO2oPayOrderStatistics *model.MasterO2oPayOrderStatistics) (int, error) { + _, err := officialDb.InsertOne(MasterO2oPayOrderStatistics) + if err != nil { + return 0, err + } + return MasterO2oPayOrderStatistics.Id, nil +} + +func GetMasterO2oPayOrderStatistics(officialDb *xorm.Engine, masterId int, date string) (m *model.MasterO2oPayOrderStatistics, err error) { + m = new(model.MasterO2oPayOrderStatistics) + has, err := officialDb.Where("master_id =?", masterId).And("date =?", date).Get(m) + if err != nil { + return nil, zhios_order_relate_logx.Error(err) + } + if has == false { + return nil, nil + } + return m, nil +} + +func MasterO2oPayOrderStatisticsUpdate(officialDb *xorm.Engine, id interface{}, m *model.MasterO2oPayOrderStatistics, forceColums ...string) (int64, error) { + var ( + affected int64 + err error + ) + if forceColums != nil { + affected, err = officialDb.Where("id=?", id).Cols(forceColums...).Update(m) + } else { + affected, err = officialDb.Where("id=?", id).Update(m) + } + if err != nil { + return 0, err + } + return affected, nil +} diff --git a/src/models/official/model/master_b2c_order_statistics.go b/src/models/official/model/master_b2c_order_statistics.go new file mode 100644 index 0000000..fab2cee --- /dev/null +++ b/src/models/official/model/master_b2c_order_statistics.go @@ -0,0 +1,22 @@ +package model + +type MasterB2cOrderStatistics struct { + Id int `json:"id" xorm:"not null pk autoincr INT(11)"` + MasterId int `json:"master_id" xorm:"not null default 0 comment('站长id') INT(11)"` + PaymentTotal string `json:"payment_total" xorm:"not null default 0.0000 comment('付款金额(元)') DECIMAL(10,4)"` + OrderCount int `json:"order_count" xorm:"not null default 0 comment('订单数量(笔)') INT(11)"` + EstimatedCommission string `json:"estimated_commission" xorm:"not null default 0.0000 comment('预估佣金(元)') DECIMAL(10,4)"` + EstimatedProfit string `json:"estimated_profit" xorm:"not null default 0.0000 comment('预估利润(元)') DECIMAL(10,4)"` + LoseOrderCount int `json:"lose_order_count" xorm:"not null default 0 comment('失效订单(笔)') INT(11)"` + PlaceOrderNumOfPeople int `json:"place_order_num_of_people" xorm:"not null default 0 comment('下单人数(个)') INT(11)"` + EffectiveOrderCount int `json:"effective_order_count" xorm:"not null default 0 comment('有效订单(笔)') INT(11)"` + EffectiveCommission string `json:"effective_commission" xorm:"not null default 0.0000 comment('有效佣金(元)') DECIMAL(10,4)"` + ReceiveCommission string `json:"receive_commission" xorm:"not null default 0.0000 comment('收货佣金(元)') DECIMAL(10,4)"` + LoseCommission string `json:"lose_commission" xorm:"not null default 0.0000 comment('失效佣金(元)') DECIMAL(10,4)"` + AvgCommission string `json:"avg_commission" xorm:"not null default 0.0000 comment('平均佣金(元)') DECIMAL(10,4)"` + CustomerUnitPrice string `json:"customer_unit_price" xorm:"not null default 0.0000 comment('客单价(元)') DECIMAL(10,4)"` + Date string `json:"date" xorm:"not null default '0000-00-00' comment('统计时间') VARCHAR(50)"` + CreateAt string `json:"create_at" xorm:"not null default 'CURRENT_TIMESTAMP' TIMESTAMP"` + UpdateAt string `json:"update_at" xorm:"default 'CURRENT_TIMESTAMP' TIMESTAMP"` + EffectivePaymentTotal string `json:"effective_payment_total" xorm:"not null default 0.0000 comment('有效付款金额(元)') DECIMAL(10,4)"` +} diff --git a/src/models/official/model/master_mall_order_statistics.go b/src/models/official/model/master_mall_order_statistics.go new file mode 100644 index 0000000..898df40 --- /dev/null +++ b/src/models/official/model/master_mall_order_statistics.go @@ -0,0 +1,22 @@ +package model + +type MasterMallOrderStatistics struct { + Id int `json:"id" xorm:"not null pk autoincr INT(11)"` + MasterId int `json:"master_id" xorm:"not null default 0 comment('站长id') INT(11)"` + PaymentTotal string `json:"payment_total" xorm:"not null default 0.0000 comment('付款金额(元)') DECIMAL(10,4)"` + OrderCount int `json:"order_count" xorm:"not null default 0 comment('订单数量(笔)') INT(11)"` + EstimatedCommission string `json:"estimated_commission" xorm:"not null default 0.0000 comment('预估佣金(元)') DECIMAL(10,4)"` + EstimatedProfit string `json:"estimated_profit" xorm:"not null default 0.0000 comment('预估利润(元)') DECIMAL(10,4)"` + LoseOrderCount int `json:"lose_order_count" xorm:"not null default 0 comment('失效订单(笔)') INT(11)"` + PlaceOrderNumOfPeople int `json:"place_order_num_of_people" xorm:"not null default 0 comment('下单人数(个)') INT(11)"` + EffectiveOrderCount int `json:"effective_order_count" xorm:"not null default 0 comment('有效订单(笔)') INT(11)"` + EffectiveCommission string `json:"effective_commission" xorm:"not null default 0.0000 comment('有效佣金(元)') DECIMAL(10,4)"` + ReceiveCommission string `json:"receive_commission" xorm:"not null default 0.0000 comment('收货佣金(元)') DECIMAL(10,4)"` + LoseCommission string `json:"lose_commission" xorm:"not null default 0.0000 comment('失效佣金(元)') DECIMAL(10,4)"` + AvgCommission string `json:"avg_commission" xorm:"not null default 0.0000 comment('平均佣金(元)') DECIMAL(10,4)"` + CustomerUnitPrice string `json:"customer_unit_price" xorm:"not null default 0.0000 comment('客单价(元)') DECIMAL(10,4)"` + Date string `json:"date" xorm:"not null default '0000-00-00' comment('统计时间') VARCHAR(50)"` + CreateAt string `json:"create_at" xorm:"not null default 'CURRENT_TIMESTAMP' TIMESTAMP"` + UpdateAt string `json:"update_at" xorm:"default 'CURRENT_TIMESTAMP' TIMESTAMP"` + EffectivePaymentTotal string `json:"effective_payment_total" xorm:"not null default 0.0000 comment('有效付款金额(元)') DECIMAL(10,4)"` +} diff --git a/src/models/official/model/master_o2o_order_statistics.go b/src/models/official/model/master_o2o_order_statistics.go new file mode 100644 index 0000000..e8d52ed --- /dev/null +++ b/src/models/official/model/master_o2o_order_statistics.go @@ -0,0 +1,22 @@ +package model + +type MasterO2oOrderStatistics struct { + Id int `json:"id" xorm:"not null pk autoincr INT(11)"` + MasterId int `json:"master_id" xorm:"not null default 0 comment('站长id') INT(11)"` + PaymentTotal string `json:"payment_total" xorm:"not null default 0.0000 comment('付款金额(元)') DECIMAL(10,4)"` + OrderCount int `json:"order_count" xorm:"not null default 0 comment('订单数量(笔)') INT(11)"` + EstimatedCommission string `json:"estimated_commission" xorm:"not null default 0.0000 comment('预估佣金(元)') DECIMAL(10,4)"` + EstimatedProfit string `json:"estimated_profit" xorm:"not null default 0.0000 comment('预估利润(元)') DECIMAL(10,4)"` + LoseOrderCount int `json:"lose_order_count" xorm:"not null default 0 comment('失效订单(笔)') INT(11)"` + PlaceOrderNumOfPeople int `json:"place_order_num_of_people" xorm:"not null default 0 comment('下单人数(个)') INT(11)"` + EffectiveOrderCount int `json:"effective_order_count" xorm:"not null default 0 comment('有效订单(笔)') INT(11)"` + EffectiveCommission string `json:"effective_commission" xorm:"not null default 0.0000 comment('有效佣金(元)') DECIMAL(10,4)"` + ReceiveCommission string `json:"receive_commission" xorm:"not null default 0.0000 comment('收货佣金(元)') DECIMAL(10,4)"` + LoseCommission string `json:"lose_commission" xorm:"not null default 0.0000 comment('失效佣金(元)') DECIMAL(10,4)"` + AvgCommission string `json:"avg_commission" xorm:"not null default 0.0000 comment('平均佣金(元)') DECIMAL(10,4)"` + CustomerUnitPrice string `json:"customer_unit_price" xorm:"not null default 0.0000 comment('客单价(元)') DECIMAL(10,4)"` + Date string `json:"date" xorm:"not null default '0000-00-00' comment('统计时间') VARCHAR(50)"` + CreateAt string `json:"create_at" xorm:"not null default 'CURRENT_TIMESTAMP' TIMESTAMP"` + UpdateAt string `json:"update_at" xorm:"default 'CURRENT_TIMESTAMP' TIMESTAMP"` + EffectivePaymentTotal string `json:"effective_payment_total" xorm:"not null default 0.0000 comment('有效付款金额(元)') DECIMAL(10,4)"` +} diff --git a/src/models/official/model/master_o2o_pay_order_statistics.go b/src/models/official/model/master_o2o_pay_order_statistics.go new file mode 100644 index 0000000..0e1cf1e --- /dev/null +++ b/src/models/official/model/master_o2o_pay_order_statistics.go @@ -0,0 +1,15 @@ +package model + +type MasterO2oPayOrderStatistics struct { + Id int `json:"id" xorm:"not null pk autoincr INT(11)"` + MasterId int `json:"master_id" xorm:"not null default 0 comment('站长id') INT(11)"` + PaymentTotal string `json:"payment_total" xorm:"not null default 0.0000 comment('付款金额(元)') DECIMAL(10,4)"` + OrderCount int `json:"order_count" xorm:"not null default 0 comment('订单数量(笔)') INT(11)"` + EstimatedCommission string `json:"estimated_commission" xorm:"not null default 0.0000 comment('预估佣金(元)') DECIMAL(10,4)"` + PlaceOrderNumOfPeople int `json:"place_order_num_of_people" xorm:"not null default 0 comment('下单人数(个)') INT(11)"` + AvgCommission string `json:"avg_commission" xorm:"not null default 0.0000 comment('平均佣金(元)') DECIMAL(10,4)"` + CustomerUnitPrice string `json:"customer_unit_price" xorm:"not null default 0.0000 comment('客单价(元)') DECIMAL(10,4)"` + Date string `json:"date" xorm:"not null default '0000-00-00' comment('统计时间') VARCHAR(50)"` + CreateAt string `json:"create_at" xorm:"not null default 'CURRENT_TIMESTAMP' TIMESTAMP"` + UpdateAt string `json:"update_at" xorm:"default 'CURRENT_TIMESTAMP' TIMESTAMP"` +}