api.js.tpl 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. import service from '@/utils/request'
  2. // @Tags {{.StructName}}
  3. // @Summary 创建{{.StructName}}
  4. // @Security ApiKeyAuth
  5. // @accept application/json
  6. // @Produce application/json
  7. // @Param data body model.{{.StructName}} true "创建{{.StructName}}"
  8. // @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
  9. // @Router /{{.Abbreviation}}/create{{.StructName}} [post]
  10. export const create{{.StructName}} = (data) => {
  11. return service({
  12. url: '/{{.Abbreviation}}/create{{.StructName}}',
  13. method: 'post',
  14. data
  15. })
  16. }
  17. // @Tags {{.StructName}}
  18. // @Summary 删除{{.StructName}}
  19. // @Security ApiKeyAuth
  20. // @accept application/json
  21. // @Produce application/json
  22. // @Param data body model.{{.StructName}} true "删除{{.StructName}}"
  23. // @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}"
  24. // @Router /{{.Abbreviation}}/delete{{.StructName}} [delete]
  25. export const delete{{.StructName}} = (data) => {
  26. return service({
  27. url: '/{{.Abbreviation}}/delete{{.StructName}}',
  28. method: 'delete',
  29. data
  30. })
  31. }
  32. // @Tags {{.StructName}}
  33. // @Summary 删除{{.StructName}}
  34. // @Security ApiKeyAuth
  35. // @accept application/json
  36. // @Produce application/json
  37. // @Param data body request.IdsReq true "批量删除{{.StructName}}"
  38. // @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}"
  39. // @Router /{{.Abbreviation}}/delete{{.StructName}} [delete]
  40. export const delete{{.StructName}}ByIds = (data) => {
  41. return service({
  42. url: '/{{.Abbreviation}}/delete{{.StructName}}ByIds',
  43. method: 'delete',
  44. data
  45. })
  46. }
  47. // @Tags {{.StructName}}
  48. // @Summary 更新{{.StructName}}
  49. // @Security ApiKeyAuth
  50. // @accept application/json
  51. // @Produce application/json
  52. // @Param data body model.{{.StructName}} true "更新{{.StructName}}"
  53. // @Success 200 {string} string "{"success":true,"data":{},"msg":"更新成功"}"
  54. // @Router /{{.Abbreviation}}/update{{.StructName}} [put]
  55. export const update{{.StructName}} = (data) => {
  56. return service({
  57. url: '/{{.Abbreviation}}/update{{.StructName}}',
  58. method: 'put',
  59. data
  60. })
  61. }
  62. // @Tags {{.StructName}}
  63. // @Summary 用id查询{{.StructName}}
  64. // @Security ApiKeyAuth
  65. // @accept application/json
  66. // @Produce application/json
  67. // @Param data query model.{{.StructName}} true "用id查询{{.StructName}}"
  68. // @Success 200 {string} string "{"success":true,"data":{},"msg":"查询成功"}"
  69. // @Router /{{.Abbreviation}}/find{{.StructName}} [get]
  70. export const find{{.StructName}} = (params) => {
  71. return service({
  72. url: '/{{.Abbreviation}}/find{{.StructName}}',
  73. method: 'get',
  74. params
  75. })
  76. }
  77. // @Tags {{.StructName}}
  78. // @Summary 分页获取{{.StructName}}列表
  79. // @Security ApiKeyAuth
  80. // @accept application/json
  81. // @Produce application/json
  82. // @Param data query request.PageInfo true "分页获取{{.StructName}}列表"
  83. // @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
  84. // @Router /{{.Abbreviation}}/get{{.StructName}}List [get]
  85. export const get{{.StructName}}List = (params) => {
  86. return service({
  87. url: '/{{.Abbreviation}}/get{{.StructName}}List',
  88. method: 'get',
  89. params
  90. })
  91. }