rbac_node.go 790 B

12345678910111213141516171819202122232425262728293031323334
  1. package dbmodel
  2. import (
  3. "encoding/json"
  4. "github.com/astaxie/beego/orm"
  5. )
  6. type TGdAdminRbacNode struct {
  7. Id int `json:"id"`
  8. Name string `json:"name"`
  9. Router string `json:"router"`
  10. Method string `json:"method"`
  11. Resource string `json:"resource"`
  12. Object string `json:"object"`
  13. Pid int `json:"pid"`
  14. }
  15. func (p *TGdAdminRbacNode) TableName() string {
  16. return "t_gd_admin_rbac_node"
  17. }
  18. func (p TGdAdminRbacNode) String() string {
  19. vals, _ := json.Marshal(p)
  20. return string(vals)
  21. }
  22. func (p *TGdAdminRbacNode) FetchAll(db orm.Ormer, mapFilter map[string]interface{}, cols []string) (lists []TGdAdminRbacNode, err error) {
  23. qa := db.QueryTable(p.TableName())
  24. for k, v := range mapFilter {
  25. qa = qa.Filter(k, v)
  26. }
  27. _, err = qa.All(&lists, cols...)
  28. return
  29. }