#include "NodeMatrixService.h" #include "SqlDBHelper.h" #include NodeMatrixService::NodeMatrixService(QObject *parent) { } bool NodeMatrixService::AddNodeMatrixInfo(const NodeMatrixInfo &nodeMatrixInfo) { bool ret = false; try { Transaction t(SqlDBHelper::getDatabase()); InsertQuery q = t.insertInto("t_node_matrix_info (expert_name, engineer_id, node, " "abscissa, ordinate, " "node_value, expert_id,mind_name,write_date,mark,str_uuid)"); q.values(nodeMatrixInfo.expertName, nodeMatrixInfo.engineerId, nodeMatrixInfo.node, nodeMatrixInfo.abscissa, nodeMatrixInfo.ordinate, nodeMatrixInfo.nodeValue, nodeMatrixInfo.expertId, nodeMatrixInfo.mindId, nodeMatrixInfo.writeDate.toString(), nodeMatrixInfo.mark, nodeMatrixInfo.strUuid) .exec(); t.commit(); ret = true; } catch (const DBException &ex) { qDebug() << ex.lastError.text(); } return ret; } /*批量节点信息新增*/ bool NodeMatrixService::AddNodeMatrixInfoList(const QList &jbInfoList) { bool ret = false; try { Transaction t(SqlDBHelper::getDatabase()); for (int i = 0; i < jbInfoList.length(); i++) { NodeMatrixInfo *nodeMatrixInfo = jbInfoList.at(i); InsertQuery query = t.insertInto("t_node_matrix_info (expert_name, engineer_id, node, abscissa, " "ordinate, " "node_value, expert_id,mind_id,write_date,mark,table_msg,str_uuid)"); query.values(nodeMatrixInfo->expertName, nodeMatrixInfo->engineerId, nodeMatrixInfo->node, nodeMatrixInfo->abscissa, nodeMatrixInfo->ordinate, nodeMatrixInfo->nodeValue, nodeMatrixInfo->expertId, nodeMatrixInfo->mindId, nodeMatrixInfo->writeDate.toString(), nodeMatrixInfo->mark, nodeMatrixInfo->tableMsg, nodeMatrixInfo->strUuid) .exec(); t.commit(); } ret = true; } catch (const DBException &ex) { qDebug() << ex.lastError.text(); } return ret; } /*批量节点信息新增----专家端*/ bool NodeMatrixService::AddNodeMatrixInfoList2(const QList &jbInfoList) { bool ret = false; try { Transaction t(SqlDBHelper::getDatabase2()); for (int i = 0; i < jbInfoList.length(); i++) { NodeMatrixInfo *nodeMatrixInfo = jbInfoList.at(i); InsertQuery query = t.insertInto("t_node_matrix_info (expert_name, engineer_id, node, abscissa, " "ordinate, " "node_value, expert_id,mind_id,write_date,mark,table_msg,tab_index)"); query.values(nodeMatrixInfo->expertName, nodeMatrixInfo->engineerId, nodeMatrixInfo->node, nodeMatrixInfo->abscissa, nodeMatrixInfo->ordinate, nodeMatrixInfo->nodeValue, nodeMatrixInfo->expertId, nodeMatrixInfo->mindId, nodeMatrixInfo->writeDate.toString(), nodeMatrixInfo->mark, nodeMatrixInfo->tableMsg, nodeMatrixInfo->tabIndex) .exec(); t.commit(); } ret = true; } catch (const DBException &ex) { qDebug() << ex.lastError.text(); } return ret; } /*修改节点值*/ bool NodeMatrixService::UpdateNodeMatrixNodeValue(const NodeMatrixInfo &nodeMatrixInfo) { bool ret = false; try { Transaction t(SqlDBHelper::getDatabase()); t.update("t_node_matrix_info") .set("NODE_VALUE", nodeMatrixInfo.nodeValue) .where("ENGINEER_ID = ? and expert_name = and abscissa = ? and " "ordinate = ? ", nodeMatrixInfo.engineerId, nodeMatrixInfo.expertName, nodeMatrixInfo.abscissa, nodeMatrixInfo.ordinate); t.commit(); ret = true; } catch (const DBException &ex) { qDebug() << ex.lastError.text(); } return ret; } bool NodeMatrixService::UpdateNodeMatrixNodeValueList(const QList jbInfoList) { QSqlDatabase db = SqlDBHelper::getDatabase(); QSqlQuery query(db); bool ret = false; for (int i = 0; i < jbInfoList.length(); i++) { NodeMatrixInfo *nodeMatrixInfo = jbInfoList.at(i); QString updateSql = QString("UPDATE t_node_matrix_info SET NODE_VALUE ='%1' WHERE " "ENGINEER_ID = %2 AND expert_name = '%3'" " AND abscissa = '%4' AND ordinate = '%5' and table_msg = '%6' " "and mark = '%7' and str_uuid = '%8'") .arg(nodeMatrixInfo->nodeValue) .arg(nodeMatrixInfo->engineerId) .arg(nodeMatrixInfo->expertName) .arg(nodeMatrixInfo->abscissa) .arg(nodeMatrixInfo->ordinate) .arg(nodeMatrixInfo->tableMsg) .arg(nodeMatrixInfo->mark) .arg(nodeMatrixInfo->strUuid); // qDebug() << updateSql; query.exec(updateSql); ret = true; } return ret; } bool NodeMatrixService::UpdateNodeMatrixNodeValueList2(const QList jbInfoList) { QSqlDatabase db = SqlDBHelper::getDatabase2(); QSqlQuery query(db); bool ret = false; for (int i = 0; i < jbInfoList.length(); i++) { NodeMatrixInfo *nodeMatrixInfo = jbInfoList.at(i); QString updateSql = QString("UPDATE t_node_matrix_info SET NODE_VALUE ='%1' WHERE " "ENGINEER_ID = %2 AND expert_name = '%3'" " AND abscissa = '%4' AND ordinate = '%5' and table_msg = '%6' " "and mark = '%7' and tab_index = '%8'") .arg(nodeMatrixInfo->nodeValue) .arg(nodeMatrixInfo->engineerId) .arg(nodeMatrixInfo->expertName) .arg(nodeMatrixInfo->abscissa) .arg(nodeMatrixInfo->ordinate) .arg(nodeMatrixInfo->tableMsg) .arg(nodeMatrixInfo->mark) .arg(nodeMatrixInfo->tabIndex); // qDebug() << updateSql; query.exec(updateSql); ret = true; } return ret; } /*根据专家姓名和工程id获取节点信息*/ bool NodeMatrixService::QueryNodeMatrixListByExpertNameAndEngineerId(QString expertName, int engineerId, QString tableMsg, QString mark) { QSqlDatabase db = SqlDBHelper::getDatabase(); QSqlQuery query(db); bool ret = false; QString selectSql = QString("select id,expert_name, engineer_id, node, abscissa, ordinate, " "node_value, expert_id,mind_id,write_date from " "t_node_matrix_info where expert_name " "= '%1' and engineer_id ='%2' and table_msg='%3' and mark = '%4'") .arg(expertName) .arg(QString::number(engineerId)) .arg(tableMsg) .arg(mark); if (query.exec(selectSql)) { if (query.next()) { ret = true; } } else { qDebug() << query.lastError(); } qDebug() << ret; return ret; } /*根据专家姓名和工程id获取节点信息*/ bool NodeMatrixService::QueryNodeMatrixListByExpertIdAndEngineerId(QString expertId, int engineerId, QString tableMsg) { QSqlDatabase db = SqlDBHelper::getDatabase(); QSqlQuery query(db); bool ret = false; QString selectSql = QString("select id,expert_name, engineer_id, node, abscissa, ordinate, " "node_value, expert_id,mind_id,write_date from " "t_node_matrix_info where expert_id " "= '%1' and engineer_id ='%2' and table_msg='%3'") .arg(expertId) .arg(QString::number(engineerId)) .arg(tableMsg); // qDebug() << selectSql; if (query.exec(selectSql)) { if (query.next()) { ret = true; } } else { qDebug() << query.lastError(); } // qDebug() << ret; return ret; } bool NodeMatrixService::QueryNodeMatrixListByExpertNameAndEngineerId(QList *nodeMatrixInfoList, QString expertName, int engineerId) { QSqlDatabase db = SqlDBHelper::getDatabase(); QSqlQuery query(db); bool ret = false; QString selectSql = QString("select id,expert_name, engineer_id, node, abscissa, ordinate, " "node_value, expert_id,mind_id,write_date,mark,str_uuid from " "t_node_matrix_info where expert_name " "= '%1' and engineer_id ='%2'") .arg(expertName) .arg(QString::number(engineerId)); if (query.exec(selectSql)) { while (query.next()) { if (query.isNull(0) == false) { NodeMatrixInfo *nodeMatrixInfo = new NodeMatrixInfo(); nodeMatrixInfo->id = query.value(0).toInt(); nodeMatrixInfo->expertName = query.value(1).toString(); nodeMatrixInfo->engineerId = query.value(2).toInt(); nodeMatrixInfo->node = query.value(3).toString(); nodeMatrixInfo->abscissa = query.value(4).toString(); nodeMatrixInfo->ordinate = query.value(5).toString(); nodeMatrixInfo->nodeValue = query.value(6).toString(); nodeMatrixInfo->expertId = query.value(7).toInt(); nodeMatrixInfo->mindId = query.value(8).toInt(); nodeMatrixInfo->writeDate = query.value(9).toDateTime(); nodeMatrixInfo->mark = query.value(10).toString(); nodeMatrixInfo->strUuid = query.value(11).toString(); nodeMatrixInfoList->append(nodeMatrixInfo); } ret = true; } } else { qDebug() << query.lastError(); } return ret; } bool NodeMatrixService::QueryNodeMatrixListByExpertNameAndEngineerId2(QString expertName, int engineerId, QString tableMsg, QString mark, int tabIndex) { QSqlDatabase db = SqlDBHelper::getDatabase2(); QSqlQuery query(db); bool ret = false; QString selectSql = QString("select id,expert_name, engineer_id, node, abscissa, ordinate, " "node_value, expert_id,mind_id,write_date from " "t_node_matrix_info where expert_name " "= '%1' and engineer_id ='%2' and table_msg='%3' and mark = '%4' and tab_index = '%5'") .arg(expertName) .arg(QString::number(engineerId)) .arg(tableMsg) .arg(mark) .arg(tabIndex); if (query.exec(selectSql)) { if (query.next()) { ret = true; } } else { qDebug() << query.lastError(); } qDebug() << ret; return ret; } bool NodeMatrixService::QueryNodesByExpertNameAndEngineerId2(QList *nodeMatrixInfoList, QString expertName, int engineerId, QString tableMsg, QString mark, int tabIndex) { QSqlDatabase db = SqlDBHelper::getDatabase2(); QSqlQuery query(db); bool ret = false; QString selectSql = QString("select id,expert_name, engineer_id, node, abscissa, ordinate, " "node_value, expert_id,mind_id,write_date,str_uuid from " "t_node_matrix_info where expert_name " "= '%1' and engineer_id ='%2' and table_msg='%3' and mark = '%4' and tab_index = '%5'") .arg(expertName) .arg(QString::number(engineerId)) .arg(tableMsg) .arg(mark) .arg(tabIndex); // qDebug() << "----" << selectSql; if (query.exec(selectSql)) { while (query.next()) { if (query.isNull(0) == false) { NodeMatrixInfo *nodeMatrixInfo = new NodeMatrixInfo(); nodeMatrixInfo->id = query.value(0).toInt(); nodeMatrixInfo->expertName = query.value(1).toString(); nodeMatrixInfo->node = query.value(2).toString(); nodeMatrixInfo->engineerId = query.value(3).toInt(); nodeMatrixInfo->abscissa = query.value(4).toString(); nodeMatrixInfo->ordinate = query.value(5).toString(); nodeMatrixInfo->nodeValue = query.value(6).toString(); nodeMatrixInfo->expertId = query.value(7).toInt(); nodeMatrixInfo->mindId = query.value(8).toInt(); nodeMatrixInfo->writeDate = query.value(9).toDateTime(); nodeMatrixInfo->mark = query.value(10).toString(); nodeMatrixInfo->strUuid = query.value(11).toString(); nodeMatrixInfoList->append(nodeMatrixInfo); } ret = true; } } else { qDebug() << query.lastError(); } qDebug() << ret; return ret; } bool NodeMatrixService::QueryNodeValueByUserIdAndEngineerId(int experId, int engineerId) { QSqlDatabase db = SqlDBHelper::getDatabase(); QSqlQuery query(db); bool ret = false; QString selectSql = QString("select id,expert_name, engineer_id, node, abscissa, ordinate, " "node_value, expert_id,mind_id,write_date from " "t_node_matrix_info where expert_id " "= '%1' and engineer_id ='%2'") .arg(QString::number(experId)) .arg(QString::number(engineerId)); // qDebug() << "selectSql=" << selectSql; if (query.exec(selectSql)) { if (query.next()) { ret = true; } } else { qDebug() << query.lastError(); } return ret; } bool NodeMatrixService::QueryNodeMatrixListByExpertIdAndEngineerId(QList *nodeMatrixInfoList, int expertId, int engineerId, QString tableMsg) { QSqlDatabase db = SqlDBHelper::getDatabase(); QSqlQuery query(db); bool ret = false; QString selectSql = QString("select id,expert_name, engineer_id, node, abscissa, ordinate, " "node_value, expert_id,mind_id,write_date,mark,str_uuid from " "t_node_matrix_info where expert_id " "= '%1' and engineer_id ='%2' and table_msg ='%3'") .arg(QString::number(expertId)) .arg(QString::number(engineerId)) .arg(tableMsg); // qDebug() << "selectSql=" << selectSql; if (query.exec(selectSql)) { while (query.next()) { if (query.isNull(0) == false) { NodeMatrixInfo *nodeMatrixInfo = new NodeMatrixInfo(); nodeMatrixInfo->id = query.value(0).toInt(); nodeMatrixInfo->expertName = query.value(1).toString(); nodeMatrixInfo->engineerId = query.value(2).toInt(); nodeMatrixInfo->node = query.value(3).toString(); nodeMatrixInfo->abscissa = query.value(4).toString(); nodeMatrixInfo->ordinate = query.value(5).toString(); nodeMatrixInfo->nodeValue = query.value(6).toString(); nodeMatrixInfo->expertId = query.value(7).toInt(); nodeMatrixInfo->mindId = query.value(8).toInt(); nodeMatrixInfo->writeDate = query.value(9).toDateTime(); nodeMatrixInfo->mark = query.value(10).toString(); nodeMatrixInfo->strUuid = query.value(11).toString(); nodeMatrixInfoList->append(nodeMatrixInfo); } } ret = true; } else { qDebug() << query.lastError(); } return ret; } bool NodeMatrixService::QueryNodeMatrixListByExpertIdAndEngineerId2(QList *nodeMatrixInfoList, int expertId, int engineerId, QString tableMsg) { QSqlDatabase db = SqlDBHelper::getDatabase2(); QSqlQuery query(db); bool ret = false; QString selectSql = QString("select id,expert_name, engineer_id, node, abscissa, ordinate, " "node_value, expert_id,mind_id,write_date,mark,str_uuid from " "t_node_matrix_info where expert_id " "= '%1' and engineer_id ='%2' and table_msg ='%3'") .arg(QString::number(expertId)) .arg(QString::number(engineerId)) .arg(tableMsg); // qDebug() << "selectSql=" << selectSql; if (query.exec(selectSql)) { while (query.next()) { if (query.isNull(0) == false) { NodeMatrixInfo *nodeMatrixInfo = new NodeMatrixInfo(); nodeMatrixInfo->id = query.value(0).toInt(); nodeMatrixInfo->expertName = query.value(1).toString(); nodeMatrixInfo->engineerId = query.value(2).toInt(); nodeMatrixInfo->node = query.value(3).toString(); nodeMatrixInfo->abscissa = query.value(4).toString(); nodeMatrixInfo->ordinate = query.value(5).toString(); nodeMatrixInfo->nodeValue = query.value(6).toString(); nodeMatrixInfo->expertId = query.value(7).toInt(); nodeMatrixInfo->mindId = query.value(8).toInt(); nodeMatrixInfo->writeDate = query.value(9).toDateTime(); nodeMatrixInfo->mark = query.value(10).toString(); nodeMatrixInfo->strUuid = query.value(11).toString(); nodeMatrixInfoList->append(nodeMatrixInfo); } ret = true; } } else { qDebug() << query.lastError(); } return ret; } /*根据专家姓名查询对应的节点信息*/ bool NodeMatrixService::QueryNodeMatrixListByExpertName(QList *nodeMatrixInfoList, QString expertName) { QSqlDatabase db = SqlDBHelper::getDatabase(); QSqlQuery query(db); bool ret = false; QString selectSql = QString("select id,expert_name, node,engineer_id, abscissa, ordinate, " "node_value, expert_id,mind_name,write_date,mark ,str_uuid from " "t_node_matrix_info where expert_name = '%1'") .arg(expertName); if (query.exec(selectSql)) { while (query.next()) { if (query.isNull(0) == false) { NodeMatrixInfo *nodeMatrixInfo = new NodeMatrixInfo(); nodeMatrixInfo->id = query.value(0).toInt(); nodeMatrixInfo->expertName = query.value(1).toString(); nodeMatrixInfo->node = query.value(2).toString(); nodeMatrixInfo->engineerId = query.value(3).toInt(); nodeMatrixInfo->abscissa = query.value(4).toString(); nodeMatrixInfo->ordinate = query.value(5).toString(); nodeMatrixInfo->nodeValue = query.value(6).toString(); nodeMatrixInfo->expertId = query.value(7).toInt(); nodeMatrixInfo->mindId = query.value(8).toInt(); nodeMatrixInfo->writeDate = query.value(9).toDateTime(); nodeMatrixInfo->mark = query.value(10).toString(); nodeMatrixInfo->strUuid = query.value(11).toString(); nodeMatrixInfoList->append(nodeMatrixInfo); } ret = true; } } else { qDebug() << query.lastError(); } return ret; } /*根据专家姓名编号对应的节点信息*/ bool NodeMatrixService::QueryNodeMatrixListByExpertId(QList *nodeMatrixInfoList, int expertId) { QSqlDatabase db = SqlDBHelper::getDatabase(); QSqlQuery query(db); bool ret = false; QString selectSql = QString("select id,expert_name, node,engineer_id, abscissa, ordinate, " "node_value, expert_id,mind_name,write_date,mark,str_uuid from " "t_node_matrix_info where expert_id = '%1'") .arg(expertId); if (query.exec(selectSql)) { while (query.next()) { if (query.isNull(0) == false) { NodeMatrixInfo *nodeMatrixInfo = new NodeMatrixInfo(); nodeMatrixInfo->id = query.value(0).toInt(); nodeMatrixInfo->expertName = query.value(1).toString(); nodeMatrixInfo->node = query.value(2).toString(); nodeMatrixInfo->engineerId = query.value(3).toInt(); nodeMatrixInfo->abscissa = query.value(4).toString(); nodeMatrixInfo->ordinate = query.value(5).toString(); nodeMatrixInfo->nodeValue = query.value(6).toString(); nodeMatrixInfo->expertId = query.value(7).toInt(); nodeMatrixInfo->mindId = query.value(8).toInt(); nodeMatrixInfo->writeDate = query.value(9).toDateTime(); nodeMatrixInfo->mark = query.value(10).toString(); nodeMatrixInfo->strUuid = query.value(11).toString(); nodeMatrixInfoList->append(nodeMatrixInfo); } ret = true; } } else { qDebug() << query.lastError(); } return ret; } /*根据工程编号查询对应的节点信息*/ bool NodeMatrixService::QueryNodeMatrixListByEngineerId(QList *nodeMatrixInfoList, int engineerId) { QSqlDatabase db = SqlDBHelper::getDatabase(); QSqlQuery query(db); bool ret = false; QString selectSql = QString("select id,expert_name, node, engineer_id, abscissa, ordinate, " "node_value, expert_id ,mind_name,write_date,mark,str_uuid from " "t_node_matrix_info where engineer_id = '%1'") .arg(engineerId); if (query.exec(selectSql)) { while (query.next()) { if (query.isNull(0) == false) { NodeMatrixInfo *nodeMatrixInfo = new NodeMatrixInfo(); nodeMatrixInfo->id = query.value(0).toInt(); nodeMatrixInfo->expertName = query.value(1).toString(); nodeMatrixInfo->node = query.value(2).toString(); nodeMatrixInfo->engineerId = query.value(3).toInt(); nodeMatrixInfo->abscissa = query.value(4).toString(); nodeMatrixInfo->ordinate = query.value(5).toString(); nodeMatrixInfo->nodeValue = query.value(6).toString(); nodeMatrixInfo->expertId = query.value(7).toInt(); nodeMatrixInfo->mindId = query.value(8).toInt(); nodeMatrixInfo->writeDate = query.value(9).toDateTime(); nodeMatrixInfo->mark = query.value(10).toString(); nodeMatrixInfo->strUuid = query.value(11).toString(); nodeMatrixInfoList->append(nodeMatrixInfo); } ret = true; } } else { qDebug() << query.lastError(); } return ret; } /*根据工程编号删除对应的节点信息*/ bool NodeMatrixService::DeleteNodeMatrixListByEngineerId(int engineerId) { bool ret = false; try { Transaction t(SqlDBHelper::getDatabase()); t.deleteFrom("t_node_matrix_info").where("engineer_id = ?", engineerId); t.commit(); ret = true; } catch (const DBException &ex) { qDebug() << ex.lastError.text(); } return ret; } /*根据专家名称删除对应的节点信息*/ bool NodeMatrixService::DeleteNodeMatrixListByExpertName(QString expertName) { bool ret = false; try { Transaction t(SqlDBHelper::getDatabase()); t.deleteFrom("t_node_matrix_info").where("expert_name = ?", expertName); t.commit(); ret = true; } catch (const DBException &ex) { qDebug() << ex.lastError.text(); } return ret; } /*根据专家编号删除对应的节点信息*/ bool NodeMatrixService::DeleteNodeMatrixListByExpertId(int expertId) { bool ret = false; try { Transaction t(SqlDBHelper::getDatabase()); t.deleteFrom("t_node_matrix_info").where("expert_id = ?", expertId); t.commit(); ret = true; } catch (const DBException &ex) { qDebug() << ex.lastError.text(); } return ret; } bool NodeMatrixService::QueryMeaureDataByProjectAndIndex(QList *dataList, QString index, int projId) { return QueryDataByProjectAndIndex(dataList, index, projId, 1); } bool NodeMatrixService::QueryExpertDataByProjectAndIndex(QList *dataList, QString index, int projId) { return QueryDataByProjectAndIndex(dataList, index, projId, 0); } bool NodeMatrixService::QueryDataByProjectAndIndex(QList *dataList, QString index, int projId, int dataSource) { QSqlDatabase db = SqlDBHelper::getDatabase(); QSqlQuery query(db); bool ret = false; QString selectSql = QString("select id,expert_name, engineer_id, node, abscissa, ordinate, " "node_value, expert_id,mind_id,write_date,mark,str_uuid,table_msg from " "t_node_matrix_info where mind_id = '%1' and engineer_id ='%2' and table_msg ='%3'") .arg(dataSource) .arg(QString::number(projId)) .arg(index); // qDebug() << "selectSql=" << selectSql; if (query.exec(selectSql)) { while (query.next()) { if (query.isNull(0) == false) { NodeMatrixInfo *nodeMatrixInfo = new NodeMatrixInfo(); nodeMatrixInfo->id = query.value(0).toInt(); nodeMatrixInfo->expertName = query.value(1).toString(); nodeMatrixInfo->engineerId = query.value(2).toInt(); nodeMatrixInfo->node = query.value(3).toString(); nodeMatrixInfo->abscissa = query.value(4).toString(); nodeMatrixInfo->ordinate = query.value(5).toString(); nodeMatrixInfo->nodeValue = query.value(6).toString(); nodeMatrixInfo->expertId = query.value(7).toString(); nodeMatrixInfo->mindId = query.value(8).toInt(); nodeMatrixInfo->writeDate = query.value(9).toDateTime(); nodeMatrixInfo->mark = query.value(10).toString(); nodeMatrixInfo->strUuid = query.value(11).toString(); nodeMatrixInfo->tableMsg = query.value(12).toString(); dataList->append(nodeMatrixInfo); } } ret = true; } else { qDebug() << query.lastError(); } return ret; } bool NodeMatrixService::UpdateMeasureData(const NodeMatrixInfo &info) { bool ret = false; try { Transaction t(SqlDBHelper::getDatabase()); if (info.ordinate.length() > 0) { t.update("t_node_matrix_info") .set("node_value", info.nodeValue) .where("mind_id = 1 and engineer_id = ? and table_msg = ? and str_uuid = ? and abscissa = ? and " "ordinate = ?", info.engineerId, info.tableMsg, info.strUuid, info.abscissa, info.ordinate); } else { t.update("t_node_matrix_info") .set("node_value", info.nodeValue) .where("engineer_id = ? and table_msg = ? and str_uuid = ? and abscissa = ?", info.engineerId, info.tableMsg, info.strUuid, info.abscissa); } t.commit(); ret = true; } catch (const DBException &ex) { qDebug() << ex.lastError.text(); } return ret; } bool NodeMatrixService::deleteMeasureData(int projId, QString index, QString uuid) { bool ret = false; try { Transaction t(SqlDBHelper::getDatabase()); t.deleteFrom("t_node_matrix_info") .where("engineer_id = ? and table_msg = ? and str_uuid = ?", projId, index, uuid); t.commit(); ret = true; } catch (const DBException &ex) { qDebug() << ex.lastError.text(); } return ret; } bool NodeMatrixService::deleteExpertData(int projId, int expertId) { bool ret = false; try { Transaction t(SqlDBHelper::getDatabase()); t.deleteFrom("t_node_matrix_info").where("engineer_id = ? and expert_id = ?", projId, expertId); t.commit(); ret = true; } catch (const DBException &ex) { qDebug() << ex.lastError.text(); } return ret; } bool NodeMatrixService::hasMeasureData(int projId, QString index) { QSqlDatabase db = SqlDBHelper::getDatabase(); QSqlQuery query(db); bool ret = false; QString selectSql = QString("select id,expert_name, engineer_id, node, abscissa, ordinate, " "node_value, expert_id,mind_id,write_date,mark,str_uuid,table_msg from " "t_node_matrix_info where mind_id = 1 and engineer_id ='%1' and table_msg ='%2'") .arg(QString::number(projId)) .arg(index); // qDebug() << "selectSql=" << selectSql; if (query.exec(selectSql)) { if (query.next()) { ret = true; } } else { qDebug() << query.lastError(); } return ret; } bool NodeMatrixService::hasExpertData(int projId, QString index, int expertId) { QSqlDatabase db = SqlDBHelper::getDatabase(); QSqlQuery query(db); bool ret = false; QString selectSql = QString("select id,expert_name, engineer_id, node, abscissa, ordinate, " "node_value, expert_id,mind_id,write_date,mark,str_uuid,table_msg from " "t_node_matrix_info where expert_id = '%1' and engineer_id ='%2' and table_msg ='%3'") .arg(QString::number(expertId)) .arg(QString::number(projId)) .arg(index); // qDebug() << "selectSql=" << selectSql; if (query.exec(selectSql)) { if (query.next()) { ret = true; } } else { qDebug() << query.lastError(); } return ret; }