package multiple_graph_config_chart_mapping

import (
	"hongze/hongze_yb/global"
)

// GetMultipleGraphConfigChartMappingByChartId 根据图表id和来源获取关联关系
func GetMultipleGraphConfigChartMappingByChartId(chartId int) (item *MultipleGraphConfigChartMapping, err error) {
	err = global.MYSQL["data"].Model(MultipleGraphConfigChartMapping{}).Where("chart_info_id = ?", chartId).First(&item).Error

	return
}

// GetMultipleGraphConfigChartMappingByIdAndSource 根据配置id和来源获取关联关系
func GetMultipleGraphConfigChartMappingByIdAndSource(configId, source int) (item *MultipleGraphConfigChartMapping, err error) {
	err = global.MYSQL["data"].Model(MultipleGraphConfigChartMapping{}).Where("multiple_graph_config_id = ? AND source = ?", configId, source).First(&item).Error

	return
}