query.go 977 B

1234567891011121314151617181920212223242526272829303132
  1. package chart_theme
  2. import "hongze/hongze_yb/global"
  3. // GetChartThemeId
  4. // @Description: 根据id获取主题
  5. // @author: Roc
  6. // @datetime 2023-12-14 16:05:36
  7. // @param chartThemeId int
  8. // @return item *ChartTheme
  9. // @return err error
  10. func GetChartThemeId(chartThemeId int) (item *ChartTheme, err error) {
  11. sql := `SELECT * FROM chart_theme where chart_theme_id = ? AND is_delete = 0`
  12. err = global.MYSQL["data"].Raw(sql, chartThemeId).First(&item).Error
  13. return
  14. }
  15. // GetSystemChartTheme
  16. // @Description: 根据图表类型id获取系统配置
  17. // @author: Roc
  18. // @datetime 2023-12-14 14:26:35
  19. // @param chartThemeTypeId int
  20. // @return item *ChartTheme
  21. // @return err error
  22. func GetSystemChartTheme(chartThemeTypeId int) (item *ChartTheme, err error) {
  23. sql := `SELECT a.* FROM chart_theme a
  24. WHERE a.chart_theme_type_id = ? AND a.is_system_theme=1 ORDER BY a.chart_theme_id ASC `
  25. err = global.MYSQL["data"].Raw(sql, chartThemeTypeId).First(&item).Error
  26. return
  27. }