feat(cool): 修改关键词搜索逻辑以支持文本类型匹配 将 WhereOrLike 查询方式改为 WhereOrf,使用 PostgreSQL 的文本类型转换语法, 通过 field::text LIKE 来实现更准确的关键词匹配功能。 fix(config): 为店铺服务添加默认查询条件和字段选择 在 ShopService 中增加 ListQueryOp 配置,设置默认查询条件 is_enable=1 和指定的字段选择列表,优化查询性能并确保数据有效性。 ```
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user