20 lines
628 B
JavaScript
20 lines
628 B
JavaScript
const con = require('./connect');
|
|
|
|
function select(collectionFk, callback) {
|
|
let consSql = `SELECT t.id AS Ticket, t.clientFk AS Client, am.name AS Agency, tc.level AS Level, tc.wagon AS Wagon, w.code AS Worker
|
|
FROM ticketCollection tc
|
|
JOIN ticket t ON t.id = tc.ticketFk
|
|
JOIN collection c ON c.id = tc.collectionFk
|
|
JOIN worker w ON w.id = c.workerFk
|
|
JOIN agencyMode am ON am.id = t.agencyModeFk
|
|
WHERE tc.collectionFk = ${collectionFk}
|
|
ORDER BY tc.wagon, tc.level`;
|
|
|
|
con.con.query(consSql, function(err, result, fields) {
|
|
callback(null, result);
|
|
});
|
|
}
|
|
|
|
exports.select = select;
|
|
|