api.js.vm 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. import request from '@/utils/request'
  2. // 查询{{ table.function_name }}列表
  3. export function list{{ table.class_name }}(query) {
  4. return request({
  5. url: '/{{ table.module_name }}/{{ table.business_name }}/list',
  6. method: 'get',
  7. params: query
  8. })
  9. }
  10. // 查询{{ table.function_name }}详细
  11. export function get{{- table.class_name }}({{ underscore(table.pk_column.java_field) if table.pk_column }}) {
  12. return request({
  13. url: '/{{ table.module_name }}/{{ table.business_name }}/' + {{- underscore(table.pk_column.java_field) if table.pk_column }},
  14. method: 'get'
  15. })
  16. }
  17. // 新增{{ table.function_name }}
  18. export function add{{ table.class_name }}(data) {
  19. return request({
  20. url: '/{{ table.module_name }}/{{ table.business_name }}',
  21. method: 'post',
  22. data: data
  23. })
  24. }
  25. // 修改{{ table.function_name }}
  26. export function update{{ table.class_name }}(data) {
  27. return request({
  28. url: '/{{ table.module_name }}/{{ table.business_name }}/' + data.{{ underscore(table.pk_column.java_field) if table.pk_column }},
  29. method: 'put',
  30. data: data
  31. })
  32. }
  33. // 删除{{ table.function_name }}
  34. export function del{{- table.class_name }}({{ underscore(table.pk_column.java_field) if table.pk_column }}) {
  35. return request({
  36. url: '/{{ table.module_name }}/{{ table.business_name }}/' + {{- underscore(table.pk_column.java_field) if table.pk_column }},
  37. method: 'delete'
  38. })
  39. }
  40. // 导出{{ table.function_name }}
  41. export function export{{ table.class_name }}(query) {
  42. return request({
  43. url: '/{{ table.module_name }}/{{ table.business_name }}/export',
  44. method: 'post',
  45. params: query
  46. })
  47. }
  48. // 下载{{ table.function_name }}导入模板
  49. export function importTemplate() {
  50. return request({
  51. url: '/{{ table.module_name }}/{{ table.business_name }}/importTemplate',
  52. method: 'post',
  53. responseType: 'blob'
  54. })
  55. }
  56. // 导入{{ table.function_name }}
  57. export function importData(data) {
  58. return request({
  59. url: '/{{ table.module_name }}/{{ table.business_name }}/importData',
  60. method: 'post',
  61. data: data
  62. })
  63. }