From d6729207431d778bb341d94fd746042acb07e575 Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Tue, 3 Sep 2024 15:28:07 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/super/dao/agent_financial_dynamics_dao.go | 7 ++++ .../dao/medium_financial_dynamics_dao.go | 7 ++++ .../agent_financial_dynamics_implement.go | 36 +++++++++++++++++++ .../medium_financial_dynamics_implement.go | 36 +++++++++++++++++++ src/super/model/agent_financial_dynamics.go | 19 ++++++++++ src/super/model/medium_financial_dynamics.go | 19 ++++++++++ 6 files changed, 124 insertions(+) create mode 100644 src/super/dao/agent_financial_dynamics_dao.go create mode 100644 src/super/dao/medium_financial_dynamics_dao.go create mode 100644 src/super/implement/agent_financial_dynamics_implement.go create mode 100644 src/super/implement/medium_financial_dynamics_implement.go create mode 100644 src/super/model/agent_financial_dynamics.go create mode 100644 src/super/model/medium_financial_dynamics.go diff --git a/src/super/dao/agent_financial_dynamics_dao.go b/src/super/dao/agent_financial_dynamics_dao.go new file mode 100644 index 0000000..e5f9723 --- /dev/null +++ b/src/super/dao/agent_financial_dynamics_dao.go @@ -0,0 +1,7 @@ +package dao + +import "code.fnuoos.com/zhimeng/model.git/src/super/model" + +type AgentFinancialDynamicsDao interface { + FindAgentFinancialDynamics(uuid, agentId, startTime, endTime string, page, limit int) (list []model.AgentFinancialDynamics, total int64, err error) +} diff --git a/src/super/dao/medium_financial_dynamics_dao.go b/src/super/dao/medium_financial_dynamics_dao.go new file mode 100644 index 0000000..0519de0 --- /dev/null +++ b/src/super/dao/medium_financial_dynamics_dao.go @@ -0,0 +1,7 @@ +package dao + +import "code.fnuoos.com/zhimeng/model.git/src/super/model" + +type MediumFinancialDynamicsDao interface { + FindMediumFinancialDynamics(uuid, mediumId, startTime, endTime string, page, limit int) (list []model.MediumFinancialDynamics, total int64, err error) +} diff --git a/src/super/implement/agent_financial_dynamics_implement.go b/src/super/implement/agent_financial_dynamics_implement.go new file mode 100644 index 0000000..2d2b216 --- /dev/null +++ b/src/super/implement/agent_financial_dynamics_implement.go @@ -0,0 +1,36 @@ +package implement + +import ( + "code.fnuoos.com/zhimeng/model.git/src/super/dao" + "code.fnuoos.com/zhimeng/model.git/src/super/model" + "xorm.io/xorm" +) + +func NewAgentFinancialDynamicsDb(engine *xorm.Engine) dao.AgentFinancialDynamicsDao { + return &AgentFinancialDynamicsDb{Db: engine} +} + +type AgentFinancialDynamicsDb struct { + Db *xorm.Engine +} + +func (m AgentFinancialDynamicsDb) FindAgentFinancialDynamics(uuid, agentId, startTime, endTime string, page, limit int) (list []model.AgentFinancialDynamics, total int64, err error) { + sess := m.Db.Desc("id").Limit(limit, (page-1)*limit) + if uuid != "" { + sess.And("uuid = ?", uuid) + } + if agentId != "" { + sess.And("agent_id = ?", agentId) + } + if startTime != "" { + sess.And("pay_time >= ?", startTime) + } + if endTime != "" { + sess.And("pay_time <= ?", endTime) + } + total, err = sess.FindAndCount(&list) + if err != nil { + return nil, 0, err + } + return +} diff --git a/src/super/implement/medium_financial_dynamics_implement.go b/src/super/implement/medium_financial_dynamics_implement.go new file mode 100644 index 0000000..56953bb --- /dev/null +++ b/src/super/implement/medium_financial_dynamics_implement.go @@ -0,0 +1,36 @@ +package implement + +import ( + "code.fnuoos.com/zhimeng/model.git/src/super/dao" + "code.fnuoos.com/zhimeng/model.git/src/super/model" + "xorm.io/xorm" +) + +func NewMediumFinancialDynamicsDb(engine *xorm.Engine) dao.MediumFinancialDynamicsDao { + return &MediumFinancialDynamicsDb{Db: engine} +} + +type MediumFinancialDynamicsDb struct { + Db *xorm.Engine +} + +func (m MediumFinancialDynamicsDb) FindMediumFinancialDynamics(uuid, mediumId, startTime, endTime string, page, limit int) (list []model.MediumFinancialDynamics, total int64, err error) { + sess := m.Db.Desc("id").Limit(limit, (page-1)*limit) + if uuid != "" { + sess.And("uuid = ?", uuid) + } + if mediumId != "" { + sess.And("medium_id = ?", mediumId) + } + if startTime != "" { + sess.And("pay_time >= ?", startTime) + } + if endTime != "" { + sess.And("pay_time <= ?", endTime) + } + total, err = sess.FindAndCount(&list) + if err != nil { + return nil, 0, err + } + return +} diff --git a/src/super/model/agent_financial_dynamics.go b/src/super/model/agent_financial_dynamics.go new file mode 100644 index 0000000..0fa19ac --- /dev/null +++ b/src/super/model/agent_financial_dynamics.go @@ -0,0 +1,19 @@ +package model + +import ( + "time" +) + +type AgentFinancialDynamics struct { + Id int `json:"id" xorm:"not null pk autoincr INT(11)"` + Uuid int `json:"uuid" xorm:"default 0 INT(11)"` + AgentId int `json:"agent_id" xorm:"default 0 comment('代理id') INT(11)"` + PayTime time.Time `json:"pay_time" xorm:"comment('支付时间') DATETIME"` + CreateAt time.Time `json:"create_at" xorm:"DATETIME"` + UpdateAt time.Time `json:"update_at" xorm:"DATETIME"` + Amount string `json:"amount" xorm:"default 0.00 comment('支付金额') DECIMAL(20,2)"` + PayMethod int `json:"pay_method" xorm:"default 0 comment('支付方式 0对私 1对公') TINYINT(1)"` + Certificate string `json:"certificate" xorm:"comment('支付凭证') VARCHAR(255)"` + Memo string `json:"memo" xorm:"comment('备注') VARCHAR(255)"` + BusinessKind int `json:"business_kind" xorm:"not null default 1 comment('业务类型(1:广告合作)') TINYINT(1)"` +} diff --git a/src/super/model/medium_financial_dynamics.go b/src/super/model/medium_financial_dynamics.go new file mode 100644 index 0000000..b322eb8 --- /dev/null +++ b/src/super/model/medium_financial_dynamics.go @@ -0,0 +1,19 @@ +package model + +import ( + "time" +) + +type MediumFinancialDynamics struct { + Id int `json:"id" xorm:"not null pk autoincr INT(11)"` + Uuid int `json:"uuid" xorm:"default 0 INT(11)"` + MediumId int `json:"medium_id" xorm:"not null default 0 comment('媒体id') INT(11)"` + PayTime time.Time `json:"pay_time" xorm:"comment('支付时间') DATETIME"` + CreateAt time.Time `json:"create_at" xorm:"DATETIME"` + UpdateAt time.Time `json:"update_at" xorm:"DATETIME"` + Amount string `json:"amount" xorm:"default 0.00 comment('支付金额') DECIMAL(20,2)"` + PayMethod int `json:"pay_method" xorm:"default 0 comment('支付方式 0对私 1对公') TINYINT(1)"` + Certificate string `json:"certificate" xorm:"comment('支付凭证') VARCHAR(255)"` + Memo string `json:"memo" xorm:"comment('备注') VARCHAR(255)"` + BusinessKind int `json:"business_kind" xorm:"not null default 1 comment('业务类型(1:广告合作)') TINYINT(1)"` +}