department.api 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. import "../base.api"
  2. type (
  3. // The response data of department information | 部门信息
  4. DepartmentInfo {
  5. BaseIDInfo
  6. // Translated Name | 展示名称
  7. Trans string `json:"trans,optional"`
  8. // Status | 状态
  9. Status *uint32 `json:"status,optional" validate:"omitempty,lt=20"`
  10. // Sort | 排序
  11. Sort *uint32 `json:"sort,optional" validate:"omitempty,lt=10000"`
  12. // Name | 部门名称
  13. Name *string `json:"name,optional" validate:"omitempty,min=1,max=50"`
  14. // Ancestors | 父级部门列表
  15. Ancestors *string `json:"ancestors,optional" validate:"omitempty,max=200"`
  16. // Leader | 部门负责人
  17. Leader *string `json:"leader,optional" validate:"omitempty,max=20"`
  18. // Phone | 电话号码
  19. Phone *string `json:"phone,optional" validate:"omitempty,max=18"`
  20. // Email | 邮箱
  21. Email *string `json:"email,optional" validate:"omitempty,min=5,max=70"`
  22. // Remark | 备注
  23. Remark *string `json:"remark,optional" validate:"omitempty,max=200"`
  24. // ParentId | 父级 ID
  25. ParentId *uint64 `json:"parentId,optional"`
  26. }
  27. // The response data of department list | 部门列表数据
  28. DepartmentListResp {
  29. BaseDataInfo
  30. // Department list data | 部门列表数据
  31. Data DepartmentListInfo `json:"data"`
  32. }
  33. // Department list data | 部门列表数据
  34. DepartmentListInfo {
  35. BaseListInfo
  36. // The API list data | 部门列表数据
  37. Data []DepartmentInfo `json:"data"`
  38. }
  39. // Get department list request params | 部门列表请求参数
  40. DepartmentListReq {
  41. PageInfo
  42. // Name | 部门名称
  43. Name *string `json:"name,optional" validate:"omitempty,max=50"`
  44. // Leader | 部门负责人
  45. Leader *string `json:"leader,optional" validate:"omitempty,max=20"`
  46. }
  47. // Department information response | 部门信息返回体
  48. DepartmentInfoResp {
  49. BaseDataInfo
  50. // Department information | 部门数据
  51. Data DepartmentInfo `json:"data"`
  52. }
  53. )
  54. @server(
  55. jwt: Auth
  56. group: department
  57. middleware: Authority
  58. )
  59. service Core {
  60. // Create department information | 创建部门
  61. @handler createDepartment
  62. post /department/create (DepartmentInfo) returns (BaseMsgResp)
  63. // Update department information | 更新部门
  64. @handler updateDepartment
  65. post /department/update (DepartmentInfo) returns (BaseMsgResp)
  66. // Delete department information | 删除部门信息
  67. @handler deleteDepartment
  68. post /department/delete (IDsReq) returns (BaseMsgResp)
  69. // Get department list | 获取部门列表
  70. @handler getDepartmentList
  71. post /department/list (DepartmentListReq) returns (DepartmentListResp)
  72. // Get Department by ID | 通过ID获取部门
  73. @handler getDepartmentById
  74. post /department (IDReq) returns (DepartmentInfoResp)
  75. }