business.go 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. package model
  2. import xtime "go-common/library/time"
  3. const (
  4. // BusinessOpenState .
  5. BusinessOpenState = 1
  6. // BusinessOpenType .
  7. BusinessOpenType = 1
  8. // UserRoleDefaultVal .
  9. UserRoleDefaultVal = -1
  10. // UserOnState .
  11. UserOnState = 1
  12. // UserOffState .
  13. UserOffState = 0
  14. )
  15. // Business .
  16. type Business struct {
  17. ID int64 `json:"id" gorm:"primary_key" form:"id"`
  18. PID int64 `json:"pid" gorm:"column:pid" form:"pid"`
  19. BID int64 `json:"bid" gorm:"column:bid" form:"bid"`
  20. Name string `json:"name" gorm:"column:name" form:"name"`
  21. Names []string `json:"names" gorm:"-" form:"names,split"`
  22. Flow int64 `json:"flow" gorm:"column:flow" form:"flow" default:"0"`
  23. FlowState int64 `json:"flow_state" gorm:"column:flow_state" form:"flow_state"`
  24. State int64 `json:"state" gorm:"column:state" form:"state" default:"1"`
  25. Ctime xtime.Time `json:"ctime" gorm:"-"`
  26. Mtime xtime.Time `json:"mtime" gorm:"-"`
  27. }
  28. // BusinessList .
  29. type BusinessList struct {
  30. ID int64 `json:"id" gorm:"primary_key"`
  31. PID int64 `json:"pid" gorm:"column:pid"`
  32. BID int64 `json:"bid" gorm:"column:bid"`
  33. Name string `json:"name" gorm:"column:name"`
  34. Flow int64 `json:"flow" gorm:"column:flow"`
  35. FlowState int64 `json:"flow_state" gorm:"column:flow_state"`
  36. State int64 `json:"state" gorm:"column:state"`
  37. Ctime xtime.Time `json:"ctime" gorm:"-"`
  38. Mtime xtime.Time `json:"mtime" gorm:"-"`
  39. FlowChild []*FlowBusiness `json:"flowchild" gorm:"-"`
  40. }
  41. // TableName .
  42. func (bl *BusinessList) TableName() string {
  43. return "manager_business"
  44. }
  45. // FlowBusiness .
  46. type FlowBusiness struct {
  47. FlowState int64 `json:"flow_state"`
  48. Child []*BusinessList `json:"child"`
  49. }
  50. // BusinessRole .
  51. type BusinessRole struct {
  52. ID int64 `json:"id" gorm:"primary_key" form:"id"`
  53. BID int64 `json:"bid" gorm:"column:bid" form:"bid"`
  54. RID int64 `json:"rid" gorm:"column:rid" form:"rid"`
  55. Name string `json:"name" gorm:"column:name" form:"name"`
  56. Type int64 `json:"type" gorm:"column:type" form:"type" default:"-1"`
  57. State int64 `json:"state" gorm:"column:state" form:"state" default:"1"`
  58. Ctime xtime.Time `json:"ctime" gorm:"column:ctime"`
  59. Mtime xtime.Time `json:"mtime" gorm:"column:mtime"`
  60. Auth int64 `json:"auth" gorm:"-" form:"auth"`
  61. UID int64 `json:"uid" gorm:"-"`
  62. }
  63. // TableName .
  64. func (br *BusinessRole) TableName() string {
  65. return "manager_business_role"
  66. }
  67. // BusinessUserRole .
  68. type BusinessUserRole struct {
  69. ID int64 `json:"id" gorm:"primary_key" form:"id"`
  70. UID int64 `json:"uid" gorm:"column:uid" form:"uid"`
  71. UIDs []int64 `json:"uids" gorm:"-" form:"uids,split"`
  72. CUID int64 `json:"cuid" gorm:"column:cuid" form:"cuid"`
  73. BID int64 `json:"bid" gorm:"column:bid" form:"bid"`
  74. Role string `json:"role" gorm:"column:role" form:"role"`
  75. Ctime xtime.Time `json:"ctime" gorm:"-"`
  76. Mtime xtime.Time `json:"mtime" gorm:"-"`
  77. }
  78. // BusinessUserRoleList .
  79. type BusinessUserRoleList struct {
  80. ID int64 `json:"id" gorm:"primary_key"`
  81. UID int64 `json:"uid" gorm:"column:uid" form:"uid"`
  82. UName string `json:"uname" gorm:"-"`
  83. UNickname string `json:"unickname" gorm:"-"`
  84. CUID int64 `json:"cuid" gorm:"column:cuid" form:"cuid"`
  85. CUName string `json:"cuname" gorm:"-"`
  86. BID int64 `json:"bid" gorm:"column:bid" form:"bid"`
  87. Role string `json:"role" gorm:"column:role" form:"role"`
  88. RoleName []string `json:"rolename" gorm:"-"`
  89. Ctime xtime.Time `json:"ctime" gorm:"-"`
  90. Mtime xtime.Time `json:"mtime" gorm:"-"`
  91. }
  92. // StateUpdate .
  93. type StateUpdate struct {
  94. ID int64 `json:"id" form:"id" validate:"required"`
  95. Type int64 `json:"type" form:"type" validate:"required"` // 1:业务 2:角色
  96. State int64 `json:"state" form:"state"`
  97. }
  98. // UserListParams .
  99. type UserListParams struct {
  100. BID int64 `form:"bid" validate:"required"`
  101. Role int64 `form:"role" default:"-1"`
  102. UName string `form:"uname"`
  103. UID int64 `form:"uid"`
  104. PS int64 `form:"ps" default:"50"`
  105. PN int64 `form:"pn" default:"1"`
  106. }
  107. // UserRole .
  108. type UserRole struct {
  109. ID int64 `json:"id"`
  110. BID int64 `json:"bid"`
  111. RID int64 `json:"rid"`
  112. Type int64 `json:"type"`
  113. Name string `json:"name"`
  114. }
  115. // BusinessListParams .
  116. type BusinessListParams struct {
  117. State int64 `json:"state" form:"state" default:"-1"`
  118. Check int64 `json:"check" form:"check" default:"0"`
  119. Flow int64 `json:"flow" form:"flow"`
  120. UID int64 `json:"uid"`
  121. Auth int64 `json:"auth" form:"auth"`
  122. }
  123. // UserStateUp .
  124. type UserStateUp struct {
  125. BID int64 `json:"bid" form:"bid" validate:"required"`
  126. AdminID int64 `json:"adminid" form:"adminid" validate:"required"`
  127. State int `json:"state" form:"state" validate:"state"`
  128. }