无法使用like 返回

SqlSugar 沟通中
3 638
该叫什么 默 发布于2025/12/31
悬赏:0 飞吻

 var customses = _genericSugarRepository.GetWithSelectedColumns<SCMCustom>(c => new {c.TeamId,c.Id,c.PinyinInitials,c.Code,c.ShopName,c.Keyword },
     w => w.TeamId == _teamId && (w.ShopName.Contains("葵涌") || w.ShopName.Contains("新圩"))) ;


输出的结果是

SELECT  `team_id` AS `TeamId` , `id` AS `Id` , `pinyin_initials` AS `PinyinInitials` , `code` AS `Code` , `shop_name` AS `ShopName` , `keyword` AS `Keyword`  FROM `t_custom`  WHERE (( `team_id` = N'cluster11-szyixiang' ) AND ((`shop_name` like concat('%',N'葵涌','%')) OR (`shop_name` like concat('%',N'新圩','%')) ))

导致查询失败,请问这是什么问题,SqlFunc.Contains( w.ShopName,"葵涌")  也是一样

热忱回答(3)

  • 默 默 VIP0
    2025/12/31

    mysql 数据库,5.6

    0 回复
  • 默 默 VIP0
    2025/12/31

    可以了,一个括号导致,team失效

    0 回复
  • 小杰 小杰 VIP0
    2026/1/1

    泛型加where:new(),class封装代码缺约束

    0 回复