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];//@"4028b88150a987080150a987dce5007a"
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];//@"4028b88150a987080150a987dce5007a"
sql=[NSStringstringWithFormat:@"SELECT * FROM %@ WHERE (NAME LIKE '%%%@%%' or CODE LIKE '%%%@%%') AND ENABLED = 1 ORDER BY %@",tableStr,titleStr,titleStr,@"code"];
...
...
@@ -231,9 +231,27 @@
}else{
if(titleStr.length>0){
// 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];
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];
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];
}
}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];
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{
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];