From 17675f1c6447b6e014b520608ce6d5f1f2e9707a Mon Sep 17 00:00:00 2001 From: xuxiuxi <554325746@qq.com> Date: 星期一, 04 三月 2019 16:28:42 +0800 Subject: [PATCH] add models, daos and controllers for tables. --- QiaoJiaSystem/VideoServer/QiaoJia/DB/LDBTool.cpp | 37 +++++++++++++++++++++++++++++++++++++ QiaoJiaSystem/VideoServer/QiaoJia/DB/LDBTool.h | 1 + 2 files changed, 38 insertions(+), 0 deletions(-) diff --git a/QiaoJiaSystem/VideoServer/QiaoJia/DB/LDBTool.cpp b/QiaoJiaSystem/VideoServer/QiaoJia/DB/LDBTool.cpp index 8b8a3e1..42f22eb 100644 --- a/QiaoJiaSystem/VideoServer/QiaoJia/DB/LDBTool.cpp +++ b/QiaoJiaSystem/VideoServer/QiaoJia/DB/LDBTool.cpp @@ -2732,3 +2732,40 @@ return ruleMap; } + + +/** + * type 0 rtsp, 1 gb28181 + */ +std::list<Record_Cam_Dev> LDBTool::searchCamDevTableByType(int type) { + QMutexLocker mutexLocker(&m_mutexVisit);//TODO + std::list<Record_Cam_Dev> lst; + QSqlTableModel pModel(NULL, m_db); + pModel.setTable("cam_dev"); + pModel.setFilter(QObject::tr((string("cam_dev_id != '' and cam_dev_id is not null and type='")+to_string(type)+"'").c_str())); + pModel.setEditStrategy(QSqlTableModel::OnManualSubmit);//OnManualSubmit OnFieldChange + pModel.select(); + + int rowCount = pModel.rowCount(); + if (rowCount > 0) { + for (int i = 0; i < rowCount; ++i) { + Record_Cam_Dev lChannelRec; + QSqlRecord rec = pModel.record(i); + lChannelRec.n_id = rec.value("id").toInt(); + lChannelRec.str_cam_dev_id = rec.value("cam_dev_id").toString(); + lChannelRec.str_name = rec.value("name").toString(); + lChannelRec.str_addr = rec.value("addr").toString(); + lChannelRec.str_longitude = rec.value("longitude").toString(); + lChannelRec.str_latitude = rec.value("latitude").toString(); + lChannelRec.str_ip = rec.value("ip").toString(); + lChannelRec.n_port = rec.value("port").toInt(); + lChannelRec.str_username = rec.value("username").toString(); + lChannelRec.str_password = rec.value("password").toString(); + lChannelRec.str_brand = rec.value("brand").toString(); + lChannelRec.str_reserved = rec.value("reserved").toString(); + lst.push_back(lChannelRec); + } + } + + return lst; +} \ No newline at end of file diff --git a/QiaoJiaSystem/VideoServer/QiaoJia/DB/LDBTool.h b/QiaoJiaSystem/VideoServer/QiaoJia/DB/LDBTool.h index d4c26bd..eb53d1c 100644 --- a/QiaoJiaSystem/VideoServer/QiaoJia/DB/LDBTool.h +++ b/QiaoJiaSystem/VideoServer/QiaoJia/DB/LDBTool.h @@ -50,6 +50,7 @@ bool deleteCamDevandSdkByCamID(QString strCamId); bool updateCamDevTable(Record_Cam_Dev camRec); std::list<Record_Cam_Dev> searchCamDevTableAll(void); + std::list<Record_Cam_Dev> searchCamDevTableByType(int type); int searchCamDevNumber(void); bool searchCamDevByCamId(QString strCamId); bool updateCamDevSnapshot(const QString& strIp ,const QString& imgUrl); -- Gitblit v1.8.0