pg-mvc-service 2.0.21 → 2.0.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -315,12 +315,14 @@ class TableModel {
|
|
|
315
315
|
}
|
|
316
316
|
this.Limit = pageCount;
|
|
317
317
|
this.Offset = (currentPage - 1) * pageCount;
|
|
318
|
+
const tempWhereExpression = [...this.whereExpressions];
|
|
319
|
+
const tempJoinConditions = [...this.joinConditions];
|
|
318
320
|
let sql = ` SELECT ${this.selectExpressions.join(",")} ${this.createSqlFromJoinWhereSortLimit}`;
|
|
319
|
-
|
|
320
|
-
this.
|
|
321
|
+
const data = yield this.executeQuery(sql, this.vars);
|
|
322
|
+
this.whereExpressions = tempWhereExpression;
|
|
323
|
+
this.joinConditions = tempJoinConditions;
|
|
321
324
|
let countSql = ` SELECT COUNT(*) as "count" ${this.createSqlFromJoinWhere}`;
|
|
322
|
-
const
|
|
323
|
-
const countData = yield this.executeQuery(countSql, tempVars);
|
|
325
|
+
const countData = yield this.executeQuery(countSql, this.vars);
|
|
324
326
|
const totalCount = Number(countData.rows[0].count);
|
|
325
327
|
const lastPage = Math.ceil(Number(countData.rows[0].count) / pageCount);
|
|
326
328
|
return {
|
package/package.json
CHANGED
package/src/models/TableModel.ts
CHANGED
|
@@ -370,15 +370,19 @@ export class TableModel {
|
|
|
370
370
|
this.Limit = pageCount;
|
|
371
371
|
this.Offset = (currentPage - 1) * pageCount;
|
|
372
372
|
|
|
373
|
+
|
|
374
|
+
const tempWhereExpression = [...this.whereExpressions];
|
|
375
|
+
const tempJoinConditions = [...this.joinConditions];
|
|
376
|
+
|
|
373
377
|
let sql = ` SELECT ${this.selectExpressions.join(",")} ${this.createSqlFromJoinWhereSortLimit}`;
|
|
374
|
-
|
|
375
|
-
this.vars = []; // ここで初期化しないと、次のクエリで途中の連番になる
|
|
378
|
+
const data = await this.executeQuery(sql, this.vars);
|
|
376
379
|
|
|
380
|
+
|
|
381
|
+
this.whereExpressions = tempWhereExpression;
|
|
382
|
+
this.joinConditions = tempJoinConditions;
|
|
377
383
|
let countSql = ` SELECT COUNT(*) as "count" ${this.createSqlFromJoinWhere}`;
|
|
378
|
-
|
|
379
|
-
const data = await this.executeQuery(sql, tempVars);
|
|
380
384
|
|
|
381
|
-
const countData = await this.executeQuery(countSql,
|
|
385
|
+
const countData = await this.executeQuery(countSql, this.vars);
|
|
382
386
|
|
|
383
387
|
const totalCount = Number(countData.rows[0].count);
|
|
384
388
|
const lastPage = Math.ceil(Number(countData.rows[0].count) / pageCount);
|