Merge branch 'master' into test
gitea/salix/test This commit looks good
Details
gitea/salix/test This commit looks good
Details
This commit is contained in:
commit
5fcb9f61ab
|
@ -89,12 +89,12 @@ module.exports = Self => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
filter = mergeFilters(ctx.args.filter, {where});
|
/* case 'hasVisible':
|
||||||
|
return value ? {'v.visible': {gt: 0}} : {'v.visible': {or: [{lte: 0}, {neq: null}]}}; */
|
||||||
|
|
||||||
|
filter = mergeFilters(ctx.args.filter, {where});
|
||||||
let stmts = [];
|
let stmts = [];
|
||||||
let stmt;
|
let stmt;
|
||||||
if (ctx.args.hasVisible === true)
|
|
||||||
stmts.push('CALL cache.visible_refresh(@visibleCalc, true, 1)');
|
|
||||||
|
|
||||||
stmt = new ParameterizedSQL(
|
stmt = new ParameterizedSQL(
|
||||||
`SELECT i.id, i.image, i.name, i.description,
|
`SELECT i.id, i.image, i.name, i.description,
|
||||||
|
@ -106,7 +106,7 @@ module.exports = Self => {
|
||||||
intr.description AS intrastat, i.stems,
|
intr.description AS intrastat, i.stems,
|
||||||
ori.code AS origin, t.name AS type,
|
ori.code AS origin, t.name AS type,
|
||||||
ic.name AS category, i.density,
|
ic.name AS category, i.density,
|
||||||
b.grouping, b.packing, itn.code AS niche
|
b.grouping, b.packing, itn.code AS niche, @visibleCalc
|
||||||
FROM item i
|
FROM item i
|
||||||
LEFT JOIN itemType t ON t.id = i.typeFk
|
LEFT JOIN itemType t ON t.id = i.typeFk
|
||||||
LEFT JOIN itemCategory ic ON ic.id = t.categoryFk
|
LEFT JOIN itemCategory ic ON ic.id = t.categoryFk
|
||||||
|
@ -120,13 +120,18 @@ module.exports = Self => {
|
||||||
LEFT JOIN itemPlacement itn ON itn.itemFk = i.id AND itn.warehouseFk = t.warehouseFk`
|
LEFT JOIN itemPlacement itn ON itn.itemFk = i.id AND itn.warehouseFk = t.warehouseFk`
|
||||||
);
|
);
|
||||||
|
|
||||||
if (ctx.args.hasVisible === true) {
|
/* if (ctx.args.hasVisible !== undefined) {
|
||||||
|
stmts.push('CALL cache.visible_refresh(@visibleCalc, false, 1)');
|
||||||
|
stmts.push('CALL cache.visible_refresh(@visibleCalc, false, 44)');
|
||||||
let joinAvailable = new ParameterizedSQL(
|
let joinAvailable = new ParameterizedSQL(
|
||||||
`JOIN cache.visible v
|
`LEFT JOIN cache.visible v
|
||||||
ON v.item_id = i.id AND v.calc_id = @visibleCalc`
|
ON v.item_id = i.id`
|
||||||
);
|
);
|
||||||
stmt.merge(joinAvailable);
|
stmt.merge(joinAvailable);
|
||||||
}
|
} */
|
||||||
|
/* where v.visible > 0
|
||||||
|
where v.visible <= 0 OR v.visible IS NULL
|
||||||
|
*/
|
||||||
|
|
||||||
if (ctx.args.tags) {
|
if (ctx.args.tags) {
|
||||||
let i = 1;
|
let i = 1;
|
||||||
|
@ -150,7 +155,12 @@ module.exports = Self => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
stmt.merge(conn.makeSuffix(filter));
|
stmt.merge(conn.makeWhere(filter.where));
|
||||||
|
|
||||||
|
/* if (ctx.args.hasVisible !== undefined)
|
||||||
|
stmt.merge(`GROUP BY i.id`);
|
||||||
|
*/
|
||||||
|
stmt.merge(conn.makePagination(filter));
|
||||||
let itemsIndex = stmts.push(stmt) - 1;
|
let itemsIndex = stmts.push(stmt) - 1;
|
||||||
|
|
||||||
let sql = ParameterizedSQL.join(stmts, ';');
|
let sql = ParameterizedSQL.join(stmts, ';');
|
||||||
|
|
|
@ -42,11 +42,6 @@
|
||||||
</vn-autocomplete>
|
</vn-autocomplete>
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
<vn-horizontal>
|
<vn-horizontal>
|
||||||
<vn-check
|
|
||||||
vn-one
|
|
||||||
label="With visible"
|
|
||||||
field="filter.hasVisible">
|
|
||||||
</vn-check>
|
|
||||||
<vn-check
|
<vn-check
|
||||||
vn-one
|
vn-one
|
||||||
label="Active"
|
label="Active"
|
||||||
|
|
|
@ -80,7 +80,8 @@ module.exports = Self => {
|
||||||
? {'w.id': value}
|
? {'w.id': value}
|
||||||
: {or: [
|
: {or: [
|
||||||
{'w.firstName': {like: `%${value}%`}},
|
{'w.firstName': {like: `%${value}%`}},
|
||||||
{'w.name': {like: `%${value}%`}}
|
{'w.name': {like: `%${value}%`}},
|
||||||
|
{'u.name': {like: `%${value}%`}}
|
||||||
]};
|
]};
|
||||||
case 'id':
|
case 'id':
|
||||||
return {'w.id': value};
|
return {'w.id': value};
|
||||||
|
|
Loading…
Reference in New Issue