package chart_theme

import "hongze/hongze_yb/global"

// GetChartThemeId
// @Description: 根据id获取主题
// @author: Roc
// @datetime 2023-12-14 16:05:36
// @param chartThemeId int
// @return item *ChartTheme
// @return err error
func GetChartThemeId(chartThemeId int) (item *ChartTheme, err error) {
	sql := `SELECT * FROM chart_theme where chart_theme_id = ? AND is_delete = 0`
	err = global.MYSQL["data"].Raw(sql, chartThemeId).First(&item).Error

	return
}

// GetSystemChartTheme
// @Description: 根据图表类型id获取系统配置
// @author: Roc
// @datetime 2023-12-14 14:26:35
// @param chartThemeTypeId int
// @return item *ChartTheme
// @return err error
func GetSystemChartTheme(chartThemeTypeId int) (item *ChartTheme, err error) {
	sql := `SELECT a.* FROM chart_theme a
         WHERE a.chart_theme_type_id = ? AND a.is_system_theme=1 ORDER BY a.chart_theme_id ASC `
	err = global.MYSQL["data"].Raw(sql, chartThemeTypeId).First(&item).Error

	return
}
