Browse Source

'调整返回总数'

zsf 1 year ago
parent
commit
9fd7821ea6
1 changed files with 7 additions and 6 deletions
  1. 7 6
      QFD/dbService/ProjectService.cpp

+ 7 - 6
QFD/dbService/ProjectService.cpp

@@ -238,17 +238,18 @@ bool ProjectService::SelectAllByPage(QList<ProjectInfo *> *projectInfoList, int
                 projectInfo->estimateType      = query.value(11).toString();
                 projectInfoList->append(projectInfo);
             }
+
+            QString selectSqlAll = QString("SELECT * FROM t_project_info where name like %1 ").arg(name);
+            if (query.exec(selectSqlAll)) {
+                query.next();
+                totalPages = query.value(0).toInt();
+            }
+
             ret = true;
         }
     } else {
         qDebug() << query.lastError();
     }
-    QString selectSqlAll = QString("SELECT * FROM t_project_info where name like %1 ").arg(name);
-    if (query.exec(selectSqlAll)) {
-        query.next();
-        int totalCount = query.value(0).toInt();
-        totalPages     = totalCount / pageSize + (totalCount % pageSize == 0 ? 0 : 1);
-    }
 
     return ret;
 }