manual.go 1.1 KB

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