package yb_price_driven

import "hongze/hongze_yb/global"

// GetPriceDrivenByVarietyTagId 通过标签获取价格驱动
func GetPriceDrivenByVarietyTagId(varietyTagId int) (item *YbPriceDriven, err error) {
	err = global.DEFAULT_MYSQL.
		Where("variety_tag_id = ? AND publish_state = 1", varietyTagId).
		Order("create_time DESC").
		First(&item).Error
	return
}

// GetPriceDrivenById 主键获取价格驱动
func GetPriceDrivenById(priceDrivenId int) (item *YbPriceDriven, err error) {
	err = global.DEFAULT_MYSQL.
		Where("price_driven_id = ? AND publish_state = 1", priceDrivenId).
		First(&item).Error
	return
}