NSFetchRequest *request = [[NSFetchRequest alloc] init];
NSEntityDescription *entity = [NSEntityDescription entityForName:@"Order" inManagedObjectContext:managedObjectContext];
[request setEntity:entity];
NSString *str = @:"川菜";
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"dishClass = %@",str];
[request setPredicate:predicate];
NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"dishCount" ascending:NO];
NSArray *sortDescriptors = [[NSArray alloc] initWithObjects:sortDescriptor, nil];
[request setSortDescriptors:sortDescriptors];
NSError *error = nil;
NSMutableArray *mutableFetchResults = [[managedObjectContext executeFetchRequest:request error:&error] mutableCopy];
for (int j = 0;j < mutableFetchResults.count; j++) {
Order *order = [mutableFetchResults objectAtIndex:j];
NSString *name = order.dishName;
NSString *class = order.dishClass;
NSString *count = [NSString stringWithFormat:@"%d",order.dishName];
}