system_role.go 1.0 KB

123456789101112131415161718192021222324252627282930313233
  1. package model
  2. import (
  3. operationPb "kpt-tmr-group/proto/go/backend/operation"
  4. )
  5. type SystemRole struct {
  6. Id int64 `json:"id,omitempty"`
  7. Name string `json:"name,omitempty"`
  8. Remarks string `json:"remarks,omitempty"`
  9. IsShow operationPb.IsShow_Kind `json:"is_show,omitempty"`
  10. PastureId int64 `json:"pasture_id"`
  11. PastureName string `json:"pasture_name"`
  12. CreateUser string `json:"create_user,omitempty"`
  13. CreatedAt int64 `json:"created_at,omitempty"`
  14. UpdatedAt int64 `json:"updated_at,omitempty"`
  15. }
  16. func (s *SystemRole) TableName() string {
  17. return "system_role"
  18. }
  19. func NewSystemRoleList(reqs []*operationPb.AddRoleRequest) []*SystemRole {
  20. systemRoleList := make([]*SystemRole, len(reqs))
  21. for k, role := range reqs {
  22. systemRoleList[k] = &SystemRole{
  23. Name: role.Name,
  24. Remarks: role.Remarks,
  25. IsShow: operationPb.IsShow_OK,
  26. }
  27. }
  28. return systemRoleList
  29. }