Explorar o código

修改 model_category_img : model_name: db: 方法中sql 查询 以条件product_id -> item_id,增加条件为空值判断

Pen Li %!s(int64=9) %!d(string=hai) anos
pai
achega
883ede716d

BIN=BIN
RedAnt ERP Mobile/RedAnt ERP Mobile.xcworkspace/xcuserdata/macmini1.xcuserdatad/UserInterfaceState.xcuserstate


+ 3 - 3
RedAnt ERP Mobile/common/Functions/offline/OLDataProvider.m

@@ -639,10 +639,10 @@
     NSString *sqlQuery = nil;
     NSString *sqlQuery = nil;
     //select url,type from model_image where product_id=%d and type=1 order by default_img desc , _id asc limit 1;",product_id
     //select url,type from model_image where product_id=%d and type=1 order by default_img desc , _id asc limit 1;",product_id
     
     
-    if(product_id==nil)
+    if(product_id==nil && model_name)
         sqlQuery = [NSString stringWithFormat:@"select i.url from product m LEFT join model_image i on m.product_id = i.product_id  where m.name=%@ order by i.default_img desc, i._id asc limit 1;",model_name];// select i.url from model m LEFT join model_image i on m.product_id = i.product_id  where m.name=%@ order by i.default_img desc, i._id asc limit 1;
         sqlQuery = [NSString stringWithFormat:@"select i.url from product m LEFT join model_image i on m.product_id = i.product_id  where m.name=%@ order by i.default_img desc, i._id asc limit 1;",model_name];// select i.url from model m LEFT join model_image i on m.product_id = i.product_id  where m.name=%@ order by i.default_img desc, i._id asc limit 1;
-    else
-        sqlQuery = [NSString stringWithFormat:@"select i.url from product m LEFT join model_image i on m.product_id = i.product_id  where m.product_id=%@ order by i.default_img desc, i._id asc limit 1;",product_id];// select i.url from model m
+    else if (product_id)
+        sqlQuery = [NSString stringWithFormat:@"select i.url from product m LEFT join model_image i on m.product_id = i.product_id  where m.item_id=%@ order by i.default_img desc, i._id asc limit 1;",product_id];// select i.url from model m
     
     
     sqlite3_stmt * statement;
     sqlite3_stmt * statement;