|
|
@@ -876,11 +876,24 @@ bool CSqlite3::InitFoodtypeData(rapidjson::Value& foodtyperows)
|
|
|
{
|
|
|
//先清空之前的旧数据,重新完整写入新数据
|
|
|
std::string sql = "delete from pos_foodtype;";
|
|
|
- sqlite3_exec(m_db, sql.c_str(), 0, 0, 0);
|
|
|
+ this->ExeSQl(sql);
|
|
|
|
|
|
for (rapidjson::SizeType i = 0; i < foodtyperows.Size(); ++i)
|
|
|
{
|
|
|
- rapidjson::Value& foodinfo = foodtyperows[i];
|
|
|
+ rapidjson::Value& foodtypeinfo = foodtyperows[i];
|
|
|
+
|
|
|
+ std::string type_id = foodtypeinfo["type_id"].GetString();
|
|
|
+ std::string name = foodtypeinfo["name"].GetString();
|
|
|
+ std::string is_shouyinji_show = foodtypeinfo["is_shouyinji_show"].GetString();
|
|
|
+
|
|
|
+ //插入一个商品数据
|
|
|
+ std::string sql = "INSERT INTO pos_foodtype (id,name,is_shouyinji_show) VALUES ('" + type_id + "' ,'" + name + "', '" + is_shouyinji_show + "')";
|
|
|
+
|
|
|
+ bool ret = this->ExeSQl(sql);
|
|
|
+ if (!ret)
|
|
|
+ {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
return true;
|
|
|
@@ -890,11 +903,39 @@ bool CSqlite3::InitFoodpackageData(rapidjson::Value& foodpackagerows)
|
|
|
{
|
|
|
//先清空之前的旧数据,重新完整写入新数据
|
|
|
std::string sql = "delete from pos_foodpackage;";
|
|
|
- sqlite3_exec(m_db, sql.c_str(), 0, 0, 0);
|
|
|
+ this->ExeSQl(sql);
|
|
|
|
|
|
for (rapidjson::SizeType i = 0; i < foodpackagerows.Size(); ++i)
|
|
|
{
|
|
|
rapidjson::Value& foodinfo = foodpackagerows[i];
|
|
|
+
|
|
|
+ std::string id = foodinfo["id"].GetString();
|
|
|
+ std::string shop_id = foodinfo["shop_id"].GetString();
|
|
|
+ std::string name = foodinfo["name"].GetString();
|
|
|
+ std::string price = foodinfo["price"].GetString();
|
|
|
+ std::string tag = foodinfo["tag"].GetString();
|
|
|
+ std::string status = foodinfo["status"].GetString();
|
|
|
+ std::string is_dabao = foodinfo["is_dabao"].GetString();
|
|
|
+ std::string dabao_money = foodinfo["dabao_money"].GetString();
|
|
|
+
|
|
|
+ std::string nature = CLewaimaiJson::JsonToString(foodinfo["nature"]);
|
|
|
+
|
|
|
+ std::string goods_img = foodinfo["goods_img"].GetString();
|
|
|
+ std::string unit = foodinfo["unit"].GetString();
|
|
|
+ std::string supporttype = foodinfo["supporttype"].GetString();
|
|
|
+ std::string is_shouyinji_show = foodinfo["is_shouyinji_show"].GetString();
|
|
|
+ std::string barcode = foodinfo["barcode"].GetString();
|
|
|
+
|
|
|
+ //插入一个商品数据
|
|
|
+ std::string sql = "INSERT INTO pos_foodpackage (id,shop_id,name,price,tag,status,is_dabao,dabao_money,nature,goods_img,unit,supporttype,is_shouyinji_show,barcode) VALUES ('" + id + "' ,'" + shop_id + "','" \
|
|
|
+ + name + "', '" + price + "', '" + tag + "', '" + status + "', '" + is_dabao + "', '" + dabao_money + "', '" + nature + "', '" \
|
|
|
+ + goods_img + "', '" + unit + "', '" + supporttype + "', '" + is_shouyinji_show + "', '" + barcode + "')";
|
|
|
+
|
|
|
+ bool ret = this->ExeSQl(sql);
|
|
|
+ if (!ret)
|
|
|
+ {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
return true;
|