|
|
@@ -154,6 +154,284 @@ func (c *Client) DeleteTable(ctx context.Context, tableID string) error {
|
|
154
|
154
|
return nil
|
|
155
|
155
|
}
|
|
156
|
156
|
|
|
|
157
|
+// ListTableAliases 查询表别名字典列表
|
|
|
158
|
+func (c *Client) ListTableAliases(ctx context.Context, query *TableAliasQueryRequest) (*TableAliasList, error) {
|
|
|
159
|
+ endpoint := "/api/dic-table-alias/list"
|
|
|
160
|
+
|
|
|
161
|
+ var result ResponseWrapper[[]DicTableAliasDB]
|
|
|
162
|
+ if err := c.doRequest(ctx, http.MethodPost, endpoint, query, &result); err != nil {
|
|
|
163
|
+ return nil, err
|
|
|
164
|
+ }
|
|
|
165
|
+
|
|
|
166
|
+ if !result.Success {
|
|
|
167
|
+ return nil, NewClientError("list_table_aliases", fmt.Sprintf("API error: %s", result.Error), nil)
|
|
|
168
|
+ }
|
|
|
169
|
+
|
|
|
170
|
+ return &TableAliasList{
|
|
|
171
|
+ TotalCount: result.TotalCount,
|
|
|
172
|
+ LastPage: result.LastPage,
|
|
|
173
|
+ Data: result.Data,
|
|
|
174
|
+ }, nil
|
|
|
175
|
+}
|
|
|
176
|
+
|
|
|
177
|
+// GetTableAlias 查询表别名字典详情
|
|
|
178
|
+func (c *Client) GetTableAlias(ctx context.Context, id string) (*TableAliasDetail, error) {
|
|
|
179
|
+ endpoint := fmt.Sprintf("/api/dic-table-alias/detail/%s", id)
|
|
|
180
|
+
|
|
|
181
|
+ var result ResponseWrapper[TableAliasDetail]
|
|
|
182
|
+ if err := c.doRequest(ctx, http.MethodPost, endpoint, nil, &result); err != nil {
|
|
|
183
|
+ return nil, err
|
|
|
184
|
+ }
|
|
|
185
|
+
|
|
|
186
|
+ if !result.Success {
|
|
|
187
|
+ if result.Error == "not found" || strings.Contains(result.Error, "不存在") {
|
|
|
188
|
+ return nil, ErrNotFound
|
|
|
189
|
+ }
|
|
|
190
|
+ return nil, NewClientError("get_table_alias", fmt.Sprintf("API error: %s", result.Error), nil)
|
|
|
191
|
+ }
|
|
|
192
|
+
|
|
|
193
|
+ return &result.Data, nil
|
|
|
194
|
+}
|
|
|
195
|
+
|
|
|
196
|
+// SaveTableAlias 创建或更新表别名字典
|
|
|
197
|
+func (c *Client) SaveTableAlias(ctx context.Context, req *TableAliasRequest) (*TableAliasDetail, error) {
|
|
|
198
|
+ endpoint := "/api/dic-table-alias/save"
|
|
|
199
|
+
|
|
|
200
|
+ var result ResponseWrapper[TableAliasDetail]
|
|
|
201
|
+ if err := c.doRequest(ctx, http.MethodPost, endpoint, req, &result); err != nil {
|
|
|
202
|
+ return nil, err
|
|
|
203
|
+ }
|
|
|
204
|
+
|
|
|
205
|
+ if !result.Success {
|
|
|
206
|
+ return nil, NewClientError("save_table_alias", fmt.Sprintf("API error: %s", result.Error), nil)
|
|
|
207
|
+ }
|
|
|
208
|
+
|
|
|
209
|
+ return &result.Data, nil
|
|
|
210
|
+}
|
|
|
211
|
+
|
|
|
212
|
+// BatchSaveTableAliases 批量保存表别名字典
|
|
|
213
|
+func (c *Client) BatchSaveTableAliases(ctx context.Context, req *BatchTableAliasRequest) ([]TableAliasDetail, error) {
|
|
|
214
|
+ endpoint := "/api/dic-table-alias/batch-save"
|
|
|
215
|
+
|
|
|
216
|
+ var result ResponseWrapper[[]TableAliasDetail]
|
|
|
217
|
+ if err := c.doRequest(ctx, http.MethodPost, endpoint, req, &result); err != nil {
|
|
|
218
|
+ return nil, err
|
|
|
219
|
+ }
|
|
|
220
|
+
|
|
|
221
|
+ if !result.Success {
|
|
|
222
|
+ return nil, NewClientError("batch_save_table_aliases", fmt.Sprintf("API error: %s", result.Error), nil)
|
|
|
223
|
+ }
|
|
|
224
|
+
|
|
|
225
|
+ return result.Data, nil
|
|
|
226
|
+}
|
|
|
227
|
+
|
|
|
228
|
+// DeleteTableAlias 删除表别名字典
|
|
|
229
|
+func (c *Client) DeleteTableAlias(ctx context.Context, id string) error {
|
|
|
230
|
+ endpoint := fmt.Sprintf("/api/dic-table-alias/delete/%s", id)
|
|
|
231
|
+
|
|
|
232
|
+ var result ResponseWrapper[int64]
|
|
|
233
|
+ if err := c.doRequest(ctx, http.MethodPost, endpoint, nil, &result); err != nil {
|
|
|
234
|
+ return err
|
|
|
235
|
+ }
|
|
|
236
|
+
|
|
|
237
|
+ if !result.Success {
|
|
|
238
|
+ return NewClientError("delete_table_alias", fmt.Sprintf("API error: %s", result.Error), nil)
|
|
|
239
|
+ }
|
|
|
240
|
+
|
|
|
241
|
+ return nil
|
|
|
242
|
+}
|
|
|
243
|
+
|
|
|
244
|
+// ListTableFieldAliases 查询字段别名字典列表
|
|
|
245
|
+func (c *Client) ListTableFieldAliases(ctx context.Context, query *TableFieldAliasQueryRequest) (*TableFieldAliasList, error) {
|
|
|
246
|
+ endpoint := "/api/dic-table-field-alias/list"
|
|
|
247
|
+
|
|
|
248
|
+ var result ResponseWrapper[[]DicTableFieldAliasDB]
|
|
|
249
|
+ if err := c.doRequest(ctx, http.MethodPost, endpoint, query, &result); err != nil {
|
|
|
250
|
+ return nil, err
|
|
|
251
|
+ }
|
|
|
252
|
+
|
|
|
253
|
+ if !result.Success {
|
|
|
254
|
+ return nil, NewClientError("list_table_field_aliases", fmt.Sprintf("API error: %s", result.Error), nil)
|
|
|
255
|
+ }
|
|
|
256
|
+
|
|
|
257
|
+ return &TableFieldAliasList{
|
|
|
258
|
+ TotalCount: result.TotalCount,
|
|
|
259
|
+ LastPage: result.LastPage,
|
|
|
260
|
+ Data: result.Data,
|
|
|
261
|
+ }, nil
|
|
|
262
|
+}
|
|
|
263
|
+
|
|
|
264
|
+// GetTableFieldAlias 查询字段别名字典详情
|
|
|
265
|
+func (c *Client) GetTableFieldAlias(ctx context.Context, id string) (*TableFieldAliasDetail, error) {
|
|
|
266
|
+ endpoint := fmt.Sprintf("/api/dic-table-field-alias/detail/%s", id)
|
|
|
267
|
+
|
|
|
268
|
+ var result ResponseWrapper[TableFieldAliasDetail]
|
|
|
269
|
+ if err := c.doRequest(ctx, http.MethodPost, endpoint, nil, &result); err != nil {
|
|
|
270
|
+ return nil, err
|
|
|
271
|
+ }
|
|
|
272
|
+
|
|
|
273
|
+ if !result.Success {
|
|
|
274
|
+ if result.Error == "not found" || strings.Contains(result.Error, "不存在") {
|
|
|
275
|
+ return nil, ErrNotFound
|
|
|
276
|
+ }
|
|
|
277
|
+ return nil, NewClientError("get_table_field_alias", fmt.Sprintf("API error: %s", result.Error), nil)
|
|
|
278
|
+ }
|
|
|
279
|
+
|
|
|
280
|
+ return &result.Data, nil
|
|
|
281
|
+}
|
|
|
282
|
+
|
|
|
283
|
+// SaveTableFieldAlias 创建或更新字段别名字典
|
|
|
284
|
+func (c *Client) SaveTableFieldAlias(ctx context.Context, req *TableFieldAliasRequest) (*TableFieldAliasDetail, error) {
|
|
|
285
|
+ endpoint := "/api/dic-table-field-alias/save"
|
|
|
286
|
+
|
|
|
287
|
+ var result ResponseWrapper[TableFieldAliasDetail]
|
|
|
288
|
+ if err := c.doRequest(ctx, http.MethodPost, endpoint, req, &result); err != nil {
|
|
|
289
|
+ return nil, err
|
|
|
290
|
+ }
|
|
|
291
|
+
|
|
|
292
|
+ if !result.Success {
|
|
|
293
|
+ return nil, NewClientError("save_table_field_alias", fmt.Sprintf("API error: %s", result.Error), nil)
|
|
|
294
|
+ }
|
|
|
295
|
+
|
|
|
296
|
+ return &result.Data, nil
|
|
|
297
|
+}
|
|
|
298
|
+
|
|
|
299
|
+// BatchSaveTableFieldAliases 批量保存字段别名字典
|
|
|
300
|
+func (c *Client) BatchSaveTableFieldAliases(ctx context.Context, req *BatchTableFieldAliasRequest) ([]TableFieldAliasDetail, error) {
|
|
|
301
|
+ endpoint := "/api/dic-table-field-alias/batch-save"
|
|
|
302
|
+
|
|
|
303
|
+ var result ResponseWrapper[[]TableFieldAliasDetail]
|
|
|
304
|
+ if err := c.doRequest(ctx, http.MethodPost, endpoint, req, &result); err != nil {
|
|
|
305
|
+ return nil, err
|
|
|
306
|
+ }
|
|
|
307
|
+
|
|
|
308
|
+ if !result.Success {
|
|
|
309
|
+ return nil, NewClientError("batch_save_table_field_aliases", fmt.Sprintf("API error: %s", result.Error), nil)
|
|
|
310
|
+ }
|
|
|
311
|
+
|
|
|
312
|
+ return result.Data, nil
|
|
|
313
|
+}
|
|
|
314
|
+
|
|
|
315
|
+// DeleteTableFieldAlias 删除字段别名字典
|
|
|
316
|
+func (c *Client) DeleteTableFieldAlias(ctx context.Context, id string) error {
|
|
|
317
|
+ endpoint := fmt.Sprintf("/api/dic-table-field-alias/delete/%s", id)
|
|
|
318
|
+
|
|
|
319
|
+ var result ResponseWrapper[int64]
|
|
|
320
|
+ if err := c.doRequest(ctx, http.MethodPost, endpoint, nil, &result); err != nil {
|
|
|
321
|
+ return err
|
|
|
322
|
+ }
|
|
|
323
|
+
|
|
|
324
|
+ if !result.Success {
|
|
|
325
|
+ return NewClientError("delete_table_field_alias", fmt.Sprintf("API error: %s", result.Error), nil)
|
|
|
326
|
+ }
|
|
|
327
|
+
|
|
|
328
|
+ return nil
|
|
|
329
|
+}
|
|
|
330
|
+
|
|
|
331
|
+// ListTableAliasFlow 查询表别名字典流水列表
|
|
|
332
|
+func (c *Client) ListTableAliasFlow(ctx context.Context, query *TableAliasFlowQueryRequest) (*TableAliasFlowList, error) {
|
|
|
333
|
+ endpoint := "/api/dic-table-alias-flow/list"
|
|
|
334
|
+
|
|
|
335
|
+ var result ResponseWrapper[[]DicTableAliasFlowDB]
|
|
|
336
|
+ if err := c.doRequest(ctx, http.MethodPost, endpoint, query, &result); err != nil {
|
|
|
337
|
+ return nil, err
|
|
|
338
|
+ }
|
|
|
339
|
+
|
|
|
340
|
+ if !result.Success {
|
|
|
341
|
+ return nil, NewClientError("list_table_alias_flow", fmt.Sprintf("API error: %s", result.Error), nil)
|
|
|
342
|
+ }
|
|
|
343
|
+
|
|
|
344
|
+ return &TableAliasFlowList{
|
|
|
345
|
+ TotalCount: result.TotalCount,
|
|
|
346
|
+ LastPage: result.LastPage,
|
|
|
347
|
+ Data: result.Data,
|
|
|
348
|
+ }, nil
|
|
|
349
|
+}
|
|
|
350
|
+
|
|
|
351
|
+// BatchSaveTableAliasFlow 批量保存表别名字典流水
|
|
|
352
|
+func (c *Client) BatchSaveTableAliasFlow(ctx context.Context, req *BatchTableAliasRequest, tenantID string) ([]DicTableAliasFlowDB, error) {
|
|
|
353
|
+ endpoint := fmt.Sprintf("/api/dic-table-alias-flow/batch-save?tenantID=%s", tenantID)
|
|
|
354
|
+
|
|
|
355
|
+ var result ResponseWrapper[[]DicTableAliasFlowDB]
|
|
|
356
|
+ if err := c.doRequest(ctx, http.MethodPost, endpoint, req, &result); err != nil {
|
|
|
357
|
+ return nil, err
|
|
|
358
|
+ }
|
|
|
359
|
+
|
|
|
360
|
+ if !result.Success {
|
|
|
361
|
+ return nil, NewClientError("batch_save_table_alias_flow", fmt.Sprintf("API error: %s", result.Error), nil)
|
|
|
362
|
+ }
|
|
|
363
|
+
|
|
|
364
|
+ return result.Data, nil
|
|
|
365
|
+}
|
|
|
366
|
+
|
|
|
367
|
+// BatchApprovalTableAliasFlow 批量审批表别名字典流水
|
|
|
368
|
+func (c *Client) BatchApprovalTableAliasFlow(ctx context.Context, req *BatchApprovalFlowRequest) error {
|
|
|
369
|
+ endpoint := "/api/dic-table-alias-flow/batch-approval"
|
|
|
370
|
+
|
|
|
371
|
+ var result ResponseWrapper[int64]
|
|
|
372
|
+ if err := c.doRequest(ctx, http.MethodPost, endpoint, req, &result); err != nil {
|
|
|
373
|
+ return err
|
|
|
374
|
+ }
|
|
|
375
|
+
|
|
|
376
|
+ if !result.Success {
|
|
|
377
|
+ return NewClientError("batch_approval_table_alias_flow", fmt.Sprintf("API error: %s", result.Error), nil)
|
|
|
378
|
+ }
|
|
|
379
|
+
|
|
|
380
|
+ return nil
|
|
|
381
|
+}
|
|
|
382
|
+
|
|
|
383
|
+// ListTableFieldAliasFlow 查询字段别名字典流水列表
|
|
|
384
|
+func (c *Client) ListTableFieldAliasFlow(ctx context.Context, query *TableFieldAliasFlowQueryRequest) (*TableFieldAliasFlowList, error) {
|
|
|
385
|
+ endpoint := "/api/dic-table-field-alias-flow/list"
|
|
|
386
|
+
|
|
|
387
|
+ var result ResponseWrapper[[]DicTableFieldAliasFlowDB]
|
|
|
388
|
+ if err := c.doRequest(ctx, http.MethodPost, endpoint, query, &result); err != nil {
|
|
|
389
|
+ return nil, err
|
|
|
390
|
+ }
|
|
|
391
|
+
|
|
|
392
|
+ if !result.Success {
|
|
|
393
|
+ return nil, NewClientError("list_table_field_alias_flow", fmt.Sprintf("API error: %s", result.Error), nil)
|
|
|
394
|
+ }
|
|
|
395
|
+
|
|
|
396
|
+ return &TableFieldAliasFlowList{
|
|
|
397
|
+ TotalCount: result.TotalCount,
|
|
|
398
|
+ LastPage: result.LastPage,
|
|
|
399
|
+ Data: result.Data,
|
|
|
400
|
+ }, nil
|
|
|
401
|
+}
|
|
|
402
|
+
|
|
|
403
|
+// BatchSaveTableFieldAliasFlow 批量保存字段别名字典流水
|
|
|
404
|
+func (c *Client) BatchSaveTableFieldAliasFlow(ctx context.Context, req *BatchTableFieldAliasRequest, tenantID string) ([]DicTableFieldAliasFlowDB, error) {
|
|
|
405
|
+ endpoint := fmt.Sprintf("/api/dic-table-field-alias-flow/batch-save?tenantID=%s", tenantID)
|
|
|
406
|
+
|
|
|
407
|
+ var result ResponseWrapper[[]DicTableFieldAliasFlowDB]
|
|
|
408
|
+ if err := c.doRequest(ctx, http.MethodPost, endpoint, req, &result); err != nil {
|
|
|
409
|
+ return nil, err
|
|
|
410
|
+ }
|
|
|
411
|
+
|
|
|
412
|
+ if !result.Success {
|
|
|
413
|
+ return nil, NewClientError("batch_save_table_field_alias_flow", fmt.Sprintf("API error: %s", result.Error), nil)
|
|
|
414
|
+ }
|
|
|
415
|
+
|
|
|
416
|
+ return result.Data, nil
|
|
|
417
|
+}
|
|
|
418
|
+
|
|
|
419
|
+// BatchApprovalTableFieldAliasFlow 批量审批字段别名字典流水
|
|
|
420
|
+func (c *Client) BatchApprovalTableFieldAliasFlow(ctx context.Context, req *BatchApprovalFlowRequest) error {
|
|
|
421
|
+ endpoint := "/api/dic-table-field-alias-flow/batch-approval"
|
|
|
422
|
+
|
|
|
423
|
+ var result ResponseWrapper[int64]
|
|
|
424
|
+ if err := c.doRequest(ctx, http.MethodPost, endpoint, req, &result); err != nil {
|
|
|
425
|
+ return err
|
|
|
426
|
+ }
|
|
|
427
|
+
|
|
|
428
|
+ if !result.Success {
|
|
|
429
|
+ return NewClientError("batch_approval_table_field_alias_flow", fmt.Sprintf("API error: %s", result.Error), nil)
|
|
|
430
|
+ }
|
|
|
431
|
+
|
|
|
432
|
+ return nil
|
|
|
433
|
+}
|
|
|
434
|
+
|
|
157
|
435
|
// doRequest 执行HTTP请求
|
|
158
|
436
|
func (c *Client) doRequest(ctx context.Context, method, endpoint string, body interface{}, result interface{}) error {
|
|
159
|
437
|
// 构建URL
|