pg-mvc-service 2.0.21 → 2.0.23
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,16 @@ class TableModel {
|
|
|
315
315
|
}
|
|
316
316
|
this.Limit = pageCount;
|
|
317
317
|
this.Offset = (currentPage - 1) * pageCount;
|
|
318
|
+
const tempVars = [...this.vars];
|
|
319
|
+
const tempWhereExpression = [...this.whereExpressions];
|
|
320
|
+
const tempJoinConditions = [...this.joinConditions];
|
|
318
321
|
let sql = ` SELECT ${this.selectExpressions.join(",")} ${this.createSqlFromJoinWhereSortLimit}`;
|
|
319
|
-
|
|
320
|
-
this.vars =
|
|
322
|
+
const data = yield this.executeQuery(sql, this.vars);
|
|
323
|
+
this.vars = tempVars;
|
|
324
|
+
this.whereExpressions = tempWhereExpression;
|
|
325
|
+
this.joinConditions = tempJoinConditions;
|
|
321
326
|
let countSql = ` SELECT COUNT(*) as "count" ${this.createSqlFromJoinWhere}`;
|
|
322
|
-
const
|
|
323
|
-
const countData = yield this.executeQuery(countSql, tempVars);
|
|
327
|
+
const countData = yield this.executeQuery(countSql, this.vars);
|
|
324
328
|
const totalCount = Number(countData.rows[0].count);
|
|
325
329
|
const lastPage = Math.ceil(Number(countData.rows[0].count) / pageCount);
|
|
326
330
|
return {
|
package/package.json
CHANGED
package/src/models/TableModel.ts
CHANGED
|
@@ -370,15 +370,20 @@ export class TableModel {
|
|
|
370
370
|
this.Limit = pageCount;
|
|
371
371
|
this.Offset = (currentPage - 1) * pageCount;
|
|
372
372
|
|
|
373
|
+
|
|
374
|
+
const tempVars = [...this.vars];
|
|
375
|
+
const tempWhereExpression = [...this.whereExpressions];
|
|
376
|
+
const tempJoinConditions = [...this.joinConditions];
|
|
377
|
+
|
|
373
378
|
let sql = ` SELECT ${this.selectExpressions.join(",")} ${this.createSqlFromJoinWhereSortLimit}`;
|
|
374
|
-
|
|
375
|
-
this.vars = []; // ここで初期化しないと、次のクエリで途中の連番になる
|
|
379
|
+
const data = await this.executeQuery(sql, this.vars);
|
|
376
380
|
|
|
381
|
+
this.vars = tempVars;
|
|
382
|
+
this.whereExpressions = tempWhereExpression;
|
|
383
|
+
this.joinConditions = tempJoinConditions;
|
|
377
384
|
let countSql = ` SELECT COUNT(*) as "count" ${this.createSqlFromJoinWhere}`;
|
|
378
|
-
|
|
379
|
-
const data = await this.executeQuery(sql, tempVars);
|
|
380
385
|
|
|
381
|
-
const countData = await this.executeQuery(countSql,
|
|
386
|
+
const countData = await this.executeQuery(countSql, this.vars);
|
|
382
387
|
|
|
383
388
|
const totalCount = Number(countData.rows[0].count);
|
|
384
389
|
const lastPage = Math.ceil(Number(countData.rows[0].count) / pageCount);
|