diff --git a/src/super/dao/agent_settlement_dao.go b/src/super/dao/agent_settlement_dao.go index f997ca7..e3bfff3 100644 --- a/src/super/dao/agent_settlement_dao.go +++ b/src/super/dao/agent_settlement_dao.go @@ -10,4 +10,5 @@ type AgentSettlementDao interface { AgentSettlementInsertBySession(session *xorm.Session, m *model.AgentSettlement) (int64, error) UpdateAgentSettlementBySession(session *xorm.Session, agentSettlement *model.AgentSettlement, columns ...string) (int64, error) FindAgentSettlementList(uuid, mediumId, appId, payState, state, startDate, endDate string, page, limit int) (list []model.AgentSettlement, total int64, err error) + GetAgentSettlementById(id int) (mediumSettlement *model.AgentSettlement, err error) } diff --git a/src/super/dao/agent_with_medium_dao.go b/src/super/dao/agent_with_medium_dao.go index cb22410..6bcc57a 100644 --- a/src/super/dao/agent_with_medium_dao.go +++ b/src/super/dao/agent_with_medium_dao.go @@ -6,6 +6,7 @@ type AgentWithMediumDao interface { FindAgentWithMediumList(name, state string, agentId, mediumId, page, limit int) (list []AgentWithMediumGroup, total int64, err error) GetAgentWithMediumByMediumIdAndAgentId(mediumId, agentId int) (medium *model.AgentWithMedium) FindAgentWithMediumListByMediumIdAll(mediumId int) (list []model.AgentWithMedium, err error) + FindAgentWithMediumListByAgentIdAll(agentId int) (list []model.AgentWithMedium, err error) } type AgentWithMediumGroup struct { model.AgentWithMedium `xorm:"extends"` diff --git a/src/super/implement/agent_settlement_implement.go b/src/super/implement/agent_settlement_implement.go index dade613..dfb1977 100644 --- a/src/super/implement/agent_settlement_implement.go +++ b/src/super/implement/agent_settlement_implement.go @@ -43,6 +43,18 @@ func (a AgentSettlementDb) AgentSettlementInsertBySession(session *xorm.Session, } return insertAffected, nil } + +func (a AgentSettlementDb) GetAgentSettlementById(id int) (mediumSettlement *model.AgentSettlement, err error) { + mediumSettlement = new(model.AgentSettlement) + has, err := a.Db.Where("id =?", id).Get(mediumSettlement) + if err != nil { + return nil, zhios_order_relate_logx.Error(err) + } + if has == false { + return nil, nil + } + return mediumSettlement, nil +} func (a AgentSettlementDb) FindAgentSettlementList(uuid, agentId, appId, payState, state, startDate, endDate string, page, limit int) (list []model.AgentSettlement, total int64, err error) { sess := a.Db.OrderBy("start_date desc,id desc").Limit(limit, (page-1)*limit) if uuid != "" { diff --git a/src/super/implement/agent_with_medium_db.go b/src/super/implement/agent_with_medium_db.go index 6c4f28f..280052c 100644 --- a/src/super/implement/agent_with_medium_db.go +++ b/src/super/implement/agent_with_medium_db.go @@ -55,3 +55,14 @@ func (a AgentWithMediumDb) FindAgentWithMediumListByMediumIdAll(mediumId int) (l } return } +func (a AgentWithMediumDb) FindAgentWithMediumListByAgentIdAll(agentId int) (list []model.AgentWithMedium, err error) { + sess := a.Db.Desc("id") + if agentId > 0 { + sess.And("agent_id = ?", agentId) + } + err = sess.Find(&list) + if err != nil { + return nil, err + } + return +}