mirror of
https://github.com/dbgate/dbgate
synced 2024-11-07 20:26:23 +00:00
mix - more conditions
This commit is contained in:
parent
fd7f3d7e47
commit
4e0770d1ab
@ -117,6 +117,7 @@ export abstract class GridDisplay {
|
|||||||
}
|
}
|
||||||
|
|
||||||
applyFilterOnSelect(select: Select, displayedColumnInfo: DisplayedColumnInfo) {
|
applyFilterOnSelect(select: Select, displayedColumnInfo: DisplayedColumnInfo) {
|
||||||
|
const conditions = [];
|
||||||
for (const uniqueName in this.config.filters) {
|
for (const uniqueName in this.config.filters) {
|
||||||
const filter = this.config.filters[uniqueName];
|
const filter = this.config.filters[uniqueName];
|
||||||
if (!filter) continue;
|
if (!filter) continue;
|
||||||
@ -125,20 +126,29 @@ export abstract class GridDisplay {
|
|||||||
try {
|
try {
|
||||||
const condition = parseFilter(filter, getFilterType(column.commonType?.typeCode));
|
const condition = parseFilter(filter, getFilterType(column.commonType?.typeCode));
|
||||||
if (condition) {
|
if (condition) {
|
||||||
select.where = _.cloneDeepWith(condition, (expr: Expression) => {
|
conditions.push(
|
||||||
if (expr.exprType == 'placeholder')
|
_.cloneDeepWith(condition, (expr: Expression) => {
|
||||||
return {
|
if (expr.exprType == 'placeholder')
|
||||||
exprType: 'column',
|
return {
|
||||||
columnName: column.columnName,
|
exprType: 'column',
|
||||||
source: { alias: column.sourceAlias },
|
columnName: column.columnName,
|
||||||
};
|
source: { alias: column.sourceAlias },
|
||||||
});
|
};
|
||||||
|
})
|
||||||
|
);
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.warn(err.message);
|
console.warn(err.message);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (conditions.length > 0) {
|
||||||
|
select.where = {
|
||||||
|
conditionType: 'and',
|
||||||
|
conditions,
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
applySortOnSelect(select: Select, displayedColumnInfo: DisplayedColumnInfo) {
|
applySortOnSelect(select: Select, displayedColumnInfo: DisplayedColumnInfo) {
|
||||||
|
Loading…
Reference in New Issue
Block a user