提交 | 用户 | 时间
|
e7c126
|
1 |
import request from '@/utils/request' |
H |
2 |
#set ($baseURL = "/${table.moduleName}/${simpleClassName_strikeCase}") |
|
3 |
|
|
4 |
// 创建${table.classComment} |
|
5 |
export function create${simpleClassName}(data) { |
|
6 |
return request({ |
|
7 |
url: '${baseURL}/create', |
|
8 |
method: 'post', |
|
9 |
data: data |
|
10 |
}) |
|
11 |
} |
|
12 |
|
|
13 |
// 更新${table.classComment} |
|
14 |
export function update${simpleClassName}(data) { |
|
15 |
return request({ |
|
16 |
url: '${baseURL}/update', |
|
17 |
method: 'put', |
|
18 |
data: data |
|
19 |
}) |
|
20 |
} |
|
21 |
|
|
22 |
// 删除${table.classComment} |
|
23 |
export function delete${simpleClassName}(id) { |
|
24 |
return request({ |
|
25 |
url: '${baseURL}/delete?id=' + id, |
|
26 |
method: 'delete' |
|
27 |
}) |
|
28 |
} |
|
29 |
|
|
30 |
// 获得${table.classComment} |
|
31 |
export function get${simpleClassName}(id) { |
|
32 |
return request({ |
|
33 |
url: '${baseURL}/get?id=' + id, |
|
34 |
method: 'get' |
|
35 |
}) |
|
36 |
} |
|
37 |
|
|
38 |
#if ( $table.templateType != 2 ) |
|
39 |
// 获得${table.classComment}分页 |
|
40 |
export function get${simpleClassName}Page(params) { |
|
41 |
return request({ |
|
42 |
url: '${baseURL}/page', |
|
43 |
method: 'get', |
|
44 |
params |
|
45 |
}) |
|
46 |
} |
|
47 |
#else |
|
48 |
// 获得${table.classComment}列表 |
|
49 |
export function get${simpleClassName}List(params) { |
|
50 |
return request({ |
|
51 |
url: '${baseURL}/list', |
|
52 |
method: 'get', |
|
53 |
params |
|
54 |
}) |
|
55 |
} |
|
56 |
#end |
|
57 |
// 导出${table.classComment} Excel |
|
58 |
export function export${simpleClassName}Excel(params) { |
|
59 |
return request({ |
|
60 |
url: '${baseURL}/export-excel', |
|
61 |
method: 'get', |
|
62 |
params, |
|
63 |
responseType: 'blob' |
|
64 |
}) |
|
65 |
} |
|
66 |
## 特殊:主子表专属逻辑 |
|
67 |
#foreach ($subTable in $subTables) |
|
68 |
#set ($index = $foreach.count - 1) |
|
69 |
#set ($subSimpleClassName = $subSimpleClassNames.get($index)) |
|
70 |
#set ($subPrimaryColumn = $subPrimaryColumns.get($index))##当前 primary 字段 |
|
71 |
#set ($subJoinColumn = $subJoinColumns.get($index))##当前 join 字段 |
|
72 |
#set ($SubJoinColumnName = $subJoinColumn.javaField.substring(0,1).toUpperCase() + ${subJoinColumn.javaField.substring(1)})##首字母大写 |
|
73 |
#set ($subSimpleClassName_strikeCase = $subSimpleClassName_strikeCases.get($index)) |
|
74 |
#set ($subJoinColumn_strikeCase = $subJoinColumn_strikeCases.get($index)) |
|
75 |
#set ($subClassNameVar = $subClassNameVars.get($index)) |
|
76 |
|
|
77 |
// ==================== 子表($subTable.classComment) ==================== |
|
78 |
## 情况一:MASTER_ERP 时,需要分查询页子表 |
|
79 |
#if ($table.templateType == 11) |
|
80 |
// 获得${subTable.classComment}分页 |
|
81 |
export function get${subSimpleClassName}Page(params) { |
|
82 |
return request({ |
|
83 |
url: '${baseURL}/${subSimpleClassName_strikeCase}/page', |
|
84 |
method: 'get', |
|
85 |
params |
|
86 |
}) |
|
87 |
} |
|
88 |
## 情况二:非 MASTER_ERP 时,需要列表查询子表 |
|
89 |
#else |
|
90 |
#if ($subTable.subJoinMany) |
|
91 |
// 获得${subTable.classComment}列表 |
|
92 |
export function get${subSimpleClassName}ListBy${SubJoinColumnName}(${subJoinColumn.javaField}) { |
|
93 |
return request({ |
|
94 |
url: '${baseURL}/${subSimpleClassName_strikeCase}/list-by-${subJoinColumn_strikeCase}?${subJoinColumn.javaField}=' + ${subJoinColumn.javaField}, |
|
95 |
method: 'get' |
|
96 |
}) |
|
97 |
} |
|
98 |
#else |
|
99 |
// 获得${subTable.classComment} |
|
100 |
export function get${subSimpleClassName}By${SubJoinColumnName}(${subJoinColumn.javaField}) { |
|
101 |
return request({ |
|
102 |
url: '${baseURL}/${subSimpleClassName_strikeCase}/get-by-${subJoinColumn_strikeCase}?${subJoinColumn.javaField}=' + ${subJoinColumn.javaField}, |
|
103 |
method: 'get' |
|
104 |
}) |
|
105 |
} |
|
106 |
#end |
|
107 |
#end |
|
108 |
## 特殊:MASTER_ERP 时,支持单个的新增、修改、删除操作 |
|
109 |
#if ($table.templateType == 11) |
|
110 |
// 新增${subTable.classComment} |
|
111 |
export function create${subSimpleClassName}(data) { |
|
112 |
return request({ |
|
113 |
url: '${baseURL}/${subSimpleClassName_strikeCase}/create', |
|
114 |
method: 'post', |
|
115 |
data |
|
116 |
}) |
|
117 |
} |
|
118 |
// 修改${subTable.classComment} |
|
119 |
export function update${subSimpleClassName}(data) { |
|
120 |
return request({ |
|
121 |
url: '${baseURL}/${subSimpleClassName_strikeCase}/update', |
|
122 |
method: 'post', |
|
123 |
data |
|
124 |
}) |
|
125 |
} |
|
126 |
// 删除${subTable.classComment} |
|
127 |
export function delete${subSimpleClassName}(id) { |
|
128 |
return request({ |
|
129 |
url: '${baseURL}/${subSimpleClassName_strikeCase}/delete?id=' + id, |
|
130 |
method: 'delete' |
|
131 |
}) |
|
132 |
} |
|
133 |
// 获得${subTable.classComment} |
|
134 |
export function get${subSimpleClassName}(id) { |
|
135 |
return request({ |
|
136 |
url: '${baseURL}/${subSimpleClassName_strikeCase}/get?id=' + id, |
|
137 |
method: 'get' |
|
138 |
}) |
|
139 |
} |
|
140 |
#end |
|
141 |
#end |