| | |
| | |
|
| | | #define VSSLocalSettingTbl_Sqlite_TABLE_NAME "VSSLocalSettingTbl"
|
| | |
|
| | | #include <qsqlfield.h>
|
| | | /**
|
| | | * 本地国标配置管理类
|
| | | */
|
| | |
| | | }
|
| | |
|
| | | /** 查询本地国标配置列表 querySql 要查询的sql语句 */
|
| | | Json::Value findVssLocalSettingTblList(string querySql) {
|
| | | Json::Value findVssLocalSettingTblList(std::map<std::string, std::string>& whereKeyValues) {
|
| | |
|
| | | Json::Value responseJsonValue;
|
| | | responseJsonValue["message"] = "删除失败!";
|
| | | responseJsonValue["message"] = "查询失败!";
|
| | | responseJsonValue["success"] = "false";
|
| | | responseJsonValue["data"] = "[]";
|
| | | responseJsonValue["data"] = Json::arrayValue;
|
| | |
|
| | | QMutexLocker mutexLocker(m_mutexVisit);//TODO
|
| | | std::list<Record_Cut_Video_info> lst;
|
| | | QSqlTableModel pModel(NULL, *m_db);
|
| | | pModel.setTable(VSSLocalSettingTbl_Sqlite_TABLE_NAME);
|
| | | pModel.setTable(VSSLocalSettingTbl_Sqlite_TABLE_NAME);;
|
| | | for (auto whereKeyValue : whereKeyValues ) {
|
| | | pModel.setFilter(QObject::tr((string(whereKeyValue.first)+" = '%1'").c_str()).arg(QString::fromUtf8(whereKeyValue.second.c_str())));
|
| | | }
|
| | | pModel.setEditStrategy(QSqlTableModel::OnManualSubmit);//OnManualSubmit OnFieldChange
|
| | | pModel.select();
|
| | |
|
| | | int rowCount = pModel.rowCount();
|
| | | if (rowCount > 0) {
|
| | | Json::Value rowDataList;
|
| | | Json::Value rowDataList = Json::arrayValue;
|
| | | for (int i = 0; i < rowCount; ++i) {
|
| | | Json::Value rowData;
|
| | | Json::Value rowData = Json::objectValue;
|
| | | Record_Cut_Video_info lRec;
|
| | | QSqlRecord rec = pModel.record(i);
|
| | | // if (!rec.value("finish_flag").toBool()) {
|
| | | // lRec.n_id = rec.value("id").toInt();
|
| | | // lRec.str_storage_dev_id = rec.value("storage_dev_id").toString();
|
| | | // lRec.n_chn = rec.value("chn").toInt();
|
| | | // lRec.str_src_path = rec.value("src_path").toString();
|
| | | // lRec.str_dst_path = rec.value("dst_path").toString();
|
| | | // lRec.n_total = rec.value("total").toInt();
|
| | | // lRec.b_finish_flag = rec.value("finish_flag").toBool();
|
| | | // lRec.tim_update_time = QDateTime::fromString(rec.value("update_time").toString(),
|
| | | // "yyyy-MM-dd hh:mm:ss");
|
| | | // lRec.str_reserved = rec.value("reserved").toString();
|
| | | // lst.push_back(lRec);
|
| | | // }
|
| | | for (int i = 0; i < rec.count(); i++) {
|
| | | QSqlField field = rec.field(i);
|
| | | rowData[field.name().toStdString()] = field.value().toString().toStdString();
|
| | | }
|
| | | rowDataList.append(rowData);
|
| | | }
|
| | | responseJsonValue["data"] = rowDataList;
|
| | | }
|
| | |
|
| | | responseJsonValue["message"] = "查询成功!";
|
| | | responseJsonValue["success"] = "true";
|
| | | return responseJsonValue;
|
| | |
|
| | |
|
| | |
|
| | |
|
| | | // vector<VssLocalSettingTbl> vssLocalSettingTblVec;
|
| | | // vector<map<string, string>> rowDatList = findList(querySql);
|
| | | // vssLocalSettingTblVec.reserve(rowDatList.size());
|
| | | // for (auto rowData : rowDatList) {
|
| | | // vssLocalSettingTblVec.emplace_back(mapToModel(rowData));
|
| | | // }
|
| | | // return vssLocalSettingTblVec;
|
| | | }
|
| | |
|
| | | /**查询本地国标配置列表 whereKeyValues 列名和列值对条件 */
|
| | | Json::Value findVssLocalSettingTblList(std::map<std::string, std::string>& whereKeyValues) {
|
| | | return findVssLocalSettingTblList(string("select * from ") + VSSLocalSettingTbl_TABLE_NAME + " where 1=1 " + getWhereColumnNameValuePair(whereKeyValues));
|
| | | }
|
| | |
|
| | | /**查询所有本地国标配置列表 */
|
| | | Json::Value findAllVssLocalSettingTblList() {
|
| | | return findVssLocalSettingTblList(string("select * from ") + VSSLocalSettingTbl_TABLE_NAME + " where 1=1 ");
|
| | | std::map<std::string, std::string> whereKeyValues;
|
| | | return findVssLocalSettingTblList(whereKeyValues);
|
| | | }
|
| | |
|
| | | /** 查询map列表 querySql 要查询的sql语句 */
|