u
This commit is contained in:
99
src/providers/mssql/queries/printer.js
Normal file
99
src/providers/mssql/queries/printer.js
Normal file
@@ -0,0 +1,99 @@
|
||||
export const PRINTER_COLUMNS = `
|
||||
id,
|
||||
company_id,
|
||||
address,
|
||||
type,
|
||||
model,
|
||||
serial,
|
||||
sort,
|
||||
[desc]
|
||||
`;
|
||||
|
||||
export const LIST_BY_COMPANY = `
|
||||
SELECT
|
||||
${PRINTER_COLUMNS}
|
||||
FROM printer
|
||||
WHERE company_id = @companyId
|
||||
ORDER BY sort ASC, id ASC
|
||||
`;
|
||||
|
||||
export const GET_BY_COMPANY_AND_ID = `
|
||||
SELECT
|
||||
${PRINTER_COLUMNS}
|
||||
FROM printer
|
||||
WHERE id = @id AND company_id = @companyId
|
||||
`;
|
||||
|
||||
export const GET_NEXT_SORT = `
|
||||
SELECT ISNULL(MAX(sort), -1) + 1 AS sort
|
||||
FROM printer
|
||||
WHERE company_id = @companyId
|
||||
`;
|
||||
|
||||
export const LIST_IDS_BY_COMPANY = `
|
||||
SELECT id
|
||||
FROM printer
|
||||
WHERE company_id = @companyId
|
||||
`;
|
||||
|
||||
export const CREATE = `
|
||||
INSERT INTO printer (
|
||||
company_id,
|
||||
address,
|
||||
type,
|
||||
model,
|
||||
serial,
|
||||
sort,
|
||||
[desc]
|
||||
)
|
||||
OUTPUT
|
||||
INSERTED.id,
|
||||
INSERTED.company_id,
|
||||
INSERTED.address,
|
||||
INSERTED.type,
|
||||
INSERTED.model,
|
||||
INSERTED.serial,
|
||||
INSERTED.sort,
|
||||
INSERTED.[desc]
|
||||
VALUES (
|
||||
@companyId,
|
||||
@address,
|
||||
@type,
|
||||
@model,
|
||||
@serial,
|
||||
@sort,
|
||||
@desc
|
||||
)
|
||||
`;
|
||||
|
||||
export const UPDATE = `
|
||||
UPDATE printer
|
||||
SET
|
||||
address = @address,
|
||||
type = @type,
|
||||
model = @model,
|
||||
serial = @serial,
|
||||
sort = @sort,
|
||||
[desc] = @desc
|
||||
OUTPUT
|
||||
INSERTED.id,
|
||||
INSERTED.company_id,
|
||||
INSERTED.address,
|
||||
INSERTED.type,
|
||||
INSERTED.model,
|
||||
INSERTED.serial,
|
||||
INSERTED.sort,
|
||||
INSERTED.[desc]
|
||||
WHERE id = @id AND company_id = @companyId
|
||||
`;
|
||||
|
||||
export const UPDATE_SORT = `
|
||||
UPDATE printer
|
||||
SET sort = @sort
|
||||
WHERE id = @id AND company_id = @companyId
|
||||
`;
|
||||
|
||||
export const DELETE_BY_COMPANY_AND_ID = `
|
||||
DELETE FROM printer
|
||||
WHERE id = @id AND company_id = @companyId
|
||||
`;
|
||||
Reference in New Issue
Block a user