From b55cad114a671020fb1a3ce622848476c0dd385c Mon Sep 17 00:00:00 2001 From: dengbiao Date: Wed, 26 Jun 2024 12:07:38 +0800 Subject: [PATCH] update --- .../super_cloud_issuance_package_ord_dao.go | 2 ++ .../super_cloud_issuance_robot_package_dao.go | 1 + .../super_cloud_issuance_package_ord_db.go | 18 ++++++++++++++++++ .../super_cloud_issuance_robot_package_db.go | 12 ++++++++++++ 4 files changed, 33 insertions(+) diff --git a/src/dao/super_cloud_issuance_package_ord_dao.go b/src/dao/super_cloud_issuance_package_ord_dao.go index 4040857..72e80ed 100644 --- a/src/dao/super_cloud_issuance_package_ord_dao.go +++ b/src/dao/super_cloud_issuance_package_ord_dao.go @@ -8,4 +8,6 @@ import ( type SuperCloudIssuancePackageOrdDao interface { GetCloudIssuancePackageOrd(ordNo string) (m *models.SuperCloudIssuancePackageOrd, err error) UserOrdList(uid interface{}, req md.BuyPackageRecordsRequest) (resp []*md.BuyPackageRecordsResponse, total int64, err error) + SaveCloudIssuancePackageOrd(id interface{}, m *models.SuperCloudIssuancePackageOrd, forceColums ...string) (affected int64, err error) + InsertSuperCloudIssuancePackageOrd(m *models.SuperCloudIssuancePackageOrd) (id int64, err error) } diff --git a/src/dao/super_cloud_issuance_robot_package_dao.go b/src/dao/super_cloud_issuance_robot_package_dao.go index b3619a4..14b02fd 100644 --- a/src/dao/super_cloud_issuance_robot_package_dao.go +++ b/src/dao/super_cloud_issuance_robot_package_dao.go @@ -3,5 +3,6 @@ package dao import "code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/models" type SuperCloudIssuanceRobotPackageDao interface { + GetCloudIssuanceRobotPackage(id int) (m *models.SuperCloudIssuanceRobotPackage, err error) FindSuperCloudIssuanceRobotPackage(params map[string]interface{}) (m []*models.SuperCloudIssuanceRobotPackage, err error) } diff --git a/src/implement/super_cloud_issuance_package_ord_db.go b/src/implement/super_cloud_issuance_package_ord_db.go index d02cdb2..b3c75c4 100644 --- a/src/implement/super_cloud_issuance_package_ord_db.go +++ b/src/implement/super_cloud_issuance_package_ord_db.go @@ -16,6 +16,24 @@ type SuperCloudIssuancePackageOrdDb struct { Db *xorm.Engine } +func (s SuperCloudIssuancePackageOrdDb) InsertSuperCloudIssuancePackageOrd(m *models.SuperCloudIssuancePackageOrd) (id int64, err error) { + _, err = s.Db.InsertOne(m) + if err != nil { + return 0, err + } + id = m.Id + return id, nil +} + +func (s SuperCloudIssuancePackageOrdDb) SaveCloudIssuancePackageOrd(id interface{}, m *models.SuperCloudIssuancePackageOrd, forceColums ...string) (affected int64, err error) { + if forceColums != nil { + affected, err = s.Db.Where("id=?", id).Cols(forceColums...).Update(m) + } else { + affected, err = s.Db.Where("id=?", id).Update(m) + } + return +} + func (s SuperCloudIssuancePackageOrdDb) UserOrdList(uid interface{}, req md.BuyPackageRecordsRequest) (resp []*md.BuyPackageRecordsResponse, total int64, err error) { total, err = s.Db.Table("super_cloud_issuance_package_ord"). Join("INNER", "super_cloud_issuance_package_ord", "super_cloud_issuance_package_ord.package_id = super_cloud_issuance_robot_package.id"). diff --git a/src/implement/super_cloud_issuance_robot_package_db.go b/src/implement/super_cloud_issuance_robot_package_db.go index 00e7c92..ba18efa 100644 --- a/src/implement/super_cloud_issuance_robot_package_db.go +++ b/src/implement/super_cloud_issuance_robot_package_db.go @@ -18,6 +18,18 @@ type SuperCloudIssuanceRobotPackageDb struct { Db *xorm.Engine } +func (s SuperCloudIssuanceRobotPackageDb) GetCloudIssuanceRobotPackage(id int) (m *models.SuperCloudIssuanceRobotPackage, err error) { + m = new(models.SuperCloudIssuanceRobotPackage) + has, err := s.Db.Where("id = ?", id).Get(m) + if err != nil { + return nil, zhios_order_relate_logx.Error(err) + } + if has == false { + return nil, nil + } + return m, nil +} + func (s SuperCloudIssuanceRobotPackageDb) FindSuperCloudIssuanceRobotPackage(params map[string]interface{}) (m []*models.SuperCloudIssuanceRobotPackage, err error) { if params["key"] == nil { //查询全部数据