sys_org.go 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. package dto
  2. import (
  3. "IotAdmin/app/system/models"
  4. common "IotAdmin/common/models"
  5. )
  6. // SysOrgGetPageReq 列表或者搜索使用结构体
  7. type SysOrgGetPageReq struct {
  8. OrgId int `form:"orgId" search:"-" comment:"id"` //id
  9. ParentId int `form:"parentId" search:"type:exact;column:parent_id;table:sys_org" comment:"上级组织机构"` //上级组织机构
  10. OrgPath string `form:"orgPath" search:"type:exact;column:org_path;table:sys_org" comment:""` //路径
  11. OrgName string `form:"orgName" search:"type:exact;column:org_name;table:sys_org" comment:"组织机构名称"` //组织机构名称
  12. Sort int `form:"sort" search:"type:exact;column:sort;table:sys_org" comment:"排序"` //排序
  13. Leader string `form:"leader" search:"type:exact;column:leader;table:sys_org" comment:"负责人"` //负责人
  14. Phone string `form:"phone" search:"type:exact;column:phone;table:sys_org" comment:"手机"` //手机
  15. Email string `form:"email" search:"type:exact;column:email;table:sys_org" comment:"邮箱"` //邮箱
  16. Status string `form:"status" search:"type:exact;column:status;table:sys_org" comment:"状态"` //状态
  17. }
  18. func (m *SysOrgGetPageReq) GetNeedSearch() interface{} {
  19. return *m
  20. }
  21. type SysOrgInsertReq struct {
  22. OrgId int `uri:"id" comment:"编码"` // 编码
  23. ParentId int `json:"parentId" comment:"上级组织机构" vd:"?"` //上级组织机构
  24. OrgPath string `json:"orgPath" comment:""` //路径
  25. OrgName string `json:"orgName" comment:"组织机构名称" vd:"len($)>0"` //组织机构名称
  26. Sort int `json:"sort" comment:"排序" vd:"?"` //排序
  27. //Leader string `json:"leader" comment:"负责人" vd:"@:len($)>0; msg:'leader不能为空'"` //负责人
  28. Leader string `json:"leader" comment:"负责人" vd:"?"` //负责人
  29. Phone string `json:"phone" comment:"手机" vd:"?"` //手机
  30. Email string `json:"email" comment:"邮箱" vd:"?"` //邮箱
  31. Status int `json:"status" comment:"状态" vd:"$>0"` //状态
  32. common.ControlBy
  33. }
  34. func (s *SysOrgInsertReq) Generate(model *models.SysOrg) {
  35. if s.OrgId != 0 {
  36. model.OrgId = s.OrgId
  37. }
  38. model.OrgName = s.OrgName
  39. model.ParentId = s.ParentId
  40. model.OrgPath = s.OrgPath
  41. model.Sort = s.Sort
  42. model.Leader = s.Leader
  43. model.Phone = s.Phone
  44. model.Email = s.Email
  45. model.Status = s.Status
  46. model.CreateBy = s.CreateBy
  47. }
  48. // GetId 获取数据对应的ID
  49. func (s *SysOrgInsertReq) GetId() interface{} {
  50. return s.OrgId
  51. }
  52. type SysOrgUpdateReq struct {
  53. OrgId int `uri:"id" comment:"编码"` // 编码
  54. ParentId int `json:"parentId" comment:"上级组织机构" vd:"?"` //上级组织机构
  55. OrgPath string `json:"orgPath" comment:""` //路径
  56. OrgName string `json:"orgName" comment:"组织机构名称" vd:"len($)>0"` //组织机构名称
  57. Sort int `json:"sort" comment:"排序" vd:"?"` //排序
  58. //Leader string `json:"leader" comment:"负责人" vd:"@:len($)>0; msg:'leader不能为空'"` //负责人
  59. Leader string `json:"leader" comment:"负责人" vd:"?"` //负责人
  60. Phone string `json:"phone" comment:"手机" vd:"?"` //手机
  61. Email string `json:"email" comment:"邮箱" vd:"?"` //邮箱
  62. Status int `json:"status" comment:"状态" vd:"$>0"` //状态
  63. common.ControlBy
  64. }
  65. // Generate 结构体数据转化 从 SysOrgControl 至 Org 对应的模型
  66. func (s *SysOrgUpdateReq) Generate(model *models.SysOrg) {
  67. if s.OrgId != 0 {
  68. model.OrgId = s.OrgId
  69. }
  70. model.OrgName = s.OrgName
  71. model.ParentId = s.ParentId
  72. model.OrgPath = s.OrgPath
  73. model.Sort = s.Sort
  74. model.Leader = s.Leader
  75. model.Phone = s.Phone
  76. model.Email = s.Email
  77. model.Status = s.Status
  78. model.UpdateBy = s.UpdateBy
  79. }
  80. // GetId 获取数据对应的ID
  81. func (s *SysOrgUpdateReq) GetId() interface{} {
  82. return s.OrgId
  83. }
  84. type SysOrgGetReq struct {
  85. Id int `uri:"id"`
  86. }
  87. func (s *SysOrgGetReq) GetId() interface{} {
  88. return s.Id
  89. }
  90. type SysOrgDeleteReq struct {
  91. Ids []int `json:"ids"`
  92. }
  93. func (s *SysOrgDeleteReq) GetId() interface{} {
  94. return s.Ids
  95. }
  96. type OrgLabel struct {
  97. Id int `gorm:"-" json:"id"`
  98. Label string `gorm:"-" json:"label"`
  99. Children []OrgLabel `gorm:"-" json:"children"`
  100. }