pg-mvc-service 2.0.11 → 2.0.12
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.
|
@@ -325,7 +325,7 @@ class TableModel {
|
|
|
325
325
|
let tempVars = [...this.vars];
|
|
326
326
|
const data = yield this.executeQuery(sql, tempVars);
|
|
327
327
|
const countData = yield this.executeQuery(countSql, tempVars);
|
|
328
|
-
return { datas: data.rows,
|
|
328
|
+
return { datas: data.rows, total_count: Number(countData.rows[0].count), last_page: Math.ceil(Number(countData.rows[0].count) / this.PageCount) };
|
|
329
329
|
});
|
|
330
330
|
}
|
|
331
331
|
throwException(code, type, columnName, value) {
|
package/package.json
CHANGED
package/src/models/TableModel.ts
CHANGED
|
@@ -369,7 +369,7 @@ export class TableModel {
|
|
|
369
369
|
return data.rows as Array<T>;
|
|
370
370
|
}
|
|
371
371
|
|
|
372
|
-
public async executeSelectWithCount<T = any>(): Promise<{ datas: Array<T>,
|
|
372
|
+
public async executeSelectWithCount<T = any>(): Promise<{ datas: Array<T>, total_count: number, last_page: number}> {
|
|
373
373
|
if (this.selectExpressions.length == 0) {
|
|
374
374
|
this.select();
|
|
375
375
|
}
|
|
@@ -380,7 +380,7 @@ export class TableModel {
|
|
|
380
380
|
const data = await this.executeQuery(sql, tempVars);
|
|
381
381
|
|
|
382
382
|
const countData = await this.executeQuery(countSql, tempVars);
|
|
383
|
-
return { datas: data.rows as Array<T>,
|
|
383
|
+
return { datas: data.rows as Array<T>, total_count: Number(countData.rows[0].count), last_page: Math.ceil(Number(countData.rows[0].count) / this.PageCount)};
|
|
384
384
|
}
|
|
385
385
|
|
|
386
386
|
protected readonly errorMessages: TOptionErrorMessage =
|