manual.go 1.0 KB

12345678910111213141516171819202122232425262728293031323334
  1. package data_manage
  2. import (
  3. "eta_gn/eta_api/global"
  4. )
  5. type ManualSysUser struct {
  6. ItemId int `description:"部门/组/用户 id"`
  7. ItemName string `description:"部门/组/用户 名称"`
  8. Children []*ManualSysUser `gorm:"-"`
  9. }
  10. type ManualClassifyEdbInfoCount struct {
  11. ClassifyId int
  12. Total int
  13. }
  14. func GetManualClassifyEdbInfoCount() (items []*ManualClassifyEdbInfoCount, err error) {
  15. sql := ` SELECT a.classify_id,COUNT(1) AS total FROM edbdata_classify AS a
  16. INNER JOIN edbinfo AS b ON a.classify_id=b.classify_id
  17. WHERE a.is_show=1
  18. GROUP BY a.classify_id `
  19. err = global.DmSQL["edb"].Raw(sql).Find(&items).Error
  20. return
  21. }
  22. // GetManualEdbInfoCountByClassifyId 根据手工指标分类id获取指标数
  23. func GetManualEdbInfoCountByClassifyId(classifyId int) (total int, err error) {
  24. sql := ` SELECT COUNT(1) AS total FROM edbdata_classify AS a
  25. INNER JOIN edbinfo AS b ON a.classify_id=b.classify_id
  26. WHERE a.is_show=1 AND b.classify_id = ?`
  27. err = global.DmSQL["edb"].Raw(sql, classifyId).Scan(&total).Error
  28. return
  29. }