add: plant sub section name, device, brand name in detail notification
This commit is contained in:
@@ -14,8 +14,28 @@ const InsertNotificationErrorDb = async (store) => {
|
|||||||
const getNotificationByIdDb = async (id) => {
|
const getNotificationByIdDb = async (id) => {
|
||||||
const queryText = `
|
const queryText = `
|
||||||
SELECT
|
SELECT
|
||||||
a.*
|
a.*,
|
||||||
|
b.plant_sub_section_id,
|
||||||
|
c.plant_sub_section_name,
|
||||||
|
d.device_code,
|
||||||
|
d.device_name,
|
||||||
|
d.device_location,
|
||||||
|
e.brand_name
|
||||||
|
|
||||||
FROM notification_error a
|
FROM notification_error a
|
||||||
|
|
||||||
|
LEFT JOIN m_tags b
|
||||||
|
ON a.error_chanel = b.tag_number
|
||||||
|
|
||||||
|
LEFT JOIN m_plant_sub_section c
|
||||||
|
ON b.plant_sub_section_id = c.plant_sub_section_id
|
||||||
|
|
||||||
|
LEFT JOIN m_device d
|
||||||
|
ON b.device_id = d.device_id AND d.deleted_at IS NULL
|
||||||
|
|
||||||
|
LEFT JOIN m_brands e
|
||||||
|
ON d.brand_id = e.brand_id AND d.deleted_at IS NULL
|
||||||
|
|
||||||
WHERE a.notification_error_id = $1 AND a.deleted_at IS NULL
|
WHERE a.notification_error_id = $1 AND a.deleted_at IS NULL
|
||||||
`;
|
`;
|
||||||
const result = await pool.query(queryText, [id]);
|
const result = await pool.query(queryText, [id]);
|
||||||
|
|||||||
Reference in New Issue
Block a user