Comparing version 0.0.23 to 0.0.24
{ | ||
"name": "js-jpa", | ||
"version": "0.0.23", | ||
"version": "0.0.24", | ||
"description": "jpa for node", | ||
@@ -22,2 +22,2 @@ "author": "stone", | ||
} | ||
} | ||
} |
@@ -45,2 +45,6 @@ const SqlGenerator = require('../../jpa/SqlGenerator') | ||
getSelect(schema, where, pageRequest) { | ||
let fields = '*' | ||
if (pageRequest && pageRequest.fields) { | ||
fields = pageRequest.fields.join(',') | ||
} | ||
let order = (pageRequest && pageRequest.orders) ? this.getOrders(pageRequest.orders) : false | ||
@@ -60,3 +64,3 @@ let sql = `FROM \`${schema.name}\`` | ||
sql = `SELECT \`${primaryKey}\` ${sql} LIMIT ${pageRequest.page * pageRequest.size}, ${pageRequest.size}` | ||
sql = `SELECT * FROM \`${schema.name}\` WHERE \`${primaryKey}\` IN (SELECT \`${primaryKey}\` FROM (${sql}) AS tt)` | ||
sql = `SELECT ${fields} FROM \`${schema.name}\` WHERE \`${primaryKey}\` IN (SELECT \`${primaryKey}\` FROM (${sql}) AS tt)` | ||
if (order) { | ||
@@ -66,3 +70,3 @@ sql += ' ORDER BY ' + order | ||
} else { | ||
sql = `SELECT * ${sql}` | ||
sql = `SELECT ${fields} ${sql}` | ||
} | ||
@@ -69,0 +73,0 @@ return sql |
@@ -53,3 +53,4 @@ export function newDataSource(config: JpaConfig): Promise<DataSource> | ||
size?: number, | ||
orders?: PageOrder[] | ||
orders?: PageOrder[], | ||
fields?: string[] | ||
} | ||
@@ -56,0 +57,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
22755
724