|
|
@@ -1030,4 +1030,67 @@ std::vector<CFoodType> CSqlite3::GetFoodtypes(bool is_shouyinji_show)
|
|
|
}
|
|
|
|
|
|
return data;
|
|
|
+}
|
|
|
+
|
|
|
+std::vector<CFood> CSqlite3::GetFoodByTypeid(std::string type_id, bool is_shouyinji_show)
|
|
|
+{
|
|
|
+ std::vector<CFood> data;
|
|
|
+
|
|
|
+ std::string sql;
|
|
|
+
|
|
|
+ if (is_shouyinji_show)
|
|
|
+ {
|
|
|
+ sql = "SELECT * FROM pos_food WHERE status='NORMAL' and is_shouyinji_show = '1';";
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ sql = "SELECT * FROM pos_food WHERE status='NORMAL';";
|
|
|
+ }
|
|
|
+
|
|
|
+ sqlite3_stmt * stmt = NULL;
|
|
|
+
|
|
|
+ if (sqlite3_prepare_v2(m_db, sql.c_str(), -1, &stmt, NULL) == SQLITE_OK)
|
|
|
+ {
|
|
|
+ while (sqlite3_step(stmt) == SQLITE_ROW)
|
|
|
+ {
|
|
|
+ CFood newFood;
|
|
|
+
|
|
|
+ newFood.id = (char*)sqlite3_column_text(stmt, 0);
|
|
|
+ newFood.shop_id = (char*)sqlite3_column_text(stmt, 1);
|
|
|
+ newFood.name = (char*)sqlite3_column_text(stmt, 2);
|
|
|
+ newFood.price = (char*)sqlite3_column_text(stmt, 3);
|
|
|
+ newFood.tag = (char*)sqlite3_column_text(stmt, 4);
|
|
|
+ newFood.status = (char*)sqlite3_column_text(stmt, 5);
|
|
|
+ newFood.type_id = (char*)sqlite3_column_text(stmt, 6);
|
|
|
+ newFood.is_dabao = (char*)sqlite3_column_text(stmt, 7);
|
|
|
+ newFood.dabao_money = (char*)sqlite3_column_text(stmt, 8);
|
|
|
+ newFood.is_nature = (char*)sqlite3_column_text(stmt, 9);
|
|
|
+ newFood.nature = (char*)sqlite3_column_text(stmt, 10);
|
|
|
+ newFood.autostocknum = (char*)sqlite3_column_text(stmt, 11);
|
|
|
+ newFood.goods_img = (char*)sqlite3_column_text(stmt, 12);
|
|
|
+ newFood.unit = (char*)sqlite3_column_text(stmt, 13);
|
|
|
+ newFood.barcode = (char*)sqlite3_column_text(stmt, 14);
|
|
|
+ newFood.member_price_used = (char*)sqlite3_column_text(stmt, 15);
|
|
|
+ newFood.member_price = (char*)sqlite3_column_text(stmt, 16);
|
|
|
+ newFood.buying_price = (char*)sqlite3_column_text(stmt, 17);
|
|
|
+ newFood.stock = (char*)sqlite3_column_text(stmt,18);
|
|
|
+ newFood.stockvalid = (char*)sqlite3_column_text(stmt, 19);
|
|
|
+ newFood.stock_warning = (char*)sqlite3_column_text(stmt, 20);
|
|
|
+ newFood.is_shouyinji_show = (char*)sqlite3_column_text(stmt, 21);
|
|
|
+ newFood.expiration_date = (char*)sqlite3_column_text(stmt, 22);
|
|
|
+ newFood.is_weight = (char*)sqlite3_column_text(stmt, 23);
|
|
|
+ newFood.member_price_json = (char*)sqlite3_column_text(stmt, 24);
|
|
|
+
|
|
|
+ data.push_back(newFood);
|
|
|
+ }
|
|
|
+
|
|
|
+ sqlite3_finalize(stmt);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ //Òì³£Çé¿ö
|
|
|
+ sqlite3_finalize(stmt);
|
|
|
+ }
|
|
|
+
|
|
|
+ return data;
|
|
|
}
|