From e7235e2d4d7eb791ac1eedad751aa2f89868a618 Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Thu, 15 Aug 2024 09:38:05 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B4=AD=E7=89=A9=E9=87=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/dao/service_award_return_base_dao.go | 7 ++++ src/dao/service_award_return_flow_dao.go | 8 ++++ src/implement/service_award_return_base_db.go | 28 +++++++++++++ src/implement/service_award_return_flow_db.go | 40 +++++++++++++++++++ src/models/service_award_return_base.go | 13 ++++++ src/models/service_award_return_flow.go | 21 ++++++++++ .../service_award_return_flow_record.go | 19 +++++++++ 7 files changed, 136 insertions(+) create mode 100644 src/dao/service_award_return_base_dao.go create mode 100644 src/dao/service_award_return_flow_dao.go create mode 100644 src/implement/service_award_return_base_db.go create mode 100644 src/implement/service_award_return_flow_db.go create mode 100644 src/models/service_award_return_base.go create mode 100644 src/models/service_award_return_flow.go create mode 100644 src/models/service_award_return_flow_record.go diff --git a/src/dao/service_award_return_base_dao.go b/src/dao/service_award_return_base_dao.go new file mode 100644 index 0000000..73e19b7 --- /dev/null +++ b/src/dao/service_award_return_base_dao.go @@ -0,0 +1,7 @@ +package dao + +import "code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/models" + +type ServiceAwardReturnBaseDao interface { + GetServiceAwardReturnBase() (m *models.ServiceAwardReturnBase, err error) +} diff --git a/src/dao/service_award_return_flow_dao.go b/src/dao/service_award_return_flow_dao.go new file mode 100644 index 0000000..9b97a3f --- /dev/null +++ b/src/dao/service_award_return_flow_dao.go @@ -0,0 +1,8 @@ +package dao + +import "code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/models" + +type ServiceAwardReturnFlowDao interface { + GetServiceAwardReturnFlowTotal(types, createTime string) (sum float64, hasReturnMoney float64, err error) + GetServiceAwardReturnFlowList(types, p, size int, createTime string) (mm *[]models.ServiceAwardReturnFlow, err error) +} diff --git a/src/implement/service_award_return_base_db.go b/src/implement/service_award_return_base_db.go new file mode 100644 index 0000000..93b9c28 --- /dev/null +++ b/src/implement/service_award_return_base_db.go @@ -0,0 +1,28 @@ +package implement + +import ( + "code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/dao" + "code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/models" + zhios_order_relate_logx "code.fnuoos.com/go_rely_warehouse/zyos_model.git/utils/logx" + "xorm.io/xorm" +) + +func NewServiceAwardReturnBaseDb(engine *xorm.Engine) dao.ServiceAwardReturnBaseDao { + return &ServiceAwardReturnBaseDb{Db: engine} +} + +type ServiceAwardReturnBaseDb struct { + Db *xorm.Engine +} + +func (s ServiceAwardReturnBaseDb) GetServiceAwardReturnBase() (m *models.ServiceAwardReturnBase, err error) { + m = new(models.ServiceAwardReturnBase) + has, err := s.Db.Where("1 = 1").Get(m) + if err != nil { + return nil, zhios_order_relate_logx.Error(err) + } + if has == false { + return nil, nil + } + return m, nil +} diff --git a/src/implement/service_award_return_flow_db.go b/src/implement/service_award_return_flow_db.go new file mode 100644 index 0000000..c09ec36 --- /dev/null +++ b/src/implement/service_award_return_flow_db.go @@ -0,0 +1,40 @@ +package implement + +import ( + "code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/dao" + "code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/models" + "xorm.io/xorm" +) + +func NewServiceAwardReturnFlowDb(engine *xorm.Engine) dao.ServiceAwardReturnFlowDao { + return &ServiceAwardReturnFlowDb{Db: engine} +} + +type ServiceAwardReturnFlowDb struct { + Db *xorm.Engine +} + +func (s ServiceAwardReturnFlowDb) GetServiceAwardReturnFlowTotal(types, createTime string) (sum float64, hasReturnMoney float64, err error) { + sess := s.Db.Where("sum-has_return_money>0 and type>?", 0) + if types != "" { + sess.And("type=?", types) + } + if createTime != "" { + sess.And("date0 and type=?", types) + if createTime != "" { + sess.And("date