This repository has been archived on 2024-10-02. You can view files and clone it, but cannot push or open issues or pull requests.
smart-tag/db/selectCollection.js

20 lines
628 B
JavaScript
Raw Normal View History

2021-03-18 10:38:28 +00:00
const con = require('./connect');
2021-03-12 15:26:02 +00:00
2021-03-18 10:38:28 +00:00
function select(collectionFk, callback) {
2021-03-30 06:06:07 +00:00
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
2021-03-15 08:42:05 +00:00
FROM ticketCollection tc
2021-03-30 06:06:07 +00:00
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
2021-03-16 12:36:34 +00:00
WHERE tc.collectionFk = ${collectionFk}
ORDER BY tc.wagon, tc.level`;
2021-03-16 07:04:58 +00:00
2021-03-18 10:38:28 +00:00
con.con.query(consSql, function(err, result, fields) {
callback(null, result);
2021-03-12 15:26:02 +00:00
});
}
2021-03-15 09:10:37 +00:00
2021-03-18 10:38:28 +00:00
exports.select = select;
2021-03-12 15:26:02 +00:00