// NSString *aaa = [NSString stringWithFormat:@"select * from %@ a where enabled = '1' and exists (select 1 from UserWarehouse b where b.warehouseUuid = a.uuid and b.userUuid = '%@' and b.enabled='1')", titleStr,[ICRUserUtil sharedInstance].userId];
// NSString *aaa = [NSString stringWithFormat:@"select * from %@ a where enabled = '1' and exists (select 1 from UserWarehouse b where b.warehouseUuid = a.uuid and b.userUuid = '%@' and b.enabled='1')", titleStr,[ICRUserUtil sharedInstance].userId];
if(self.warehouseType==WareHouseTypeCenter){
sql=[NSStringstringWithFormat:@"SELECT * from %@ a WHERE (NAME LIKE '%%%@%%' or CODE LIKE '%%%@%%') AND enabled = '1' AND isProductCenter = '1'AND EXISTS (SELECT 1 FROM UserWarehouse b WHERE b.warehouseUuid = a.uuid AND b.userUuid = '%@' AND b.enabled='1')",tableStr,titleStr,titleStr,[ICRUserUtilsharedInstance].userId];
sql=[NSStringstringWithFormat:@"SELECT * from %@ a WHERE (NAME LIKE '%%%@%%' or CODE LIKE '%%%@%%') AND enabled = '1' AND isProductCenter != '1'AND EXISTS (SELECT 1 FROM UserWarehouse b WHERE b.warehouseUuid = a.uuid AND b.userUuid = '%@' AND b.enabled='1')",tableStr,titleStr,titleStr,[ICRUserUtilsharedInstance].userId];
}else{
sql=[NSStringstringWithFormat:@"SELECT * from %@ a WHERE (NAME LIKE '%%%@%%' or CODE LIKE '%%%@%%') AND enabled = '1' AND EXISTS (SELECT 1 FROM UserWarehouse b WHERE b.warehouseUuid = a.uuid AND b.userUuid = '%@' AND b.enabled='1')",tableStr,titleStr,titleStr,[ICRUserUtilsharedInstance].userId];
sql=[NSStringstringWithFormat:@"SELECT * from %@ a WHERE (NAME LIKE '%%%@%%' or CODE LIKE '%%%@%%') AND enabled = '1' AND EXISTS (SELECT 1 FROM UserWarehouse b WHERE b.warehouseUuid = a.uuid AND b.userUuid = '%@' AND b.enabled='1')",tableStr,titleStr,titleStr,[ICRUserUtilsharedInstance].userId];
}
}else{
if(self.warehouseType==WareHouseTypeCenter){
sql=[NSStringstringWithFormat:@"select * from %@ a where enabled = '1' AND isProductCenter = '1' and exists (select 1 from UserWarehouse b where b.warehouseUuid = a.uuid and b.userUuid = '%@' and b.enabled='1')",tableStr,[ICRUserUtilsharedInstance].userId];
sql=[NSStringstringWithFormat:@"select * from %@ a where enabled = '1' AND isProductCenter != '1' and exists (select 1 from UserWarehouse b where b.warehouseUuid = a.uuid and b.userUuid = '%@' and b.enabled='1')",tableStr,[ICRUserUtilsharedInstance].userId];
}else{
}else{
sql=[NSStringstringWithFormat:@"select * from %@ a where enabled = '1' and exists (select 1 from UserWarehouse b where b.warehouseUuid = a.uuid and b.userUuid = '%@' and b.enabled='1')",tableStr,[ICRUserUtilsharedInstance].userId];
sql=[NSStringstringWithFormat:@"select * from %@ a where enabled = '1' and exists (select 1 from UserWarehouse b where b.warehouseUuid = a.uuid and b.userUuid = '%@' and b.enabled='1')",tableStr,[ICRUserUtilsharedInstance].userId];