Browse Source

'方案添加类型'

zsf 1 year ago
parent
commit
5f32e04366
2 changed files with 10 additions and 6 deletions
  1. 1 0
      QFD/dbService/ClassSet.h
  2. 9 6
      QFD/dbService/SchemeInfoService.cpp

+ 1 - 0
QFD/dbService/ClassSet.h

@@ -238,6 +238,7 @@ public:
     QString valueStr;  //指标得分
     double score;      //得分
     QString filePath;  //图片地址
+    int type;          //类型0方案1综合效能
 };
 
 /**

+ 9 - 6
QFD/dbService/SchemeInfoService.cpp

@@ -13,9 +13,9 @@ bool SchemeInfoService::AddSchemeInfoList(const QList<SchemaEval *> &schemeList)
         Transaction t(SqlDBHelper::getDatabase());
         for (int i = 0; i < schemeList.length(); i++) {
             SchemaEval *scheme = schemeList.at(i);
-            InsertQuery q      = t.insertInto("t_scheme_info (project_id,name,remark,value_str,score,file_path)");
+            InsertQuery q      = t.insertInto("t_scheme_info (project_id,name,remark,value_str,score,file_path,type)");
             q.values(scheme->engineerId, scheme->name, scheme->remark, scheme->valueStr, scheme->score,
-                     scheme->filePath)
+                     scheme->filePath, scheme->type)
                     .exec();
             t.commit();
         }
@@ -40,15 +40,16 @@ bool SchemeInfoService::DeleteSchemeByEngineerId(int engineerId)
     return ret;
 }
 
-bool SchemeInfoService::QuerySchemeInfoByEngineerId(QList<SchemaEval *> *schemeList, int engineerId)
+bool SchemeInfoService::QuerySchemeInfoByEngineerId(QList<SchemaEval *> *schemeList, int engineerId, int type)
 {
     QSqlDatabase db = SqlDBHelper::getDatabase();
     QSqlQuery query(db);
     bool ret          = false;
     QString selectSql = QString("select id,project_id,name,remark,value_str "
-                                ",score from t_scheme_info where "
-                                " engineer_id =%1 ")
-                                .arg(QString::number(engineerId));
+                                ",score,file_path,type from t_scheme_info where "
+                                " project_id =%1 and type = %2 ")
+                                .arg(QString::number(engineerId))
+                                .arg(type);
     // qDebug() << "sql=" << selectSql;
     if (query.exec(selectSql)) {
         while (query.next()) {
@@ -60,6 +61,8 @@ bool SchemeInfoService::QuerySchemeInfoByEngineerId(QList<SchemaEval *> *schemeL
                 scheme->remark     = query.value(3).toString();
                 scheme->valueStr   = query.value(4).toString();
                 scheme->score      = query.value(5).toDouble();
+                scheme->filePath   = query.value(6).toString();
+                scheme->type       = query.value(7).toInt();
                 schemeList->append(scheme);
             }
             ret = true;