条件查询

where参数设置

        if([keyisEqualToString:@"where"]) {

            NSError*error;


            NSData*jsonData = [NSJSONSerializationdataWithJSONObject:par[key]options:0error:&error];


            NSString*jsonString = [[NSStringalloc]initWithData:jsonDataencoding:NSUTF8StringEncoding];

            NSString* hString = [jsonString stringByAddingPercentEncodingWithAllowedCharacters:  [NSCharacterSet URLUserAllowedCharacterSet]];

            searchStr = [NSStringstringWithFormat:@"%@=%@",key,hString];

其他参数拼接

else {

            if(searchStr.length==0) {

                searchStr = [NSStringstringWithFormat:@"%@=%@",key,par[key]];

            }else{

                searchStr = [NSStringstringWithFormat:@"%@&%@=%@",searchStr,key,par[key]];

            }

        }

你可能感兴趣的:(条件查询)