@@ -8,4 +8,6 @@ import ( | |||||
type SuperCloudIssuancePackageOrdDao interface { | type SuperCloudIssuancePackageOrdDao interface { | ||||
GetCloudIssuancePackageOrd(ordNo string) (m *models.SuperCloudIssuancePackageOrd, err error) | GetCloudIssuancePackageOrd(ordNo string) (m *models.SuperCloudIssuancePackageOrd, err error) | ||||
UserOrdList(uid interface{}, req md.BuyPackageRecordsRequest) (resp []*md.BuyPackageRecordsResponse, total int64, 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) | |||||
} | } |
@@ -3,5 +3,6 @@ package dao | |||||
import "code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/models" | import "code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/models" | ||||
type SuperCloudIssuanceRobotPackageDao interface { | type SuperCloudIssuanceRobotPackageDao interface { | ||||
GetCloudIssuanceRobotPackage(id int) (m *models.SuperCloudIssuanceRobotPackage, err error) | |||||
FindSuperCloudIssuanceRobotPackage(params map[string]interface{}) (m []*models.SuperCloudIssuanceRobotPackage, err error) | FindSuperCloudIssuanceRobotPackage(params map[string]interface{}) (m []*models.SuperCloudIssuanceRobotPackage, err error) | ||||
} | } |
@@ -16,6 +16,24 @@ type SuperCloudIssuancePackageOrdDb struct { | |||||
Db *xorm.Engine | 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) { | 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"). | 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"). | Join("INNER", "super_cloud_issuance_package_ord", "super_cloud_issuance_package_ord.package_id = super_cloud_issuance_robot_package.id"). | ||||
@@ -18,6 +18,18 @@ type SuperCloudIssuanceRobotPackageDb struct { | |||||
Db *xorm.Engine | 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) { | func (s SuperCloudIssuanceRobotPackageDb) FindSuperCloudIssuanceRobotPackage(params map[string]interface{}) (m []*models.SuperCloudIssuanceRobotPackage, err error) { | ||||
if params["key"] == nil { | if params["key"] == nil { | ||||
//查询全部数据 | //查询全部数据 | ||||