|
@@ -593,7 +593,8 @@ bool CSqlite3::InitPosFoodType()
|
|
|
sql = "CREATE TABLE pos_foodtype(" \
|
|
sql = "CREATE TABLE pos_foodtype(" \
|
|
|
"id CHAR(20) UNIQUE NOT NULL,"\
|
|
"id CHAR(20) UNIQUE NOT NULL,"\
|
|
|
"name CHAR(200) NOT NULL," \
|
|
"name CHAR(200) NOT NULL," \
|
|
|
- "is_shouyinji_show CHAR(100) NOT NULL);";
|
|
|
|
|
|
|
+ "is_shouyinji_show CHAR(100) NOT NULL," \
|
|
|
|
|
+ "tag CHAR(100) NOT NULL);";
|
|
|
|
|
|
|
|
if (sqlite3_prepare_v2(m_db, sql.c_str(), -1, &stmt, NULL) == SQLITE_OK)
|
|
if (sqlite3_prepare_v2(m_db, sql.c_str(), -1, &stmt, NULL) == SQLITE_OK)
|
|
|
{
|
|
{
|
|
@@ -919,9 +920,10 @@ bool CSqlite3::InitFoodtypeData(rapidjson::Value& foodtyperows)
|
|
|
std::string type_id = foodtypeinfo["type_id"].GetString();
|
|
std::string type_id = foodtypeinfo["type_id"].GetString();
|
|
|
std::string name = foodtypeinfo["name"].GetString();
|
|
std::string name = foodtypeinfo["name"].GetString();
|
|
|
std::string is_shouyinji_show = foodtypeinfo["is_shouyinji_show"].GetString();
|
|
std::string is_shouyinji_show = foodtypeinfo["is_shouyinji_show"].GetString();
|
|
|
|
|
+ std::string tag = foodtypeinfo["tag"].GetString();
|
|
|
|
|
|
|
|
//插入一个商品数据
|
|
//插入一个商品数据
|
|
|
- std::string sql = "INSERT INTO pos_foodtype (id,name,is_shouyinji_show) VALUES ('" + type_id + "' ,'" + name + "', '" + is_shouyinji_show + "')";
|
|
|
|
|
|
|
+ std::string sql = "INSERT INTO pos_foodtype (id,name,is_shouyinji_show,tag) VALUES ('" + type_id + "' ,'" + name + "', '" + is_shouyinji_show + "', '" + tag + "')";
|
|
|
|
|
|
|
|
bool ret = this->ExeSQl(sql);
|
|
bool ret = this->ExeSQl(sql);
|
|
|
if (!ret)
|
|
if (!ret)
|
|
@@ -1086,6 +1088,25 @@ bool CSqlite3::DeleteOneFood(std::string food_id)
|
|
|
return true;
|
|
return true;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+bool CSqlite3::AddOneFoodtype(std::string type_id, std::string name, std::string is_shouyinji_show, std::string tag)
|
|
|
|
|
+{
|
|
|
|
|
+ this->ExeSQl("begin;");
|
|
|
|
|
+
|
|
|
|
|
+ //插入一个商品数据
|
|
|
|
|
+ std::string sql = "INSERT INTO pos_foodtype (id,name,is_shouyinji_show,tag) VALUES ('" + type_id + "' ,'" + name + "', '" + is_shouyinji_show + "', '" + tag + "')";
|
|
|
|
|
+
|
|
|
|
|
+ bool ret = this->ExeSQl(sql);
|
|
|
|
|
+ if (!ret)
|
|
|
|
|
+ {
|
|
|
|
|
+ LOG_INFO("商品分类插入失败:");
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ this->ExeSQl("commit;");
|
|
|
|
|
+
|
|
|
|
|
+ return true;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
bool CSqlite3::ExeSQl(std::string sql)
|
|
bool CSqlite3::ExeSQl(std::string sql)
|
|
|
{
|
|
{
|
|
|
char *zErrMsg = 0;
|
|
char *zErrMsg = 0;
|
|
@@ -1157,11 +1178,13 @@ std::vector<CFoodType> CSqlite3::GetFoodtypes(bool is_shouyinji_show)
|
|
|
std::string id = (char*)sqlite3_column_text(stmt, 0);
|
|
std::string id = (char*)sqlite3_column_text(stmt, 0);
|
|
|
std::string name = (char*)sqlite3_column_text(stmt, 1);
|
|
std::string name = (char*)sqlite3_column_text(stmt, 1);
|
|
|
std::string is_shouyinji_show = (char*)sqlite3_column_text(stmt, 2);
|
|
std::string is_shouyinji_show = (char*)sqlite3_column_text(stmt, 2);
|
|
|
|
|
+ std::string tag = (char*)sqlite3_column_text(stmt, 3);
|
|
|
|
|
|
|
|
CFoodType newtype;
|
|
CFoodType newtype;
|
|
|
newtype.id = id;
|
|
newtype.id = id;
|
|
|
newtype.name = name;
|
|
newtype.name = name;
|
|
|
newtype.is_shouyinji_show = is_shouyinji_show;
|
|
newtype.is_shouyinji_show = is_shouyinji_show;
|
|
|
|
|
+ newtype.tag = tag;
|
|
|
|
|
|
|
|
data.push_back(newtype);
|
|
data.push_back(newtype);
|
|
|
}
|
|
}
|
|
@@ -1194,6 +1217,7 @@ bool CSqlite3::GetFoodtypeById(std::string foodtype_id, CFoodType& newFoodType)
|
|
|
newFoodType.id = (char*)sqlite3_column_text(stmt, 0);
|
|
newFoodType.id = (char*)sqlite3_column_text(stmt, 0);
|
|
|
newFoodType.name = (char*)sqlite3_column_text(stmt, 1);
|
|
newFoodType.name = (char*)sqlite3_column_text(stmt, 1);
|
|
|
newFoodType.is_shouyinji_show = (char*)sqlite3_column_text(stmt, 2);
|
|
newFoodType.is_shouyinji_show = (char*)sqlite3_column_text(stmt, 2);
|
|
|
|
|
+ newFoodType.tag = (char*)sqlite3_column_text(stmt, 3);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
sqlite3_finalize(stmt);
|
|
sqlite3_finalize(stmt);
|