31 lines
859 B
JavaScript
31 lines
859 B
JavaScript
export const LIST_BY_CATEGORY_ID = `
|
|
SELECT
|
|
cp.id,
|
|
cp.category_id AS categoryId,
|
|
cp.property_id AS propertyId,
|
|
pn.name AS name,
|
|
pn.exclusive,
|
|
cp.value,
|
|
cp.sort
|
|
FROM categoryproperty cp
|
|
INNER JOIN propertyname pn ON pn.id = cp.property_id
|
|
WHERE cp.category_id = @categoryId
|
|
ORDER BY cp.sort ASC, cp.id ASC
|
|
`;
|
|
|
|
export const DELETE_BY_CATEGORY_ID = `
|
|
DELETE FROM categoryproperty
|
|
WHERE category_id = @categoryId
|
|
`;
|
|
|
|
export const DELETE_BY_CATEGORY_AND_PROPERTY_ID = `
|
|
DELETE FROM categoryproperty
|
|
WHERE category_id = @categoryId AND property_id = @propertyId
|
|
`;
|
|
|
|
export const INSERT_ROW = `
|
|
INSERT INTO categoryproperty (category_id, property_id, value, sort)
|
|
OUTPUT INSERTED.id, INSERTED.category_id AS categoryId, INSERTED.property_id AS propertyId, INSERTED.value, INSERTED.sort
|
|
VALUES (@categoryId, @propertyId, @value, @sort)
|
|
`;
|