|
@@ -59,7 +59,9 @@ bool SchemeProcessService::QueryAllByProjectIdAndIndexType(
|
|
|
bool ret = false;
|
|
|
QString selectSql = QString("SELECT `id`, `project_id`, `index_type`, `step`, `type`, `data_source`, "
|
|
|
"`algorithm`, `efficiency_grades`, `is_checked` FROM "
|
|
|
- "t_scheme_process_info where project_id = %1 and index_type =%2 order by step ");
|
|
|
+ "t_scheme_process_info where project_id = %1 and index_type =%2 order by step ")
|
|
|
+ .arg(projectId)
|
|
|
+ .arg(indexType);
|
|
|
if (query.exec(selectSql)) {
|
|
|
while (query.next()) {
|
|
|
if (query.isNull(0) == false) {
|
|
@@ -98,3 +100,29 @@ bool SchemeProcessService::DeleteById(int id)
|
|
|
}
|
|
|
return ret;
|
|
|
}
|
|
|
+
|
|
|
+bool SchemeProcessService::AddAllSchemeProcess(QList<SchemePlanManager::SchemeProcessInfo> &schemeProcessInfos)
|
|
|
+{
|
|
|
+ int ret = false;
|
|
|
+ try {
|
|
|
+ foreach (const SchemePlanManager::SchemeProcessInfo &schemeProcessInfo, schemeProcessInfos) {
|
|
|
+ Transaction t(SqlDBHelper::getDatabase());
|
|
|
+ InsertQuery query =
|
|
|
+ t.insertInto("t_scheme_process_info(`project_id`, `index_type`, `step`, `type`, "
|
|
|
+ "`data_source`, `algorithm`,`efficiency_grades`, `is_checked`, `create_time`)");
|
|
|
+
|
|
|
+ NonQueryResult result =
|
|
|
+ query.values(schemeProcessInfo.projectId, schemeProcessInfo.indexType, schemeProcessInfo.step,
|
|
|
+ schemeProcessInfo.type, schemeProcessInfo.dSource, schemeProcessInfo.algorithm,
|
|
|
+ schemeProcessInfo.efficiencyGrades, schemeProcessInfo.isChecked,
|
|
|
+ QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss"))
|
|
|
+ .exec();
|
|
|
+ t.commit();
|
|
|
+ }
|
|
|
+
|
|
|
+ ret = true;
|
|
|
+ } catch (const DBException &ex) {
|
|
|
+ qDebug() << ex.lastError.text();
|
|
|
+ }
|
|
|
+ return ret;
|
|
|
+}
|