/* * @Description: * @Version: 1.0 * @Autor: lishengyin * @Date: 2022-03-24 15:40:54 * @LastEditors: lishengyin * @LastEditTime: 2022-09-28 14:19:55 */ #ifndef __HISTORYVIDEO_H_ #define __HISTORYVIDEO_H_ #include using namespace std; class HistoryVideo { public: int Id; std::string fileName; std::string UpdateTime; public: HistoryVideo(){} ~HistoryVideo(){} /** * @description: object to sql * @param {*} * @return {*} */ std::string ObjectToSql(){ SqlStream sqlStream("insert into gsdDB.`HistoryVideo` (fileName, UpdateTime,ISDELETE)\ values ('?','?',0)"); sqlStream << fileName << UpdateTime; return (std::string)sqlStream; } /** * @description: json to Object * @param {string&} json * @return {*} */ bool JsonToObject(std::string& json){ rapidjson::Document doc; doc.Parse(json.c_str()); if(!doc.IsObject()){ return false; } // get members const auto end = doc.MemberEnd(); // json_type if(end == doc.FindMember("fileName") || !doc["fileName"].IsString()) { return false; }else{ fileName = doc["fileName"].GetString(); } // json_type if(end == doc.FindMember("UpdateTime") || !doc["UpdateTime"].IsString()) { return false; }else{ UpdateTime = doc["UpdateTime"].GetString(); } return true; } }; #endif