|
|
@@ -11825,7 +11825,7 @@ NSString* gprice = [self get_portfolio_price :appDelegate.contact_id item_id:ite
|
|
|
NSString *orderBy = @"";
|
|
|
switch (sort) {
|
|
|
case 0:{
|
|
|
- orderBy = @"modify_time desc";
|
|
|
+ orderBy = @"p.modify_time desc";
|
|
|
}
|
|
|
break;
|
|
|
case 1:{
|
|
|
@@ -11833,24 +11833,29 @@ NSString* gprice = [self get_portfolio_price :appDelegate.contact_id item_id:ite
|
|
|
}
|
|
|
break;
|
|
|
case 2:{
|
|
|
- orderBy = @"name asc";
|
|
|
+ orderBy = @"p.name asc";
|
|
|
}
|
|
|
break;
|
|
|
case 3:{
|
|
|
- orderBy = @"name desc";
|
|
|
+ orderBy = @"p.name desc";
|
|
|
}
|
|
|
break;
|
|
|
case 4:{
|
|
|
- orderBy = @"description asc";
|
|
|
+ orderBy = @"p.description asc";
|
|
|
}
|
|
|
break;
|
|
|
+ case 5: {
|
|
|
+ orderBy = @"m.default_category asc";
|
|
|
+ }
|
|
|
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
|
|
|
- NSString *sql = [NSString stringWithFormat:@"select p.product_id,p.name,p.description,ifnull(p.sheet_price,'null'),p.sheet_discount,ifnull(p.available_qty,'null'),p.percentage,p.item_id,p.fashion_id,i.url,p.line_note,p.percent from offline_portfolio as p left join model_image as i on i.product_id = p.product_id where i.type = 1 and (p.is_delete is null or p.is_delete = 0) group by p.product_id order by %@ limit %d offset %d;",orderBy,limit,offset];
|
|
|
+// NSString *sql = [NSString stringWithFormat:@"select p.product_id,p.name,p.description,ifnull(p.sheet_price,'null'),p.sheet_discount,ifnull(p.available_qty,'null'),p.percentage,p.item_id,p.fashion_id,i.url,p.line_note,p.percent from offline_portfolio as p left join model_image as i on i.product_id = p.product_id where i.type = 1 and (p.is_delete is null or p.is_delete = 0) group by p.product_id order by %@ limit %d offset %d;",orderBy,limit,offset];
|
|
|
+
|
|
|
+ NSString *sql = [NSString stringWithFormat:@"select * from (select p.product_id,p.name,p.description,ifnull(p.sheet_price,'null'),p.sheet_discount,ifnull(p.available_qty,'null'),p.percentage,p.item_id,p.fashion_id,i.url,p.line_note,p.percent,p.modify_time from offline_portfolio as p left join model_image as i on i.product_id = p.product_id where i.type = 1 and (p.is_delete is null or p.is_delete = 0) group by p.product_id limit %d offset %d) as p left join product as m on p.product_id = m.product_id order by %@;",limit,offset,orderBy];
|
|
|
|
|
|
__block NSMutableDictionary *dic = [NSMutableDictionary dictionary];
|
|
|
|