qdy 3週間前
コミット
18061e4d70
5個のファイルの変更579行の追加2行の削除
  1. 1
    1
      go.mod
  2. 278
    0
      sdk/configure/client.go
  3. 21
    1
      sdk/configure/doc.go
  4. 87
    0
      sdk/configure/test/example.go
  5. 192
    0
      sdk/configure/types.go

+ 1
- 1
go.mod ファイルの表示

@@ -5,6 +5,7 @@ go 1.25.4
5 5
 require (
6 6
 	github.com/hashicorp/consul/api v1.9.0
7 7
 	github.com/oapi-codegen/runtime v1.1.2
8
+	github.com/traefik/yaegi v0.16.1
8 9
 	go.mongodb.org/mongo-driver v1.17.6
9 10
 	gopkg.in/yaml.v2 v2.4.0
10 11
 )
@@ -34,7 +35,6 @@ require (
34 35
 	github.com/mitchellh/mapstructure v1.3.3 // indirect
35 36
 	github.com/rogpeppe/go-internal v1.14.1 // indirect
36 37
 	github.com/stretchr/testify v1.11.1 // indirect
37
-	github.com/traefik/yaegi v0.16.1 // indirect
38 38
 	go.opentelemetry.io/otel v1.28.0 // indirect
39 39
 	go.opentelemetry.io/otel/metric v1.28.0 // indirect
40 40
 	go.opentelemetry.io/otel/trace v1.28.0 // indirect

+ 278
- 0
sdk/configure/client.go ファイルの表示

@@ -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

+ 21
- 1
sdk/configure/doc.go ファイルの表示

@@ -1,7 +1,9 @@
1
-// Package configure 提供配置中心客户端的SDK,支持数据库字典的增删改查操作。
1
+// Package configure 提供配置中心客户端的SDK,支持数据库字典和别名字典的增删改查操作。
2 2
 //
3 3
 // 主要功能:
4 4
 //   - 数据库表字典的创建、查询、更新、删除
5
+//   - 数据库表别名和字段别名字典管理
6
+//   - 别名审批工作流管理
5 7
 //   - 支持Basic认证和Token认证
6 8
 //   - 自动从全局配置加载配置中心地址和token
7 9
 //   - 完整的错误处理和类型安全
@@ -66,4 +68,22 @@
66 68
 //   - POST /api/dic-table/detail/{table_id} - 查询数据库表字典详情
67 69
 //   - POST /api/dic-table/save     - 创建或更新数据库表字典
68 70
 //   - POST /api/dic-table/delete/{table_id} - 删除数据库表字典
71
+//
72
+// 别名管理API端点:
73
+//   - POST /api/dic-table-alias/list     - 查询表别名字典列表
74
+//   - POST /api/dic-table-alias/detail/{id} - 查询表别名字典详情
75
+//   - POST /api/dic-table-alias/save     - 保存表别名字典
76
+//   - POST /api/dic-table-alias/batch-save - 批量保存表别名字典
77
+//   - POST /api/dic-table-alias/delete/{id} - 删除表别名字典
78
+//   - POST /api/dic-table-field-alias/list     - 查询字段别名字典列表
79
+//   - POST /api/dic-table-field-alias/detail/{id} - 查询字段别名字典详情
80
+//   - POST /api/dic-table-field-alias/save     - 保存字段别名字典
81
+//   - POST /api/dic-table-field-alias/batch-save - 批量保存字段别名字典
82
+//   - POST /api/dic-table-field-alias/delete/{id} - 删除字段别名字典
83
+//   - POST /api/dic-table-alias-flow/list     - 查询表别名字典流水列表
84
+//   - POST /api/dic-table-alias-flow/batch-save - 批量保存表别名字典流水
85
+//   - POST /api/dic-table-alias-flow/batch-approval - 批量审批表别名字典流水
86
+//   - POST /api/dic-table-field-alias-flow/list     - 查询字段别名字典流水列表
87
+//   - POST /api/dic-table-field-alias-flow/batch-save - 批量保存字段别名字典流水
88
+//   - POST /api/dic-table-field-alias-flow/batch-approval - 批量审批字段别名字典流水
69 89
 package configure

+ 87
- 0
sdk/configure/test/example.go ファイルの表示

@@ -29,6 +29,9 @@ func ExampleUsage() {
29 29
 
30 30
 	// 示例5:删除表
31 31
 	exampleDeleteTable()
32
+
33
+	// 示例6:别名字典管理
34
+	exampleAliasManagement()
32 35
 }
33 36
 
34 37
 func exampleCreateClient() {
@@ -216,3 +219,87 @@ func exampleDeleteTable() {
216 219
 	fmt.Printf("Table %s deleted successfully\n", tableID)
217 220
 	fmt.Println()
218 221
 }
222
+
223
+func exampleAliasManagement() {
224
+	fmt.Println("=== 示例6:别名字典管理 ===")
225
+
226
+	// 创建客户端
227
+	client, err := configure.NewBasicAuthClient("http://localhost:8080", "admin", "123")
228
+	if err != nil {
229
+		log.Printf("Failed to create client: %v", err)
230
+		return
231
+	}
232
+
233
+	ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
234
+	defer cancel()
235
+
236
+	// 1. 创建表别名字典
237
+	tableAliasReq := &configure.TableAliasRequest{
238
+		TableID:    "example_table_001",
239
+		TableAlias: "示例表别名",
240
+	}
241
+
242
+	tableAliasDetail, err := client.SaveTableAlias(ctx, tableAliasReq)
243
+	if err != nil {
244
+		log.Printf("Error saving table alias: %v", err)
245
+		return
246
+	}
247
+	fmt.Printf("Table alias saved: ID=%s, TableID=%s, Alias=%s\n",
248
+		tableAliasDetail.TableAlias.ID,
249
+		tableAliasDetail.TableAlias.TableID,
250
+		tableAliasDetail.TableAlias.TableAlias)
251
+
252
+	// 2. 查询表别名字典列表
253
+	query := &configure.TableAliasQueryRequest{
254
+		QueryRequest: queryreq.QueryRequest{
255
+			Page:     0,
256
+			PageSize: 10,
257
+		},
258
+		TableID: "example_table_001",
259
+	}
260
+
261
+	tableAliasList, err := client.ListTableAliases(ctx, query)
262
+	if err != nil {
263
+		log.Printf("Error listing table aliases: %v", err)
264
+		return
265
+	}
266
+	fmt.Printf("Total table aliases: %d\n", tableAliasList.TotalCount)
267
+
268
+	// 3. 创建字段别名字典
269
+	fieldAliasReq := &configure.TableFieldAliasRequest{
270
+		FieldID:        "example_table_001.id",
271
+		TableID:        "example_table_001",
272
+		FieldName:      "id",
273
+		FieldAlias:     "主键别名",
274
+		Description:    "主键字段别名",
275
+		WhereCondition: "查询条件描述",
276
+	}
277
+
278
+	fieldAliasDetail, err := client.SaveTableFieldAlias(ctx, fieldAliasReq)
279
+	if err != nil {
280
+		log.Printf("Error saving field alias: %v", err)
281
+		return
282
+	}
283
+	fmt.Printf("Field alias saved: ID=%s, FieldID=%s, Alias=%s\n",
284
+		fieldAliasDetail.TableFieldAlias.ID,
285
+		fieldAliasDetail.TableFieldAlias.FieldID,
286
+		fieldAliasDetail.TableFieldAlias.FieldAlias)
287
+
288
+	// 4. 查询字段别名字典列表
289
+	fieldQuery := &configure.TableFieldAliasQueryRequest{
290
+		QueryRequest: queryreq.QueryRequest{
291
+			Page:     0,
292
+			PageSize: 10,
293
+		},
294
+		TableID: "example_table_001",
295
+	}
296
+
297
+	fieldAliasList, err := client.ListTableFieldAliases(ctx, fieldQuery)
298
+	if err != nil {
299
+		log.Printf("Error listing field aliases: %v", err)
300
+		return
301
+	}
302
+	fmt.Printf("Total field aliases: %d\n", fieldAliasList.TotalCount)
303
+
304
+	fmt.Println()
305
+}

+ 192
- 0
sdk/configure/types.go ファイルの表示

@@ -90,3 +90,195 @@ type DicTableFieldDB struct {
90 90
 	UpdatedAt   time.Time  `db:"updated_at" json:"updatedAt"`
91 91
 	DeletedAt   *time.Time `db:"deleted_at" json:"deletedAt"`
92 92
 }
93
+
94
+// 数据库别名字典类型
95
+// 表别名字典数据库模型
96
+type DicTableAliasDB struct {
97
+	ID         string     `db:"id" json:"id"`
98
+	TableID    string     `db:"table_id" json:"tableID"`
99
+	TableAlias string     `db:"table_alias" json:"tableAlias"`
100
+	CreatedAt  time.Time  `db:"created_at" json:"createdAt"`
101
+	UpdatedAt  time.Time  `db:"updated_at" json:"updatedAt"`
102
+	DeletedAt  *time.Time `db:"deleted_at" json:"deletedAt"`
103
+}
104
+
105
+// 字段别名字典数据库模型
106
+type DicTableFieldAliasDB struct {
107
+	ID             string     `db:"id" json:"id"`
108
+	FieldID        string     `db:"field_id" json:"fieldID"`
109
+	TableID        string     `db:"table_id" json:"tableID"`
110
+	FieldName      string     `db:"field_name" json:"fieldName"`
111
+	FieldAlias     string     `db:"field_alias" json:"fieldAlias"`
112
+	Description    string     `db:"description" json:"description"`
113
+	WhereCondition string     `db:"where_condition" json:"whereCondition"`
114
+	CreatedAt      time.Time  `db:"created_at" json:"createdAt"`
115
+	UpdatedAt      time.Time  `db:"updated_at" json:"updatedAt"`
116
+	DeletedAt      *time.Time `db:"deleted_at" json:"deletedAt"`
117
+}
118
+
119
+// 表别名字典流水数据库模型
120
+type DicTableAliasFlowDB struct {
121
+	ID             string     `db:"id" json:"id"`
122
+	TableID        string     `db:"table_id" json:"tableID"`
123
+	TableAlias     string     `db:"table_alias" json:"tableAlias"`
124
+	TenantID       string     `db:"tenant_id" json:"tenantID"`
125
+	ApprovalStatus int8       `db:"approval_status" json:"approvalStatus"`
126
+	Approver       string     `db:"approver" json:"approver"`
127
+	ApprovedAt     *time.Time `db:"approved_at" json:"approvedAt"`
128
+	CreatedAt      time.Time  `db:"created_at" json:"createdAt"`
129
+	UpdatedAt      time.Time  `db:"updated_at" json:"updatedAt"`
130
+	DeletedAt      *time.Time `db:"deleted_at" json:"deletedAt"`
131
+}
132
+
133
+// 字段别名字典流水数据库模型
134
+type DicTableFieldAliasFlowDB struct {
135
+	ID             string     `db:"id" json:"id"`
136
+	FieldID        string     `db:"field_id" json:"fieldID"`
137
+	TableID        string     `db:"table_id" json:"tableID"`
138
+	FieldName      string     `db:"field_name" json:"fieldName"`
139
+	FieldAlias     string     `db:"field_alias" json:"fieldAlias"`
140
+	Description    string     `db:"description" json:"description"`
141
+	WhereCondition string     `db:"where_condition" json:"whereCondition"`
142
+	TenantID       string     `db:"tenant_id" json:"tenantID"`
143
+	ApprovalStatus int8       `db:"approval_status" json:"approvalStatus"`
144
+	Approver       string     `db:"approver" json:"approver"`
145
+	ApprovedAt     *time.Time `db:"approved_at" json:"approvedAt"`
146
+	CreatedAt      time.Time  `db:"created_at" json:"createdAt"`
147
+	UpdatedAt      time.Time  `db:"updated_at" json:"updatedAt"`
148
+	DeletedAt      *time.Time `db:"deleted_at" json:"deletedAt"`
149
+}
150
+
151
+// 表别名字典查询请求
152
+type TableAliasQueryRequest struct {
153
+	queryreq.QueryRequest // 通用查询请求(分页、排序、筛选)
154
+
155
+	// 向后兼容的旧字段(新客户端应使用QueryRequest中的Filters)
156
+	TableID    string `json:"tableID,omitempty"`    // 表ID模糊搜索
157
+	TableAlias string `json:"tableAlias,omitempty"` // 别名模糊搜索
158
+	SortField  string `json:"sortField,omitempty"`  // 排序字段(单字段)
159
+	SortOrder  string `json:"sortOrder,omitempty"`  // 排序方向: asc/desc
160
+}
161
+
162
+// 表别名字典请求
163
+type TableAliasRequest struct {
164
+	ID         string `json:"id,omitempty"`                  // 主键(创建时可选,更新时必填)
165
+	TableID    string `json:"tableID" binding:"required"`    // 表ID
166
+	TableAlias string `json:"tableAlias" binding:"required"` // 别名
167
+
168
+	// 系统字段(创建时自动填充)
169
+	Creator   string    `json:"creator,omitempty"`   // 创建人
170
+	CreatedAt time.Time `json:"createdAt,omitempty"` // 创建时间
171
+	UpdatedAt time.Time `json:"updatedAt,omitempty"` // 更新时间
172
+}
173
+
174
+// 批量表别名字典请求
175
+type BatchTableAliasRequest struct {
176
+	Items []TableAliasRequest `json:"items" binding:"required"` // 表别名列表
177
+}
178
+
179
+// 表别名字典详情
180
+type TableAliasDetail struct {
181
+	TableAlias DicTableAliasDB `json:"tableAlias"` // 表别名字典信息
182
+}
183
+
184
+// 表别名字典列表
185
+type TableAliasList struct {
186
+	TotalCount int               `json:"totalCount"`
187
+	LastPage   int               `json:"lastPage"`
188
+	Data       []DicTableAliasDB `json:"data"`
189
+}
190
+
191
+// 字段别名字典查询请求
192
+type TableFieldAliasQueryRequest struct {
193
+	queryreq.QueryRequest // 通用查询请求(分页、排序、筛选)
194
+
195
+	// 向后兼容的旧字段(新客户端应使用QueryRequest中的Filters)
196
+	TableID    string `json:"tableID,omitempty"`    // 表ID模糊搜索
197
+	FieldID    string `json:"fieldID,omitempty"`    // 字段ID模糊搜索
198
+	FieldName  string `json:"fieldName,omitempty"`  // 字段名称模糊搜索
199
+	FieldAlias string `json:"fieldAlias,omitempty"` // 字段别名模糊搜索
200
+	SortField  string `json:"sortField,omitempty"`  // 排序字段(单字段)
201
+	SortOrder  string `json:"sortOrder,omitempty"`  // 排序方向: asc/desc
202
+}
203
+
204
+// 字段别名字典请求
205
+type TableFieldAliasRequest struct {
206
+	ID             string `json:"id,omitempty"`                  // 主键(创建时可选,更新时必填)
207
+	FieldID        string `json:"fieldID" binding:"required"`    // 字段ID
208
+	TableID        string `json:"tableID" binding:"required"`    // 表ID
209
+	FieldName      string `json:"fieldName" binding:"required"`  // 字段名称
210
+	FieldAlias     string `json:"fieldAlias" binding:"required"` // 字段别名
211
+	Description    string `json:"description"`                   // 字段别名描述
212
+	WhereCondition string `json:"whereCondition"`                // 此别名获取数据的查询条件描述
213
+
214
+	// 系统字段(创建时自动填充)
215
+	Creator   string    `json:"creator,omitempty"`   // 创建人
216
+	CreatedAt time.Time `json:"createdAt,omitempty"` // 创建时间
217
+	UpdatedAt time.Time `json:"updatedAt,omitempty"` // 更新时间
218
+}
219
+
220
+// 批量字段别名字典请求
221
+type BatchTableFieldAliasRequest struct {
222
+	Items []TableFieldAliasRequest `json:"items" binding:"required"` // 字段别名列表
223
+}
224
+
225
+// 字段别名字典详情
226
+type TableFieldAliasDetail struct {
227
+	TableFieldAlias DicTableFieldAliasDB `json:"tableFieldAlias"` // 字段别名字典信息
228
+}
229
+
230
+// 字段别名字典列表
231
+type TableFieldAliasList struct {
232
+	TotalCount int                    `json:"totalCount"`
233
+	LastPage   int                    `json:"lastPage"`
234
+	Data       []DicTableFieldAliasDB `json:"data"`
235
+}
236
+
237
+// 表别名字典流水查询请求
238
+type TableAliasFlowQueryRequest struct {
239
+	queryreq.QueryRequest // 通用查询请求(分页、排序、筛选)
240
+
241
+	// 向后兼容的旧字段
242
+	TableID        string `json:"tableID,omitempty"`        // 表ID模糊搜索
243
+	TableAlias     string `json:"tableAlias,omitempty"`     // 别名模糊搜索
244
+	TenantID       string `json:"tenantID,omitempty"`       // 租户ID精确搜索
245
+	ApprovalStatus int8   `json:"approvalStatus,omitempty"` // 审批状态精确搜索
246
+	SortField      string `json:"sortField,omitempty"`      // 排序字段(单字段)
247
+	SortOrder      string `json:"sortOrder,omitempty"`      // 排序方向: asc/desc
248
+}
249
+
250
+// 字段别名字典流水查询请求
251
+type TableFieldAliasFlowQueryRequest struct {
252
+	queryreq.QueryRequest // 通用查询请求(分页、排序、筛选)
253
+
254
+	// 向后兼容的旧字段
255
+	TableID        string `json:"tableID,omitempty"`        // 表ID模糊搜索
256
+	FieldID        string `json:"fieldID,omitempty"`        // 字段ID模糊搜索
257
+	FieldName      string `json:"fieldName,omitempty"`      // 字段名称模糊搜索
258
+	FieldAlias     string `json:"fieldAlias,omitempty"`     // 字段别名模糊搜索
259
+	TenantID       string `json:"tenantID,omitempty"`       // 租户ID精确搜索
260
+	ApprovalStatus int8   `json:"approvalStatus,omitempty"` // 审批状态精确搜索
261
+	SortField      string `json:"sortField,omitempty"`      // 排序字段(单字段)
262
+	SortOrder      string `json:"sortOrder,omitempty"`      // 排序方向: asc/desc
263
+}
264
+
265
+// 批量审批流水请求
266
+type BatchApprovalFlowRequest struct {
267
+	IDs            []string `json:"ids" binding:"required"`            // 流水记录ID列表
268
+	ApprovalStatus int8     `json:"approvalStatus" binding:"required"` // 审批状态:0待审批,1通过,2拒绝
269
+	Approver       string   `json:"approver" binding:"required"`       // 审批人
270
+}
271
+
272
+// 表别名字典流水列表
273
+type TableAliasFlowList struct {
274
+	TotalCount int                   `json:"totalCount"`
275
+	LastPage   int                   `json:"lastPage"`
276
+	Data       []DicTableAliasFlowDB `json:"data"`
277
+}
278
+
279
+// 字段别名字典流水列表
280
+type TableFieldAliasFlowList struct {
281
+	TotalCount int                        `json:"totalCount"`
282
+	LastPage   int                        `json:"lastPage"`
283
+	Data       []DicTableFieldAliasFlowDB `json:"data"`
284
+}

読み込み中…
キャンセル
保存