system_group_pasture_permissions.go 992 B

12345678910111213141516171819202122232425262728
  1. package model
  2. import operationPb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/operation"
  3. type SystemGroupPasturePermissions struct {
  4. Id int64 `json:"id,omitempty"`
  5. RoleId int64 `json:"role_id"`
  6. PastureId int64 `json:"pasture_id"`
  7. IsShow operationPb.IsShow_Kind `json:"is_show"`
  8. CreatedAt int64 `json:"created_at"`
  9. UpdatedAt int64 `json:"updated_at"`
  10. }
  11. func (s *SystemGroupPasturePermissions) TableName() string {
  12. return "system_group_pasture_permissions"
  13. }
  14. func NewSystemGroupPasturePermissions(roleID int64, pastureIds []uint32) []*SystemGroupPasturePermissions {
  15. systemPasturePermissions := make([]*SystemGroupPasturePermissions, len(pastureIds))
  16. for i, v := range pastureIds {
  17. systemPasturePermissions[i] = &SystemGroupPasturePermissions{
  18. RoleId: roleID,
  19. PastureId: int64(v),
  20. IsShow: operationPb.IsShow_OK,
  21. }
  22. }
  23. return systemPasturePermissions
  24. }