1
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful

This commit is contained in:
昔念
2026-03-23 15:01:13 +08:00
parent 84024aed83
commit 705eb31007
2 changed files with 8 additions and 3 deletions

View File

@@ -240,7 +240,9 @@ func (s *Service) ServiceList(ctx context.Context, req *ListReq) (data interface
for _, field := range s.ListQueryOp.DataFieldEQ {
if val := r.Get(field); val.String() != "" {
// 关键:拼接 data->>'字段名' = ?
m.Where("data->>? = ?", field, val)
// 错误写法m.Where("data->>::TEXT? = ?", field, val)
// 正确写法:
m.Where("(data->>?)::TEXT = ?", field, val)
}
}
}
@@ -356,7 +358,9 @@ func (s *Service) ServicePage(ctx context.Context, req *PageReq) (data interface
for _, field := range s.PageQueryOp.DataFieldEQ {
if val := r.Get(field); val.String() != "" {
// 关键:拼接 data->>'字段名' = ?
m.Where("data->>? = ?", field, val)
// 错误写法m.Where("data->>::TEXT? = ?", field, val)
// 正确写法:
m.Where("(data->>?)::TEXT = ?", field, val)
}
}
}