2394 - Removed call to order_total() #358
|
@ -136,14 +136,10 @@ module.exports = Self => {
|
|||
let stmts = [];
|
||||
let stmt;
|
||||
|
||||
stmts.push('DROP TEMPORARY TABLE IF EXISTS tmp.filter');
|
||||
|
||||
stmt = new ParameterizedSQL(
|
||||
`CREATE TEMPORARY TABLE tmp.filter
|
||||
(INDEX (id))
|
||||
ENGINE = MEMORY
|
||||
SELECT
|
||||
`SELECT
|
||||
o.id,
|
||||
o.total,
|
||||
o.date_send landed,
|
||||
o.date_make created,
|
||||
o.customer_id clientFk,
|
||||
|
@ -178,36 +174,13 @@ module.exports = Self => {
|
|||
}
|
||||
|
||||
stmt.merge(conn.makeWhere(filter.where));
|
||||
stmt.merge({
|
||||
sql: `GROUP BY o.id`
|
||||
});
|
||||
stmt.merge(`GROUP BY o.id`);
|
||||
stmt.merge(conn.makePagination(filter));
|
||||
stmts.push(stmt);
|
||||
|
||||
stmts.push(`
|
||||
CREATE TEMPORARY TABLE tmp.order
|
||||
(INDEX (orderFk))
|
||||
ENGINE = MEMORY
|
||||
SELECT id AS orderFk
|
||||
FROM tmp.filter`);
|
||||
const sql = ParameterizedSQL.join(stmts, ';');
|
||||
const result = await conn.executeStmt(sql);
|
||||
|
||||
stmts.push('CALL hedera.order_getTotal()');
|
||||
|
||||
stmt = new ParameterizedSQL(
|
||||
`SELECT f.*, ot.*
|
||||
FROM tmp.filter f
|
||||
LEFT JOIN tmp.orderTotal ot ON ot.orderFk = f.id`);
|
||||
const orderIndex = stmts.push(stmt) - 1;
|
||||
|
||||
stmts.push(`
|
||||
DROP TEMPORARY TABLE
|
||||
tmp.order,
|
||||
tmp.orderTotal,
|
||||
tmp.filter`);
|
||||
|
||||
let sql = ParameterizedSQL.join(stmts, ';');
|
||||
let result = await conn.executeStmt(sql);
|
||||
|
||||
return result[orderIndex];
|
||||
return result;
|
||||
};
|
||||
};
|
||||
|
|
|
@ -79,6 +79,9 @@
|
|||
"mysql": {
|
||||
"columnName": "confirm_date"
|
||||
}
|
||||
},
|
||||
"total": {
|
||||
"type": "Number"
|
||||
}
|
||||
},
|
||||
"relations": {
|
||||
|
|
Loading…
Reference in New Issue