| | |
| | | return false; |
| | | } |
| | | |
| | | bool ErlangTool::ErlangDbTool::addPerson(std::string t_tableName, AddFaceData &faceData, FieldValues &fieldValues) { |
| | | // #todo 记得测试中文 |
| | | std::string strSql = getInsertSql(t_tableName, fieldValues); |
| | | fieldValues.clear(); |
| | | fieldValues.insert(make_pair("uuid", faceData.uuid)); |
| | | fieldValues.insert(make_pair("faceUrl", faceData.faceUrl)); |
| | | fieldValues.insert(make_pair("feature", faceData.feature_base64)); |
| | | |
| | | std::string strSqlFea = getInsertSql(t_tableName + "_fea", fieldValues); |
| | | strSql.append(strSqlFea); |
| | | // #todo 记得测试中文 只有人员信息表更新,特征更新暂时没做 |
| | | |
| | | return getExecSqlResult(strSql); |
| | | } |
| | | |
| | | bool ErlangTool::ErlangDbTool::updatePerson(std::string t_tableName, AddFaceData &faceData, FieldValues &fieldValues) { |
| | | // #todo 记得测试中文 |
| | | std::string strSql = getUpdateFaceTableSql(t_tableName, fieldValues); |
| | | // #todo 记得测试中文 只有人员信息表更新,特征更新暂时没做 |
| | | fieldValues.clear(); |
| | | fieldValues.insert(make_pair("uuid", faceData.uuid)); |
| | | fieldValues.insert(make_pair("faceUrl", faceData.faceUrl)); |
| | | |
| | | fieldValues.insert(make_pair("feature", faceData.feature_base64)); |
| | | |
| | | std::string strSqlFea = getInsertSql(t_tableName + "_fea", fieldValues); |
| | | strSql.append(strSqlFea); |
| | | |
| | | return getExecSqlResult(strSql); |
| | | } |
| | |
| | | } |
| | | if (str_tableUuid.size() > 0) { |
| | | QString sql = QString::fromStdString( |
| | | "Select a.uuid as id ,a.faceUrl as img,a.feature,b.idCard as idcard,a.enable from '" + str_tableUuid + |
| | | "Select a.uuid as id ,a.faceUrl as img,a.feature,b.idCard as idcard,a.enable,a.monitorLevel from '" + str_tableUuid + |
| | | "_fea' as a ,'" + str_tableUuid + "' as b where a.uuid = b.uuid and ( a.del_flag=0 AND b.del_flag=0);"); |
| | | QSqlQuery query(g_syncDbFile); |
| | | query.prepare(sql); |
| | |
| | | t_feature_info.feature = query.value(2).toString().toStdString(); |
| | | t_feature_info.idcard = query.value(3).toString().toStdString(); |
| | | t_feature_info.enable = query.value(4).toString().toStdString(); |
| | | t_feature_info.monLevel = query.value(5).toString().toStdString(); |
| | | |
| | | dataCache.insert(std::make_pair(t_feature_info.id, t_feature_info)); |
| | | } |
| | |
| | | } |
| | | if (str_tableUuid.size() > 0) { |
| | | QString sql = QString::fromStdString( |
| | | "Select b.uuid as id,b.faceUrl as img,a.idCard as idcard,a.enable from '" + str_tableUuid + "' as a, '" + |
| | | str_tableUuid + "_fea' As b where a.uuid = b.uuid and ( a.del_flag=0 AND b.del_flag=0);"); |
| | | "Select b.uuid as id,b.faceUrl as img,a.idCard as idcard,a.enable,a.monitorLevel from '" + str_tableUuid + |
| | | "' as a, '" + str_tableUuid + "_fea' As b where a.uuid = b.uuid and ( a.del_flag=0 AND b.del_flag=0);"); |
| | | QSqlQuery query(g_syncDbFile); |
| | | query.prepare(sql); |
| | | if (!query.exec()) { |
| | |
| | | t_feature_info.img = query.value(1).toString().toStdString(); |
| | | t_feature_info.idcard = query.value(2).toString().toStdString(); |
| | | t_feature_info.enable = query.value(3).toString().toStdString(); |
| | | t_feature_info.monLevel = query.value(4).toString().toStdString(); |
| | | |
| | | dataCache.insert(std::make_pair(t_feature_info.id, t_feature_info)); |
| | | } |