my_chart.go 1018 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. package data
  2. import (
  3. "eta_gn/eta_api/models/data_manage"
  4. "eta_gn/eta_api/utils"
  5. "fmt"
  6. )
  7. func GetMyChartClassifyIdNumMap(adminId int) (chartsNumMap map[int]int, err error) {
  8. chartsNumMap = make(map[int]int)
  9. chartIds := make([]int, 0)
  10. obj := data_manage.EdbInfoNoPermissionAdmin{}
  11. charts, e := obj.GetAllChartListByAdminId(adminId)
  12. if e != nil && !utils.IsErrNoRow(e) {
  13. err = fmt.Errorf("获取不可见指标配置数据失败, err: %s", e.Error())
  14. return
  15. }
  16. for _, v := range charts {
  17. chartIds = append(chartIds, v.ChartInfoId)
  18. }
  19. cond := ``
  20. pars := make([]interface{}, 0)
  21. lenChart := len(chartIds)
  22. if lenChart > 0 {
  23. cond += ` AND d.chart_info_id NOT IN (` + utils.GetOrmInReplace(lenChart) + `) `
  24. pars = append(pars, chartIds)
  25. }
  26. chartsNum, e := data_manage.GetMyChartClassifyIdAndNum(cond, pars)
  27. if e != nil {
  28. err = fmt.Errorf("获取分类图表数失败, err: %s", e.Error())
  29. return
  30. }
  31. for _, v := range chartsNum {
  32. chartsNumMap[v.MyChartClassifyId] = v.ChartNum
  33. }
  34. return
  35. }