where 对3元表达式解析的bug问题 返回

SqlSugar 处理完成
6 412
该叫什么 CM 发布于2023/12/3
悬赏:0 飞吻

.Where((t, dir) => (dir.BuildingIds.Length>0?dir.BuildingIds.length>0:true)==true)——可执行

.Where((t, dir) => (dir.BuildingIds.Length>0?SqlFunc.Contains(dir.BuildingIds,""):true)==true)——不可执行


同样是3元表达式,为什么下面的3元表达式就报“argument do not support”

热忱回答6

  • fate sta fate sta VIP0
    2023/12/3

    主要是sql中 case then 只能用 变量不能用 条件

    推荐用whereif实现这种逻辑 因为whereif性能比较好把逻辑在sql外处理了

     

    0 回复
  • fate sta fate sta VIP0
    2023/12/3

    dir.BuildingIds.length>0改成 dir.BuildingIds.length>0?true:false

    0 回复
  • fate sta fate sta VIP0
    2023/12/3

    SqlFunc.Contains(dir.BuildingIds,"")?true:false尽量这样 符合sql逻辑

    0 回复
  • fate sta fate sta VIP0
    2023/12/3

    case when条件  , then 是值不是能是条年

    0 回复
  • fate sta fate sta VIP0
    2023/12/3

    -

    0 回复
  • fate sta fate sta VIP0
    2023/12/3

    SqlSugarCore 5.1.4.125

    已支持

    0 回复