entity.go 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. package permission
  2. import (
  3. "git.sxidc.com/go-framework/baize/framework/core/domain"
  4. "git.sxidc.com/go-framework/baize/framework/core/domain/entity"
  5. )
  6. const (
  7. FieldName = "Name"
  8. FieldDescription = "Description"
  9. FieldResource = "Resource"
  10. FieldAction = "Action"
  11. )
  12. var (
  13. ColumnName = domain.ColumnName(FieldName)
  14. ColumnDescription = domain.ColumnName(FieldDescription)
  15. ColumnResource = domain.ColumnName(FieldResource)
  16. ColumnAction = domain.ColumnName(FieldAction)
  17. )
  18. var fieldMap = map[string]string{
  19. FieldName: "权限名称",
  20. FieldDescription: "权限描述",
  21. FieldResource: "resource",
  22. FieldAction: "action",
  23. }
  24. type Entity struct {
  25. entity.Base
  26. Name string `sqlmapping:"column:name" sqlresult:"column:name" check:"required,lte=256,when=create/update"`
  27. Description string `sqlmapping:"column:description;updateClear" sqlresult:"column:description"`
  28. Resource string `sqlmapping:"column:resource" sqlresult:"column:resource" check:"required,when=create/update"`
  29. Action string `sqlmapping:"column:action" sqlresult:"column:action" check:"required,lte=128,when=create/update"`
  30. PermissionGroupIDs []string `sqlmapping:"-" sqlresult:"-"`
  31. RoleIDs []string `sqlmapping:"-" sqlresult:"-"`
  32. entity.UserIDFields
  33. entity.TimeFields
  34. }
  35. func (e *Entity) DomainCNName() string {
  36. return "权限"
  37. }
  38. func (e *Entity) DomainCamelName() string {
  39. return "Permission"
  40. }
  41. func (e *Entity) GetFieldMap() map[string]string {
  42. return fieldMap
  43. }