12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- package data
- import (
- "eta/eta_api/models/data_manage"
- "eta/eta_api/utils"
- "fmt"
- )
- // GetMyChartClassifyIdNumMap 我的图表-获取分类ID及图表数map
- func GetMyChartClassifyIdNumMap(adminId int) (chartsNumMap map[int]int, err error) {
- chartsNumMap = make(map[int]int)
- // 获取当前账号的不可见指标
- chartIds := make([]int, 0)
- obj := data_manage.EdbInfoNoPermissionAdmin{}
- charts, e := obj.GetAllChartListByAdminId(adminId)
- if e != nil && e.Error() != utils.ErrNoRow() {
- err = fmt.Errorf("获取不可见指标配置数据失败, err: %s", e.Error())
- return
- }
- for _, v := range charts {
- chartIds = append(chartIds, v.ChartInfoId)
- }
- cond := ``
- pars := make([]interface{}, 0)
- lenChart := len(chartIds)
- if lenChart > 0 {
- cond += ` AND d.chart_info_id NOT IN (` + utils.GetOrmInReplace(lenChart) + `) `
- pars = append(pars, chartIds)
- }
- // 分类图表数
- chartsNum, e := data_manage.GetMyChartClassifyIdAndNum(cond, pars)
- if e != nil {
- err = fmt.Errorf("获取分类图表数失败, err: %s", e.Error())
- return
- }
- for _, v := range chartsNum {
- chartsNumMap[v.MyChartClassifyId] = v.ChartNum
- }
- return
- }
|