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.
2021-03-18 10:38:28 +00:00
|
|
|
const con = require('./connect');
|
2021-03-12 12:34:06 +00:00
|
|
|
|
2021-05-13 07:08:30 +00:00
|
|
|
function insertSmartTag(smartTagFk, shelving, level) {
|
|
|
|
let sql = `IF EXISTS(SELECT * FROM vn.smartTag WHERE code='${smartTagFk}')
|
2021-03-16 11:25:47 +00:00
|
|
|
THEN
|
|
|
|
UPDATE vn.smartTag
|
|
|
|
SET shelvingFk = '${shelving}', level = ${level}
|
2021-05-13 07:08:30 +00:00
|
|
|
WHERE code='${smartTagFk}';
|
2021-03-16 11:25:47 +00:00
|
|
|
ELSE
|
|
|
|
INSERT
|
|
|
|
INTO vn.smartTag (code, shelvingFk, level)
|
2021-05-13 07:08:30 +00:00
|
|
|
VALUES ('${smartTagFk}', '${shelving}', ${level});
|
2021-03-16 11:25:47 +00:00
|
|
|
END IF;`;
|
2021-04-15 09:35:47 +00:00
|
|
|
con.con.query(sql, function(err, result) {
|
2021-05-13 13:29:53 +00:00
|
|
|
console.log(err);
|
2021-03-12 12:34:06 +00:00
|
|
|
});
|
2021-03-12 12:54:21 +00:00
|
|
|
}
|
2021-05-13 07:08:30 +00:00
|
|
|
exports.insertSmartTag = insertSmartTag;
|