package chart_tag_variety

import (
	"hongze/hongze_yb/global"
)

// GetChartTagVarietyListByTagAndVariety
// @Description: 根据标签id和品种id列表获取所绑定的品种列表
// @author: Roc
// @datetime 2023-11-23 15:04:20
// @param chartTagId int
// @param varietyIdList []int
// @return items []*ChartTagVariety
// @return err error
func GetChartTagVarietyListByTagAndVariety(chartTagId int, varietyIdList []int) (items []*ChartTagVariety, err error) {
	num := len(varietyIdList)
	if num <= 0 {
		return
	}
	sql := `SELECT * FROM chart_tag_variety WHERE chart_tag_id = ? AND chart_variety_id in (?) `
	err = global.MYSQL["data"].Raw(sql, chartTagId, varietyIdList).Find(&items).Error

	return
}
