u
This commit is contained in:
@@ -132,7 +132,34 @@ SELECT auth.*,
|
||||
'brandThumbW', bp.thumbw, 'brandThumbH', bp.thumbh,
|
||||
'brandThumbHash', bp.thumbhash,
|
||||
'optionsCount', (SELECT COUNT(*) FROM optionslistarticle WHERE optionslist_id = a.optionslist_id),
|
||||
'optionslistId', a.optionslist_id,
|
||||
'optionslistItemsJson', json((SELECT COALESCE(json_group_array(json_object(
|
||||
'id', ola.id,
|
||||
'articleId', ola.article_id,
|
||||
'sku', a_opt.sku,
|
||||
'name', at_opt.name,
|
||||
'count', ola.count,
|
||||
'sort', ola.sort,
|
||||
'mandated', ola.mandated
|
||||
)), '[]') FROM optionslistarticle ola
|
||||
INNER JOIN article a_opt ON a_opt.id = ola.article_id
|
||||
LEFT JOIN articletext at_opt ON at_opt.article_id = a_opt.id AND at_opt.language_id = auth.languageId
|
||||
WHERE ola.optionslist_id = a.optionslist_id
|
||||
ORDER BY ola.sort ASC, ola.id ASC)),
|
||||
'articleListCount', (SELECT COUNT(*) FROM articlelistarticle WHERE articlelist_id = a.articlelist_id),
|
||||
'articlelistId', a.articlelist_id,
|
||||
'articlelistItemsJson', json((SELECT COALESCE(json_group_array(json_object(
|
||||
'id', ala.id,
|
||||
'articleId', ala.article_id,
|
||||
'sku', a_item.sku,
|
||||
'name', at_item.name,
|
||||
'count', ala.count,
|
||||
'sort', ala.sort
|
||||
)), '[]') FROM articlelistarticle ala
|
||||
INNER JOIN article a_item ON a_item.id = ala.article_id
|
||||
LEFT JOIN articletext at_item ON at_item.article_id = a_item.id AND at_item.language_id = auth.languageId
|
||||
WHERE ala.articlelist_id = a.articlelist_id
|
||||
ORDER BY ala.sort ASC, ala.id ASC)),
|
||||
'childCount', (SELECT COUNT(*) FROM article WHERE fatherarticle_id = a.id),
|
||||
'isFather', a.is_father,
|
||||
'fatherAttributeNameId', a.fatherattributename_id,
|
||||
|
||||
14
src/providers/sqlite3/queries/articlelist.js
Normal file
14
src/providers/sqlite3/queries/articlelist.js
Normal file
@@ -0,0 +1,14 @@
|
||||
import * as source from '../../mssql/queries/articlelist.js';
|
||||
import { translateQueries } from './translate.js';
|
||||
|
||||
const queries = translateQueries(source, 'articlelist');
|
||||
export const {
|
||||
CREATE_ARTICLELIST,
|
||||
SET_ARTICLE_ARTICLELIST_ID,
|
||||
GET_ARTICLELIST_ITEMS,
|
||||
INSERT_ARTICLELIST_ARTICLE,
|
||||
DELETE_ARTICLELIST_ARTICLES,
|
||||
DELETE_ARTICLELIST,
|
||||
} = queries;
|
||||
|
||||
export default queries;
|
||||
14
src/providers/sqlite3/queries/optionslist.js
Normal file
14
src/providers/sqlite3/queries/optionslist.js
Normal file
@@ -0,0 +1,14 @@
|
||||
import * as source from '../../mssql/queries/optionslist.js';
|
||||
import { translateQueries } from './translate.js';
|
||||
|
||||
const queries = translateQueries(source, 'optionslist');
|
||||
export const {
|
||||
CREATE_OPTIONSLIST,
|
||||
SET_ARTICLE_OPTIONSLIST_ID,
|
||||
GET_OPTIONSLIST_ITEMS,
|
||||
INSERT_OPTIONSLIST_ARTICLE,
|
||||
DELETE_OPTIONSLIST_ARTICLES,
|
||||
DELETE_OPTIONSLIST,
|
||||
} = queries;
|
||||
|
||||
export default queries;
|
||||
@@ -3,7 +3,7 @@ function quoteIdentifiers(sql) {
|
||||
}
|
||||
|
||||
function moveReturning(sql) {
|
||||
const output = /\bOUTPUT\s+([\s\S]*?)(?=\bVALUES\b|\bWHERE\b)/i.exec(sql);
|
||||
const output = /\bOUTPUT\s+([\s\S]*?)(?=\bVALUES\b|\bWHERE\b|\bDEFAULT\b)/i.exec(sql);
|
||||
if (!output) return sql;
|
||||
|
||||
const columns = output[1]
|
||||
|
||||
Reference in New Issue
Block a user