From adb08adc83dfe9dc5d6170c2322952d77a93c510 Mon Sep 17 00:00:00 2001
From: pansen <pansen626@sina.com>
Date: 星期三, 03 四月 2019 09:54:33 +0800
Subject: [PATCH] Merge branch 'yw.1.2' into yangwu1.3
---
QiaoJiaSystem/DataManagerServer/vss/dao/VssChannelTblDao.h | 385 +++++++++++++++++++++++++++---------------------------
1 files changed, 195 insertions(+), 190 deletions(-)
diff --git a/QiaoJiaSystem/DataManagerServer/vss/dao/VssChannelTblDao.h b/QiaoJiaSystem/DataManagerServer/vss/dao/VssChannelTblDao.h
index 6766be2..ed07dd7 100755
--- a/QiaoJiaSystem/DataManagerServer/vss/dao/VssChannelTblDao.h
+++ b/QiaoJiaSystem/DataManagerServer/vss/dao/VssChannelTblDao.h
@@ -1,190 +1,195 @@
-
-#ifndef VSSCHANNELTBL_MANAGER_H
-#define VSSCHANNELTBL_MANAGER_H
-
-#include "../model/VssChannelTbl.h"
-#include "BaseDao.h"
-
-#define VSSChannelTbl_TABLE_NAME "VSSChannelTbl"
-
-/**
- * 鍒涘缓浜岀骇璁惧琛ㄧ鐞嗙被
- */
-class VssChannelTblDao : public BaseDao {
-private:
- /** 鍒涘缓浜岀骇璁惧琛ㄦ瀯閫犲嚱鏁� */
- VssChannelTblDao() {}
-public:
- /** 鍒涘缓浜岀骇璁惧琛ㄥ崟渚嬫ā寮� */
- static VssChannelTblDao* instance() {
- static VssChannelTblDao instance;
- return &instance;
- }
-
- /** 娣诲姞鍒涘缓浜岀骇璁惧琛� keyValuesToAdd 闇�瑕佹坊鍔犵殑鍒楀悕鍜屽垪鍊煎map*/
- mysqlpp::SimpleResult addVssChannelTbl(std::map<std::string, std::string>& keyValuesToAdd) {
- return add(keyValuesToAdd, VSSChannelTbl_TABLE_NAME);
- }
-
- /** 鍒犻櫎鍒涘缓浜岀骇璁惧琛� whereKey 鍒楀悕锛泈hereValue 鍒楀�� */
- bool deleteByColumn(string whereKey, string whereValue) {
- std::map<std::string, std::string> whereKeyValues;
- whereKeyValues[whereKey] = whereValue;
- return deleteVssChannelTbl(whereKeyValues);
- }
-
- /** 鍒犻櫎鍒涘缓浜岀骇璁惧琛� whereColumnNameValues 鍒楀悕鍜屽垪鍊煎鏉′欢 */
- bool deleteVssChannelTbl(std::map<std::string, std::string>& whereKeyValues) {
- return del(VSSChannelTbl_TABLE_NAME, whereKeyValues);
- }
-
- /** 鏇存柊鍒涘缓浜岀骇璁惧琛� keyValuesToUpdate 闇�瑕佹洿鏂扮殑鍒楀悕鍜屽垪鍊煎锛� whereKeyValues 鍒楀悕鍜屽垪鍊兼潯浠� */
- bool updateVssChannelTbl(std::map<std::string, std::string>& keyValuesToUpdate,
- std::map<std::string, std::string>& whereKeyValues) {
- return update(keyValuesToUpdate, VSSChannelTbl_TABLE_NAME, whereKeyValues);
- }
-
- /** 鏇存柊鍒涘缓浜岀骇璁惧琛� keyValuesToUpdate 闇�瑕佹洿鏂扮殑鍒楀悕鍜屽垪鍊煎锛� whereKeyValues 鍒楀悕鍜屽垪鍊兼潯浠� */
- bool updateVssChannelTbl(std::map<std::string, std::string>& keyValuesToUpdate,
- string whereKey,
- string whereValue) {
- std::map<std::string, std::string> whereKeyValues;
- whereKeyValues[whereKey] = whereValue;
- return update(keyValuesToUpdate, VSSChannelTbl_TABLE_NAME, whereKeyValues);
- }
-
- /** 鏌ヨ鍒涘缓浜岀骇璁惧琛ㄥ垪琛� querySql 瑕佹煡璇㈢殑sql璇彞 */
- vector<VssChannelTbl> findVssChannelTblList(string querySql) {
- vector<VssChannelTbl> vssChannelTblVec;
- vector<map<string, string>> rowDatList = findList(querySql);
- vssChannelTblVec.reserve(rowDatList.size());
- for (auto rowData : rowDatList) {
- vssChannelTblVec.emplace_back(mapToModel(rowData));
- }
- return vssChannelTblVec;
- }
-
- /**鏌ヨ鍒涘缓浜岀骇璁惧琛ㄥ垪琛� whereKeyValues 鍒楀悕鍜屽垪鍊煎鏉′欢 */
- vector<VssChannelTbl> findVssChannelTblList(std::map<std::string, std::string>& whereKeyValues) {
- return findVssChannelTblList(string("select * from ") + VSSChannelTbl_TABLE_NAME + " where 1=1 " + getWhereColumnNameValuePair(whereKeyValues));
- }
-
- /**鏌ヨ鎵�鏈夊垱寤轰簩绾ц澶囪〃鍒楄〃 */
- vector<VssChannelTbl> findAllVssChannelTblList() {
- return findVssChannelTblList(string("select * from ") + VSSChannelTbl_TABLE_NAME + " where 1=1 ");
- }
-
- /** 鏌ヨmap鍒楄〃 querySql 瑕佹煡璇㈢殑sql璇彞 */
- vector<map<string, string>> findMapList(string querySql) {
- return findList(querySql);
- }
-
- /** 鎵цsql璇彞 */
- bool execute(string sql) {
- return exec(move(sql));
- }
-
- /** map杞琺odel绫� */
- VssChannelTbl mapToModel(map<string, string>& rowData) {
- VssChannelTbl vssChannelTbl;
- string IDValue = rowData[VssChannelTbl_ID];
- if (IDValue.length() != 0 && IDValue != "NULL") {
- vssChannelTbl.ID = std::stoi(IDValue);
- }
- string DevPubIDValue = rowData[VssChannelTbl_DevPubID];
- if (DevPubIDValue.length() != 0 && DevPubIDValue != "NULL") {
- vssChannelTbl.DevPubID = DevPubIDValue;
- }
- string NicknameValue = rowData[VssChannelTbl_Nickname];
- if (NicknameValue.length() != 0 && NicknameValue != "NULL") {
- vssChannelTbl.Nickname = NicknameValue;
- }
- string ChanPubIDValue = rowData[VssChannelTbl_ChanPubID];
- if (ChanPubIDValue.length() != 0 && ChanPubIDValue != "NULL") {
- vssChannelTbl.ChanPubID = ChanPubIDValue;
- }
- string AliveValue = rowData[VssChannelTbl_Alive];
- if (AliveValue.length() != 0 && AliveValue != "NULL") {
- vssChannelTbl.Alive = std::stoi(AliveValue);
- }
- string CorpIDValue = rowData[VssChannelTbl_CorpID];
- if (CorpIDValue.length() != 0 && CorpIDValue != "NULL") {
- vssChannelTbl.CorpID = CorpIDValue;
- }
- string ModelValue = rowData[VssChannelTbl_Model];
- if (ModelValue.length() != 0 && ModelValue != "NULL") {
- vssChannelTbl.Model = ModelValue;
- }
- string OwnerValue = rowData[VssChannelTbl_Owner];
- if (OwnerValue.length() != 0 && OwnerValue != "NULL") {
- vssChannelTbl.Owner = OwnerValue;
- }
- string CivilCodeValue = rowData[VssChannelTbl_CivilCode];
- if (CivilCodeValue.length() != 0 && CivilCodeValue != "NULL") {
- vssChannelTbl.CivilCode = CivilCodeValue;
- }
- string AddressValue = rowData[VssChannelTbl_Address];
- if (AddressValue.length() != 0 && AddressValue != "NULL") {
- vssChannelTbl.Address = AddressValue;
- }
- string ParentalValue = rowData[VssChannelTbl_Parental];
- if (ParentalValue.length() != 0 && ParentalValue != "NULL") {
- vssChannelTbl.Parental = std::stoi(ParentalValue);
- }
- string ParentIdValue = rowData[VssChannelTbl_ParentId];
- if (ParentIdValue.length() != 0 && ParentIdValue != "NULL") {
- vssChannelTbl.ParentId = ParentIdValue;
- }
- string IPValue = rowData[VssChannelTbl_IP];
- if (IPValue.length() != 0 && IPValue != "NULL") {
- vssChannelTbl.IP = IPValue;
- }
- string PortValue = rowData[VssChannelTbl_Port];
- if (PortValue.length() != 0 && PortValue != "NULL") {
- vssChannelTbl.Port = std::stoi(PortValue);
- }
- string LongitudeValue = rowData[VssChannelTbl_Longitude];
- if (LongitudeValue.length() != 0 && LongitudeValue != "NULL") {
- vssChannelTbl.Longitude = std::stod(LongitudeValue);
- }
- string LatitudeValue = rowData[VssChannelTbl_Latitude];
- if (LatitudeValue.length() != 0 && LatitudeValue != "NULL") {
- vssChannelTbl.Latitude = std::stod(LatitudeValue);
- }
- string AltitudeValue = rowData[VssChannelTbl_Altitude];
- if (AltitudeValue.length() != 0 && AltitudeValue != "NULL") {
- vssChannelTbl.Altitude = std::stod(AltitudeValue);
- }
- string PTZTypeValue = rowData[VssChannelTbl_PTZType];
- if (PTZTypeValue.length() != 0 && PTZTypeValue != "NULL") {
- vssChannelTbl.PTZType = std::stoi(PTZTypeValue);
- }
- string RoomTypeValue = rowData[VssChannelTbl_RoomType];
- if (RoomTypeValue.length() != 0 && RoomTypeValue != "NULL") {
- vssChannelTbl.RoomType = std::stoi(RoomTypeValue);
- }
- string DirectionTypeValue = rowData[VssChannelTbl_DirectionType];
- if (DirectionTypeValue.length() != 0 && DirectionTypeValue != "NULL") {
- vssChannelTbl.DirectionType = std::stoi(DirectionTypeValue);
- }
- string StreamTypeValue = rowData[VssChannelTbl_StreamType];
- if (StreamTypeValue.length() != 0 && StreamTypeValue != "NULL") {
- vssChannelTbl.StreamType = std::stoi(StreamTypeValue);
- }
- string DMarkerValue = rowData[VssChannelTbl_DMarker];
- if (DMarkerValue.length() != 0 && DMarkerValue != "NULL") {
- vssChannelTbl.DMarker = std::stoi(DMarkerValue);
- }
- string UpdateTimeValue = rowData[VssChannelTbl_UpdateTime];
- if (UpdateTimeValue.length() != 0 && UpdateTimeValue != "NULL") {
- vssChannelTbl.UpdateTime = UpdateTimeValue;
- }
- return vssChannelTbl;
- }
-
-};
-
-
-#endif //VSSCHANNELTBL_MANAGER_H
-
-
+
+#ifndef VSSCHANNELTBL_MANAGER_H
+#define VSSCHANNELTBL_MANAGER_H
+
+#include "../model/VssChannelTbl.h"
+#include "BaseDao.h"
+
+#define VSSChannelTbl_TABLE_NAME "VSSChannelTbl"
+
+/**
+ * 鍒涘缓浜岀骇璁惧琛ㄧ鐞嗙被
+ */
+class VssChannelTblDao : public BaseDao {
+private:
+ /** 鍒涘缓浜岀骇璁惧琛ㄦ瀯閫犲嚱鏁� */
+ VssChannelTblDao() {}
+public:
+ /** 鍒涘缓浜岀骇璁惧琛ㄥ崟渚嬫ā寮� */
+ static VssChannelTblDao* instance() {
+ static VssChannelTblDao instance;
+ return &instance;
+ }
+
+ /** 娣诲姞鍒涘缓浜岀骇璁惧琛� keyValuesToAdd 闇�瑕佹坊鍔犵殑鍒楀悕鍜屽垪鍊煎map*/
+ mysqlpp::SimpleResult addVssChannelTbl(std::map<std::string, std::string>& keyValuesToAdd) {
+ QMutexLocker mutexLocker(&m_mutexVisit);
+ return add(keyValuesToAdd, VSSChannelTbl_TABLE_NAME);
+ }
+
+ /** 鍒犻櫎鍒涘缓浜岀骇璁惧琛� whereKey 鍒楀悕锛泈hereValue 鍒楀�� */
+ bool deleteByColumn(string whereKey, string whereValue) {
+ std::map<std::string, std::string> whereKeyValues;
+ whereKeyValues[whereKey] = whereValue;
+ return deleteVssChannelTbl(whereKeyValues);
+ }
+
+ /** 鍒犻櫎鍒涘缓浜岀骇璁惧琛� whereColumnNameValues 鍒楀悕鍜屽垪鍊煎鏉′欢 */
+ bool deleteVssChannelTbl(std::map<std::string, std::string>& whereKeyValues) {
+ QMutexLocker mutexLocker(&m_mutexVisit);
+ return del(VSSChannelTbl_TABLE_NAME, whereKeyValues);
+ }
+
+ /** 鏇存柊鍒涘缓浜岀骇璁惧琛� keyValuesToUpdate 闇�瑕佹洿鏂扮殑鍒楀悕鍜屽垪鍊煎锛� whereKeyValues 鍒楀悕鍜屽垪鍊兼潯浠� */
+ bool updateVssChannelTbl(std::map<std::string, std::string>& keyValuesToUpdate,
+ std::map<std::string, std::string>& whereKeyValues) {
+ QMutexLocker mutexLocker(&m_mutexVisit);
+ return update(keyValuesToUpdate, VSSChannelTbl_TABLE_NAME, whereKeyValues);
+ }
+
+ /** 鏇存柊鍒涘缓浜岀骇璁惧琛� keyValuesToUpdate 闇�瑕佹洿鏂扮殑鍒楀悕鍜屽垪鍊煎锛� whereKeyValues 鍒楀悕鍜屽垪鍊兼潯浠� */
+ bool updateVssChannelTbl(std::map<std::string, std::string>& keyValuesToUpdate,
+ string whereKey,
+ string whereValue) {
+ std::map<std::string, std::string> whereKeyValues;
+ whereKeyValues[whereKey] = whereValue;
+ return update(keyValuesToUpdate, VSSChannelTbl_TABLE_NAME, whereKeyValues);
+ }
+
+ /** 鏌ヨ鍒涘缓浜岀骇璁惧琛ㄥ垪琛� querySql 瑕佹煡璇㈢殑sql璇彞 */
+ vector<VssChannelTbl> findVssChannelTblList(string querySql) {
+ QMutexLocker mutexLocker(&m_mutexVisit);
+ vector<VssChannelTbl> vssChannelTblVec;
+ vector<map<string, string>> rowDatList = findList(querySql);
+ vssChannelTblVec.reserve(rowDatList.size());
+ for (auto rowData : rowDatList) {
+ vssChannelTblVec.emplace_back(mapToModel(rowData));
+ }
+ return vssChannelTblVec;
+ }
+
+ /**鏌ヨ鍒涘缓浜岀骇璁惧琛ㄥ垪琛� whereKeyValues 鍒楀悕鍜屽垪鍊煎鏉′欢 */
+ vector<VssChannelTbl> findVssChannelTblList(std::map<std::string, std::string>& whereKeyValues) {
+ return findVssChannelTblList(string("select * from ") + VSSChannelTbl_TABLE_NAME + " where 1=1 " + getWhereColumnNameValuePair(whereKeyValues));
+ }
+
+ /**鏌ヨ鎵�鏈夊垱寤轰簩绾ц澶囪〃鍒楄〃 */
+ vector<VssChannelTbl> findAllVssChannelTblList() {
+ return findVssChannelTblList(string("select * from ") + VSSChannelTbl_TABLE_NAME + " where 1=1 ");
+ }
+
+ /** 鏌ヨmap鍒楄〃 querySql 瑕佹煡璇㈢殑sql璇彞 */
+ vector<map<string, string>> findMapList(string querySql) {
+ return findList(querySql);
+ }
+
+ /** 鎵цsql璇彞 */
+ bool execute(string sql) {
+ QMutexLocker mutexLocker(&m_mutexVisit);
+ return exec(move(sql));
+ }
+
+ /** map杞琺odel绫� */
+ VssChannelTbl mapToModel(map<string, string>& rowData) {
+ VssChannelTbl vssChannelTbl;
+ string IDValue = rowData[VssChannelTbl_ID];
+ if (IDValue.length() != 0 && IDValue != "NULL") {
+ vssChannelTbl.ID = std::stoi(IDValue);
+ }
+ string DevPubIDValue = rowData[VssChannelTbl_DevPubID];
+ if (DevPubIDValue.length() != 0 && DevPubIDValue != "NULL") {
+ vssChannelTbl.DevPubID = DevPubIDValue;
+ }
+ string NicknameValue = rowData[VssChannelTbl_Nickname];
+ if (NicknameValue.length() != 0 && NicknameValue != "NULL") {
+ vssChannelTbl.Nickname = NicknameValue;
+ }
+ string ChanPubIDValue = rowData[VssChannelTbl_ChanPubID];
+ if (ChanPubIDValue.length() != 0 && ChanPubIDValue != "NULL") {
+ vssChannelTbl.ChanPubID = ChanPubIDValue;
+ }
+ string AliveValue = rowData[VssChannelTbl_Alive];
+ if (AliveValue.length() != 0 && AliveValue != "NULL") {
+ vssChannelTbl.Alive = std::stoi(AliveValue);
+ }
+ string CorpIDValue = rowData[VssChannelTbl_CorpID];
+ if (CorpIDValue.length() != 0 && CorpIDValue != "NULL") {
+ vssChannelTbl.CorpID = CorpIDValue;
+ }
+ string ModelValue = rowData[VssChannelTbl_Model];
+ if (ModelValue.length() != 0 && ModelValue != "NULL") {
+ vssChannelTbl.Model = ModelValue;
+ }
+ string OwnerValue = rowData[VssChannelTbl_Owner];
+ if (OwnerValue.length() != 0 && OwnerValue != "NULL") {
+ vssChannelTbl.Owner = OwnerValue;
+ }
+ string CivilCodeValue = rowData[VssChannelTbl_CivilCode];
+ if (CivilCodeValue.length() != 0 && CivilCodeValue != "NULL") {
+ vssChannelTbl.CivilCode = CivilCodeValue;
+ }
+ string AddressValue = rowData[VssChannelTbl_Address];
+ if (AddressValue.length() != 0 && AddressValue != "NULL") {
+ vssChannelTbl.Address = AddressValue;
+ }
+ string ParentalValue = rowData[VssChannelTbl_Parental];
+ if (ParentalValue.length() != 0 && ParentalValue != "NULL") {
+ vssChannelTbl.Parental = std::stoi(ParentalValue);
+ }
+ string ParentIdValue = rowData[VssChannelTbl_ParentId];
+ if (ParentIdValue.length() != 0 && ParentIdValue != "NULL") {
+ vssChannelTbl.ParentId = ParentIdValue;
+ }
+ string IPValue = rowData[VssChannelTbl_IP];
+ if (IPValue.length() != 0 && IPValue != "NULL") {
+ vssChannelTbl.IP = IPValue;
+ }
+ string PortValue = rowData[VssChannelTbl_Port];
+ if (PortValue.length() != 0 && PortValue != "NULL") {
+ vssChannelTbl.Port = std::stoi(PortValue);
+ }
+ string LongitudeValue = rowData[VssChannelTbl_Longitude];
+ if (LongitudeValue.length() != 0 && LongitudeValue != "NULL") {
+ vssChannelTbl.Longitude = std::stod(LongitudeValue);
+ }
+ string LatitudeValue = rowData[VssChannelTbl_Latitude];
+ if (LatitudeValue.length() != 0 && LatitudeValue != "NULL") {
+ vssChannelTbl.Latitude = std::stod(LatitudeValue);
+ }
+ string AltitudeValue = rowData[VssChannelTbl_Altitude];
+ if (AltitudeValue.length() != 0 && AltitudeValue != "NULL") {
+ vssChannelTbl.Altitude = std::stod(AltitudeValue);
+ }
+ string PTZTypeValue = rowData[VssChannelTbl_PTZType];
+ if (PTZTypeValue.length() != 0 && PTZTypeValue != "NULL") {
+ vssChannelTbl.PTZType = std::stoi(PTZTypeValue);
+ }
+ string RoomTypeValue = rowData[VssChannelTbl_RoomType];
+ if (RoomTypeValue.length() != 0 && RoomTypeValue != "NULL") {
+ vssChannelTbl.RoomType = std::stoi(RoomTypeValue);
+ }
+ string DirectionTypeValue = rowData[VssChannelTbl_DirectionType];
+ if (DirectionTypeValue.length() != 0 && DirectionTypeValue != "NULL") {
+ vssChannelTbl.DirectionType = std::stoi(DirectionTypeValue);
+ }
+ string StreamTypeValue = rowData[VssChannelTbl_StreamType];
+ if (StreamTypeValue.length() != 0 && StreamTypeValue != "NULL") {
+ vssChannelTbl.StreamType = std::stoi(StreamTypeValue);
+ }
+ string DMarkerValue = rowData[VssChannelTbl_DMarker];
+ if (DMarkerValue.length() != 0 && DMarkerValue != "NULL") {
+ vssChannelTbl.DMarker = std::stoi(DMarkerValue);
+ }
+ string UpdateTimeValue = rowData[VssChannelTbl_UpdateTime];
+ if (UpdateTimeValue.length() != 0 && UpdateTimeValue != "NULL") {
+ vssChannelTbl.UpdateTime = UpdateTimeValue;
+ }
+ return vssChannelTbl;
+ }
+
+};
+
+
+#endif //VSSCHANNELTBL_MANAGER_H
+
+
--
Gitblit v1.8.0