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

feat(cool): 修改关键词搜索逻辑以支持文本类型匹配

将 WhereOrLike 查询方式改为 WhereOrf,使用 PostgreSQL 的文本类型转换语法,
通过 field::text LIKE 来实现更准确的关键词匹配功能。

fix(config): 为店铺服务添加默认查询条件和字段选择

在 ShopService 中增加 ListQueryOp 配置,设置默认查询条件 is_enable=1
和指定的字段选择列表,优化查询性能并确保数据有效性。
```
This commit is contained in:
昔念
2026-02-18 22:43:39 +08:00
parent 4a5a7727b5
commit f4438b9000
2 changed files with 15 additions and 1 deletions

View File

@@ -208,7 +208,9 @@ func (s *Service) ServiceList(ctx context.Context, req *ListReq) (data interface
for _, field := range s.ListQueryOp.KeyWordField {
// g.DumpWithType(field)
// builder.WhereLike(field, "%"+r.Get("keyWord").String()+"%")
builder = builder.WhereOrLike(field, "%"+r.Get("keyWord").String()+"%")
builder = builder.WhereOrf(field+"::text LIKE ?", "%"+r.Get("keyWord").String()+"%")
//builder = builder.WhereOrLike(field, "%"+r.Get("keyWord").String()+"%")
}
m.Where(builder)
}