authority.go 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. package model
  2. import (
  3. "go-common/library/time"
  4. )
  5. // SUser simple user
  6. type SUser struct {
  7. ID int64 `json:"id"`
  8. Name string `json:"name"`
  9. }
  10. // Group simple task group
  11. type Group struct {
  12. ID int64 `json:"id"`
  13. Name string `json:"name"`
  14. }
  15. // Role simple task role
  16. type Role struct {
  17. ID int64 `json:"id"`
  18. Name string `json:"name"`
  19. }
  20. // SPrivilege simple privilege
  21. type SPrivilege struct {
  22. ID int64 `json:"id" gorm:"column:id"`
  23. Title string `json:"title" gorm:"column:name"`
  24. Level int64 `json:"level" gorm:"level"`
  25. IsRouter uint8 `json:"is_router" gorm:"is_router"`
  26. Children []*SPrivilege `json:"children"`
  27. Selected bool `json:"selected"`
  28. }
  29. // User user info
  30. type User struct {
  31. ID int64 `json:"id" gorm:"column:id"`
  32. Username string `json:"username" gorm:"column:username"`
  33. Nickname string `json:"nickname" gorm:"column:nickname"`
  34. TaskGroup string `json:"task_group" gorm:"column:task_group"`
  35. TaskRole string `json:"task_role" gorm:"column:task_role"`
  36. ATime time.Time `json:"atime" gorm:"column:atime"`
  37. CTime time.Time `json:"ctime" gorm:"column:ctime"`
  38. MTime time.Time `json:"mtime" gorm:"column:mtime"`
  39. IsDeleted int `json:"-"`
  40. Groups []*Group `json:"groups" gorm:"-"`
  41. Roles []*Role `json:"roles" gorm:"-"`
  42. }
  43. // TaskGroup task group
  44. type TaskGroup struct {
  45. ID int64 `json:"id" gorm:"column:id"`
  46. Name string `json:"name" gorm:"column:name"`
  47. Desc string `json:"desc" gorm:"column:desc"`
  48. Privileges string `json:"privileges" gorm:"column:privileges"`
  49. ATime time.Time `json:"atime" gorm:"column:atime"`
  50. CTime time.Time `json:"ctime" gorm:"column:ctime"`
  51. MTime time.Time `json:"mtime" gorm:"column:mtime"`
  52. IsDeleted int `json:"-"`
  53. Users []*SUser `json:"users" gorm:"-"`
  54. }
  55. // TaskRole task role
  56. type TaskRole struct {
  57. ID int64 `json:"id" gorm:"column:id"`
  58. Name string `json:"name" gorm:"column:name"`
  59. Desc string `json:"desc" gorm:"column:desc"`
  60. GroupID int64 `json:"group_id" gorm:"column:group_id"`
  61. Privileges string `json:"privileges" gorm:"column:privileges"`
  62. ATime time.Time `json:"atime" gorm:"column:atime"`
  63. CTime time.Time `json:"ctime" gorm:"column:ctime"`
  64. MTime time.Time `json:"mtime" gorm:"column:mtime"`
  65. IsDeleted int `json:"-"`
  66. Users []*SUser `json:"users" gorm:"-"`
  67. GroupName string `json:"group_name" gorm:"-"`
  68. }
  69. // Privilege privilege
  70. type Privilege struct {
  71. ID int64 `json:"id" gorm:"column:id"`
  72. Name string `json:"name" gorm:"column:name"`
  73. Level int64 `json:"level" gorm:"level"`
  74. FatherID int64 `json:"father_id" gorm:"father_id"`
  75. IsRouter uint8 `json:"is_router" gorm:"is_router"`
  76. CTime time.Time `json:"ctime" gorm:"column:ctime"`
  77. MTime time.Time `json:"mtime" gorm:"column:mtime"`
  78. IsDeleted int `json:"-"`
  79. }