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/insertDB.js

18 lines
634 B
JavaScript
Raw Normal View History

2021-03-18 10:38:28 +00:00
const con = require('./connect');
2021-03-12 12:34:06 +00:00
2021-03-18 10:38:28 +00:00
function insertDB(barcode, shelving, level) {
2021-04-15 09:35:47 +00:00
let sql = `IF EXISTS(SELECT * FROM vn.smartTag WHERE code='${barcode}')
2021-03-16 11:25:47 +00:00
THEN
UPDATE vn.smartTag
SET shelvingFk = '${shelving}', level = ${level}
WHERE code='${barcode}';
ELSE
INSERT
INTO vn.smartTag (code, shelvingFk, level)
VALUES ('${barcode}', '${shelving}', ${level});
END IF;`;
2021-04-15 09:35:47 +00:00
con.con.query(sql, function(err, result) {
2021-03-12 12:34:06 +00:00
});
2021-03-12 12:54:21 +00:00
}
2021-03-18 10:38:28 +00:00
exports.insertDB = insertDB;