This commit is contained in:
seb
2026-09-29 16:16:05 +02:00
parent 26d2f83d64
commit ae5d5cc6f8
40 changed files with 2139 additions and 0 deletions

View File

@@ -0,0 +1,41 @@
export const LIST_BY_ARTICLE_ID = `
SELECT
aav.id,
aav.article_id AS articleId,
an.id AS attributeId,
an.name AS attributeName,
an.exclusive,
av.id AS attributeValueId,
av.value,
aav.sort
FROM articleattributevalue aav
INNER JOIN attributevalue av ON av.id = aav.attributevalue_id
INNER JOIN attributename an ON an.id = av.attribute_id
WHERE aav.article_id = @articleId
ORDER BY an.sort ASC, an.id ASC, aav.sort ASC, aav.id ASC
`;
export const DELETE_BY_ARTICLE_ID = `
DELETE FROM articleattributevalue
WHERE article_id = @articleId
`;
export const INSERT_ROW = `
INSERT INTO articleattributevalue (article_id, attributevalue_id, sort)
OUTPUT INSERTED.id, INSERTED.article_id AS articleId, INSERTED.attributevalue_id AS attributeValueId, INSERTED.sort
VALUES (@articleId, @attributeValueId, @sort)
`;
export const GET_VALUE_DETAIL = `
SELECT
av.id AS attributeValueId,
av.value,
av.sort,
an.id AS attributeId,
an.name AS attributeName,
an.exclusive,
an.company_id AS companyId
FROM attributevalue av
INNER JOIN attributename an ON an.id = av.attribute_id
WHERE av.id = @attributeValueId
`;