Bläddra i källkod

提出为组件和筛选,排序ok

qdy 1 månad sedan
förälder
incheckning
dc27f59823
2 ändrade filer med 23 tillägg och 6 borttagningar
  1. 21
    5
      internal/service/metamanagement/tabulator_adapter.go
  2. 2
    1
      main.go

+ 21
- 5
internal/service/metamanagement/tabulator_adapter.go Visa fil

@@ -2,8 +2,10 @@ package metamanagement
2 2
 
3 3
 import (
4 4
 	"context"
5
+	"encoding/json"
5 6
 
6 7
 	"git.x2erp.com/qdy/go-base/ctx"
8
+	"git.x2erp.com/qdy/go-base/logger"
7 9
 	"git.x2erp.com/qdy/go-base/model/request/tabulatorreq"
8 10
 	"git.x2erp.com/qdy/go-base/model/response"
9 11
 	"git.x2erp.com/qdy/go-db/factory/database"
@@ -11,20 +13,34 @@ import (
11 13
 )
12 14
 
13 15
 // TabulatorConfigMetaRequest Tabulator专用的配置元请求
14
-type TabulatorConfigMetaRequest struct {
15
-	tabulatorreq.TabulatorRequest
16
-}
16
+//type TabulatorConfigMetaRequest struct {
17
+//	tabulatorreq.TabulatorRequest
18
+//}
17 19
 
18 20
 // ListConfigMetaTabulator Tabulator格式的配置元查询
19
-func ListConfigMetaTabulator(req *TabulatorConfigMetaRequest, ctx context.Context, dbFactory *database.DBFactory, reqCtx *ctx.RequestContext) *response.QueryResult[[]tables.ConfigMetaDB] {
21
+func ListConfigMetaTabulator(req *tabulatorreq.TabulatorRequest, ctx context.Context, dbFactory *database.DBFactory, reqCtx *ctx.RequestContext) *response.QueryResult[[]tables.ConfigMetaDB] {
22
+	// 调试:记录接收到的原始请求
23
+	if logger.IsDebug() {
24
+		logger.Debug("TabulatorConfigMetaRequest 原始请求: %+v", req)
25
+		if req != nil {
26
+			jsonBytes, _ := json.Marshal(req)
27
+			logger.Debug("TabulatorRequest: %s", jsonBytes)
28
+		}
29
+	}
30
+
20 31
 	// 验证请求参数
21 32
 	if req == nil {
22
-		req = &TabulatorConfigMetaRequest{}
33
+		req = &tabulatorreq.TabulatorRequest{}
23 34
 		req.Page = 1
24 35
 		req.Size = 10
25 36
 	}
26 37
 	req.Validate()
27 38
 
39
+	// 调试:验证后的值
40
+	if logger.IsDebug() {
41
+		logger.Debug("TabulatorConfigMetaRequest 验证后: Page=%d, Size=%d", req.Page, req.Size)
42
+	}
43
+
28 44
 	// 定义字段映射:前端字段名 -> 后端字段名
29 45
 	fieldMapper := func(field string) string {
30 46
 		switch field {

+ 2
- 1
main.go Visa fil

@@ -11,6 +11,7 @@ import (
11 11
 	"git.x2erp.com/qdy/go-base/graceful"
12 12
 	"git.x2erp.com/qdy/go-base/logger"
13 13
 	"git.x2erp.com/qdy/go-base/model/request/configreq"
14
+	"git.x2erp.com/qdy/go-base/model/request/tabulatorreq"
14 15
 	"git.x2erp.com/qdy/go-base/model/response"
15 16
 	"git.x2erp.com/qdy/go-base/webx"
16 17
 	"git.x2erp.com/qdy/go-base/webx/router"
@@ -176,7 +177,7 @@ func registerRoutes(ws *router.RouterService, dbFactory *database.DBFactory) {
176 177
 
177 178
 	// config meta management
178 179
 	ws.POST("/api/config/meta/list",
179
-		func(req *metamanagement.TabulatorConfigMetaRequest, ctx context.Context, reqCtx *ctx.RequestContext) (*response.QueryResult[[]tables.ConfigMetaDB], error) {
180
+		func(req *tabulatorreq.TabulatorRequest, ctx context.Context, reqCtx *ctx.RequestContext) (*response.QueryResult[[]tables.ConfigMetaDB], error) {
180 181
 
181 182
 			return metamanagement.ListConfigMetaTabulator(req, ctx, dbFactory, reqCtx), nil
182 183
 		},

Loading…
Avbryt
Spara