revisi db tags: add device_code_name
This commit is contained in:
@@ -40,22 +40,10 @@ const getAllDevicesDb = async (searchParams = {}) => {
|
||||
|
||||
const queryText = `
|
||||
SELECT
|
||||
COUNT(*) OVER() AS total_data,
|
||||
a.device_id,
|
||||
a.device_code,
|
||||
a.device_name,
|
||||
a.is_active,
|
||||
a.device_location,
|
||||
a.device_description,
|
||||
a.ip_address,
|
||||
a.created_by,
|
||||
a.updated_by,
|
||||
a.deleted_by,
|
||||
a.created_at,
|
||||
a.updated_at,
|
||||
a.deleted_at,
|
||||
b.brand_id,
|
||||
b.brand_name
|
||||
COUNT(*) OVER() AS total_data,
|
||||
a.*,
|
||||
b.brand_name,
|
||||
COALESCE(a.device_code, '') + ' - ' + COALESCE(a.device_name, '') AS device_code_name
|
||||
FROM m_device a
|
||||
LEFT JOIN m_brands b ON a.brand_id = b.brand_id
|
||||
WHERE a.deleted_at IS NULL
|
||||
@@ -79,19 +67,9 @@ const getAllDevicesDb = async (searchParams = {}) => {
|
||||
const getDeviceByIdDb = async (id) => {
|
||||
const queryText = `
|
||||
SELECT
|
||||
a.device_id,
|
||||
a.device_name,
|
||||
a.is_active,
|
||||
a.device_location,
|
||||
a.device_description,
|
||||
a.ip_address,
|
||||
a.created_by,
|
||||
a.updated_by,
|
||||
a.deleted_by,
|
||||
a.created_at,
|
||||
a.updated_at,
|
||||
a.deleted_at,
|
||||
b.brand_name
|
||||
a.*,
|
||||
b.brand_name,
|
||||
COALESCE(a.device_code, '') + ' - ' + COALESCE(a.device_name, '') AS device_code_name
|
||||
FROM m_device a
|
||||
LEFT JOIN m_brands b ON a.brand_id = b.brand_id
|
||||
WHERE a.device_id = $1 AND a.deleted_at IS NULL
|
||||
|
||||
Reference in New Issue
Block a user