dictionary.api 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. import "../base.api"
  2. type (
  3. // The response data of dictionary information | 字典信息
  4. DictionaryInfo {
  5. BaseIDInfo
  6. // Translated Name | 字典多语言名称
  7. Trans string `json:"trans,optional"`
  8. // Title | 字典多语言名称
  9. Title *string `json:"title,optional" validate:"omitempty,min=1,max=50"`
  10. // Name | 字典名称
  11. Name *string `json:"name,optional" validate:"omitempty,min=1,max=50"`
  12. // Status | 状态
  13. Status *uint32 `json:"status,optional" validate:"omitempty,lt=20"`
  14. // Description of dictionary | 字典描述
  15. Desc *string `json:"desc,optional" validate:"omitempty,max=200"`
  16. }
  17. // The response data of dictionary list | 字典列表数据
  18. DictionaryListResp {
  19. BaseDataInfo
  20. // Dictionary list data | 字典列表数据
  21. Data DictionaryListInfo `json:"data"`
  22. }
  23. // Dictionary list data | 字典列表数据
  24. DictionaryListInfo {
  25. BaseListInfo
  26. // The API list data | 字典列表数据
  27. Data []DictionaryInfo `json:"data"`
  28. }
  29. // Get dictionary list request params | 字典列表请求参数
  30. DictionaryListReq {
  31. PageInfo
  32. // Name | 字典名称
  33. Name *string `json:"name,optional" validate:"omitempty,max=50"`
  34. }
  35. // Dictionary information response | 字典信息返回体
  36. DictionaryInfoResp {
  37. BaseDataInfo
  38. // Dictionary information | 字典数据
  39. Data DictionaryInfo `json:"data"`
  40. }
  41. )
  42. @server(
  43. jwt: Auth
  44. group: dictionary
  45. middleware: Authority
  46. )
  47. service Core {
  48. // Create dictionary information | 创建字典
  49. @handler createDictionary
  50. post /dictionary/create (DictionaryInfo) returns (BaseMsgResp)
  51. // Update dictionary information | 更新字典
  52. @handler updateDictionary
  53. post /dictionary/update (DictionaryInfo) returns (BaseMsgResp)
  54. // Delete dictionary information | 删除字典信息
  55. @handler deleteDictionary
  56. post /dictionary/delete (IDsReq) returns (BaseMsgResp)
  57. // Get dictionary list | 获取字典列表
  58. @handler getDictionaryList
  59. post /dictionary/list (DictionaryListReq) returns (DictionaryListResp)
  60. // Get Dictionary by ID | 通过ID获取字典
  61. @handler getDictionaryById
  62. post /dictionary (IDReq) returns (DictionaryInfoResp)
  63. }