草庐IT

LogicalType

全部标签

Swift 组合谓词 LogicalType AND OR

我如何在Swift谓词中组合混合ANDOR条件。我有以下查询Select*fromtblTempwheredept==1&&(subdept==11||subdept==12)我可以用相同的运算符写两个谓词,但不知道如何组合它们letdeptPredicate=NSPredicate(format:"dept==%@",1)letsubdeptPredicate1=NSPredicate(format:"subdept=%@",11)letsubdeptPredicate2=NSPredicate(format:"subdept=%@",12)letandPredicate=NSCom