mirror of
https://github.com/frappe/books.git
synced 2024-11-14 01:14:03 +00:00
Add groupBy in getAll
This commit is contained in:
parent
d4472e4be0
commit
e46963d8c1
@ -154,7 +154,7 @@ module.exports = class sqliteDatabase extends Database {
|
|||||||
await frappe.db.run('delete from SingleValue where parent=?', name)
|
await frappe.db.run('delete from SingleValue where parent=?', name)
|
||||||
}
|
}
|
||||||
|
|
||||||
getAll({ doctype, fields, filters, start, limit, orderBy = 'modified', order = 'desc' } = {}) {
|
getAll({ doctype, fields, filters, start, limit, orderBy = 'modified', groupBy, order = 'desc' } = {}) {
|
||||||
if (!fields) {
|
if (!fields) {
|
||||||
fields = frappe.getMeta(doctype).getKeywordFields();
|
fields = frappe.getMeta(doctype).getKeywordFields();
|
||||||
}
|
}
|
||||||
@ -167,6 +167,7 @@ module.exports = class sqliteDatabase extends Database {
|
|||||||
let query = `select ${fields.join(", ")}
|
let query = `select ${fields.join(", ")}
|
||||||
from ${doctype}
|
from ${doctype}
|
||||||
${conditions.conditions ? "where" : ""} ${conditions.conditions}
|
${conditions.conditions ? "where" : ""} ${conditions.conditions}
|
||||||
|
${groupBy ? ("group by " + groupBy.join(', ')) : ""}
|
||||||
${orderBy ? ("order by " + orderBy) : ""} ${orderBy ? (order || "asc") : ""}
|
${orderBy ? ("order by " + orderBy) : ""} ${orderBy ? (order || "asc") : ""}
|
||||||
${limit ? ("limit " + limit) : ""} ${start ? ("offset " + start) : ""}`;
|
${limit ? ("limit " + limit) : ""} ${start ? ("offset " + start) : ""}`;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user