|
|
@@ -7,13 +7,34 @@ import ( |
|
|
|
"xorm.io/xorm" |
|
|
|
) |
|
|
|
|
|
|
|
func NewSuperCloudIssuanceGoodsDb(engine *xorm.Engine) dao.SuperCloudIssuanceGoodsDao { |
|
|
|
return &SuperCloudIssuanceGoodsDb{Db: engine} |
|
|
|
} |
|
|
|
|
|
|
|
type SuperCloudIssuanceGoodsDb struct { |
|
|
|
Db *xorm.Engine |
|
|
|
} |
|
|
|
|
|
|
|
func NewSuperCloudIssuanceGoodsDb(engine *xorm.Engine) dao.SuperCloudIssuanceGoodsDao { |
|
|
|
return &SuperCloudIssuanceGoodsDb{Db: engine} |
|
|
|
func (h SuperCloudIssuanceGoodsDb) DeleteCloudIssuanceGoods(id interface{}) (affected int64, err error) { |
|
|
|
_, err = h.Db.Where("id=?", id).Delete(models.SuperCloudIssuanceGoods{}) |
|
|
|
if err != nil { |
|
|
|
return 0, err |
|
|
|
} |
|
|
|
return 1, nil |
|
|
|
} |
|
|
|
|
|
|
|
func (h SuperCloudIssuanceGoodsDb) GetSuperCloudIssuanceGoodByCategory(categoryId int) (m *models.SuperCloudIssuanceGoods, err error) { |
|
|
|
m = new(models.SuperCloudIssuanceGoods) |
|
|
|
has, err := h.Db.Where("cloud_issuance_category_id = ?", categoryId).OrderBy("id ASC").Get(m) |
|
|
|
if err != nil { |
|
|
|
return nil, zhios_order_relate_logx.Error(err) |
|
|
|
} |
|
|
|
if has == false { |
|
|
|
return nil, nil |
|
|
|
} |
|
|
|
return m, nil |
|
|
|
} |
|
|
|
|
|
|
|
func (h SuperCloudIssuanceGoodsDb) FindSuperCloudIssuanceGoods(id string, cid, start, limit int) (mm *[]models.SuperCloudIssuanceGoods, err error) { |
|
|
|
var m []models.SuperCloudIssuanceGoods |
|
|
|
sess := h.Db.Where("1=1") |
|
|
|