Api.ts.btl 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. import { defHttp } from '/@/utils/http/axios';
  2. import { setParams } from '/@/utils/index';
  3. enum Api {
  4. ${frontModuleName}${busNameFirstUpper}QueryPage = '${pathPrefix}/query/page',
  5. ${frontModuleName}${busNameFirstUpper}Detail = '${pathPrefix}/detail',
  6. ${frontModuleName}${busNameFirstUpper}Add = '${pathPrefix}/add',
  7. ${frontModuleName}${busNameFirstUpper}Edit = '${pathPrefix}/edit',
  8. ${frontModuleName}${busNameFirstUpper}Remove = '${pathPrefix}/removeByIds',
  9. }
  10. /**
  11. *
  12. * @author ${authorName}
  13. * @date ${genTime}
  14. * @description: 根据条件查询${functionName}列表,权限 - ${backendModuleName}:${busName}:query
  15. * @method: POST
  16. * @param:
  17. <% for(var i = 0; i < configList.~size; i++) { %>
  18. <% if(configList[i].queryWhether!=null && configList[i].queryWhether ) { %>
  19. * {${configList[i].fieldJavaType}} ${configList[i].fieldNameCamelCase} ${configList[i].queryType} ${configList[i].fieldRemark}
  20. <% } %>
  21. <% } %>
  22. * @return:
  23. <% for(var i = 0; i < configList.~size; i++) { %>
  24. <% if(configList[i].fieldNameCamelCase!= "createTime" && configList[i].fieldNameCamelCase != "createBy" && configList[i].fieldNameCamelCase != "updateTime" &&configList[i].fieldNameCamelCase != "updateBy" && configList[i].fieldNameCamelCase != "tenantId" && configList[i].fieldNameCamelCase!= "deleted" && configList[i].whetherTable) {%>
  25. * {${configList[i].fieldJavaType}} ${configList[i].fieldNameCamelCase} ${configList[i].fieldRemark}
  26. <% } %>
  27. <% } %>
  28. */
  29. export const ${frontModuleName}${busNameFirstUpper}QueryPage = (params?: object) => {
  30. return defHttp.post({ url: Api.${frontModuleName}${busNameFirstUpper}QueryPage, params: setParams(params) });
  31. };
  32. /**
  33. *
  34. * @author ${authorName}
  35. * @date ${genTime}
  36. * @description: 根据id查询${functionName}详细信息,权限 - ${backendModuleName}:${busName}:query
  37. * @method: GET
  38. * @param: id ${functionName}主键id
  39. * @return:
  40. <% for(var i = 0; i < configList.~size; i++) { %>
  41. <% if(configList[i].fieldNameCamelCase!= "createTime" && configList[i].fieldNameCamelCase != "createBy" && configList[i].fieldNameCamelCase != "updateTime" &&configList[i].fieldNameCamelCase != "updateBy" && configList[i].fieldNameCamelCase != "tenantId" && configList[i].fieldNameCamelCase!= "deleted" && configList[i].whetherTable) {%>
  42. * {${configList[i].fieldJavaType}} ${configList[i].fieldNameCamelCase} ${configList[i].fieldRemark}
  43. <% } %>
  44. <% } %>
  45. */
  46. export const ${frontModuleName}${busNameFirstUpper}Detail = (id: string) => {
  47. return defHttp.get({ url: Api.${frontModuleName}${busNameFirstUpper}Detail + '/' + id });
  48. };
  49. /**
  50. *
  51. * @author ${authorName}
  52. * @date ${genTime}
  53. * @description: 添加${functionName},权限 - ${backendModuleName}:${busName}:add
  54. * @method: POST
  55. * @param:
  56. <% for(var i = 0; i < configList.~size; i++) { %>
  57. <% if(configList[i].fieldNameCamelCase!= "createTime" && configList[i].fieldNameCamelCase != "createBy" && configList[i].fieldNameCamelCase != "updateTime" &&configList[i].fieldNameCamelCase != "updateBy" && configList[i].fieldNameCamelCase != "tenantId" && configList[i].fieldNameCamelCase!= "deleted" && configList[i].whetherAddUpdate) {%>
  58. * {${configList[i].fieldJavaType}} ${configList[i].fieldNameCamelCase} ${configList[i].fieldRemark}
  59. <% } %>
  60. <% } %>
  61. * @return:
  62. * 0 添加失败
  63. * 1 添加成功
  64. */
  65. export const ${frontModuleName}${busNameFirstUpper}Add = (params?: object) => {
  66. return defHttp.post({ url: Api.${frontModuleName}${busNameFirstUpper}Add, params: params });
  67. };
  68. /**
  69. *
  70. * @author ${authorName}
  71. * @date ${genTime}
  72. * @description: 通过主键id编辑${functionName},权限 - ${backendModuleName}:${busName}:edit
  73. * @method: POST
  74. * @param:
  75. <% for(var i = 0; i < configList.~size; i++) { %>
  76. <% if(configList[i].fieldNameCamelCase!= "createTime" && configList[i].fieldNameCamelCase != "createBy" && configList[i].fieldNameCamelCase != "updateTime" &&configList[i].fieldNameCamelCase != "updateBy" && configList[i].fieldNameCamelCase != "tenantId" && configList[i].fieldNameCamelCase!= "deleted" && configList[i].whetherAddUpdate) {%>
  77. * {${configList[i].fieldJavaType}} ${configList[i].fieldNameCamelCase} ${configList[i].fieldRemark}
  78. <% } %>
  79. <% } %>
  80. * @return:
  81. * 0 编辑失败
  82. * 1 编辑成功
  83. */
  84. export const ${frontModuleName}${busNameFirstUpper}Edit = (params?: object) => {
  85. return defHttp.post({ url: Api.${frontModuleName}${busNameFirstUpper}Edit, params: params });
  86. };
  87. /**
  88. * @description: 删除,权限 - ${backendModuleName}:${busName}:remove
  89. * @method: POST
  90. */
  91. export const ${frontModuleName}${busNameFirstUpper}Remove = (params: Array<string | number>) => {
  92. return defHttp.post({ url: Api.${frontModuleName}${busNameFirstUpper}Remove, params: params });
  93. };