| | |
| | | #define VSSDEVTBL_MANAGER_H
|
| | |
|
| | | #include "../model/VssDevTbl.h"
|
| | | #include "VssChannelTblDao.h"
|
| | | #include "BaseDao.h"
|
| | | #include "CamDevSqliteDao.h"
|
| | |
|
| | | #define VSSDevTbl_TABLE_NAME "VSSDevTbl"
|
| | |
|
| | |
| | |
|
| | | /** 添加创建一级设备表 keyValuesToAdd 需要添加的列名和列值对map*/
|
| | | mysqlpp::SimpleResult addVssDevTbl(std::map<std::string, std::string>& keyValuesToAdd) {
|
| | | QMutexLocker mutexLocker(&m_mutexVisit);
|
| | | return add(keyValuesToAdd, VSSDevTbl_TABLE_NAME);
|
| | | }
|
| | |
|
| | |
| | |
|
| | | /** 删除创建一级设备表 whereColumnNameValues 列名和列值对条件 */
|
| | | bool deleteVssDevTbl(std::map<std::string, std::string>& whereKeyValues) {
|
| | | QMutexLocker mutexLocker(&m_mutexVisit);
|
| | | vector<map<string, string>> devRowDataList = findList(string("select * from ")
|
| | | + VSSDevTbl_TABLE_NAME + " where 1=1 "
|
| | | + getWhereColumnNameValuePair(whereKeyValues));
|
| | | if (devRowDataList.size() > 0) {
|
| | | auto DevPubID = devRowDataList.at(0)[VssDevTbl_DevPubID];
|
| | | vector<map<string, string>> channelRowDataList = findList(string("select * from ")
|
| | | + VSSChannelTbl_TABLE_NAME + " where 1=1 AND DevPubID='"+DevPubID+"'");
|
| | | for (auto channelRowData : channelRowDataList) {
|
| | | auto ChanPubID = channelRowData[VssChannelTbl_ChanPubID];
|
| | | CamDevSqliteDao::instance()->deleteByColumn(CamDev_cam_dev_id, ChanPubID);
|
| | | }
|
| | | CamDevSqliteDao::instance()->deleteByColumn(CamDev_cam_dev_id, DevPubID);
|
| | | }
|
| | | return del(VSSDevTbl_TABLE_NAME, whereKeyValues);
|
| | | }
|
| | |
|
| | | /** 更新创建一级设备表 keyValuesToUpdate 需要更新的列名和列值对; whereKeyValues 列名和列值条件 */
|
| | | bool updateVssDevTbl(std::map<std::string, std::string>& keyValuesToUpdate,
|
| | | std::map<std::string, std::string>& whereKeyValues) {
|
| | | QMutexLocker mutexLocker(&m_mutexVisit);
|
| | | return update(keyValuesToUpdate, VSSDevTbl_TABLE_NAME, whereKeyValues);
|
| | | }
|
| | |
|
| | |
| | |
|
| | | /** 查询创建一级设备表列表 querySql 要查询的sql语句 */
|
| | | vector<VssDevTbl> findVssDevTblList(string querySql) {
|
| | | QMutexLocker mutexLocker(&m_mutexVisit);
|
| | | vector<VssDevTbl> vssDevTblVec;
|
| | | vector<map<string, string>> rowDatList = findList(querySql);
|
| | | vssDevTblVec.reserve(rowDatList.size());
|
| | |
| | |
|
| | | /** 查询map列表 querySql 要查询的sql语句 */
|
| | | vector<map<string, string>> findMapList(string querySql) {
|
| | | QMutexLocker mutexLocker(&m_mutexVisit);
|
| | | return findList(querySql);
|
| | | }
|
| | |
|
| | | /** 执行sql语句 */
|
| | | bool execute(string sql) {
|
| | | QMutexLocker mutexLocker(&m_mutexVisit);
|
| | | return exec(move(sql));
|
| | | }
|
| | |
|