123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- /*
- * @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 <iostream>
- 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
|