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) {
|
||||
const conditions = [];
|
||||
for (const uniqueName in this.config.filters) {
|
||||
const filter = this.config.filters[uniqueName];
|
||||
if (!filter) continue;
|
||||
@ -125,20 +126,29 @@ export abstract class GridDisplay {
|
||||
try {
|
||||
const condition = parseFilter(filter, getFilterType(column.commonType?.typeCode));
|
||||
if (condition) {
|
||||
select.where = _.cloneDeepWith(condition, (expr: Expression) => {
|
||||
conditions.push(
|
||||
_.cloneDeepWith(condition, (expr: Expression) => {
|
||||
if (expr.exprType == 'placeholder')
|
||||
return {
|
||||
exprType: 'column',
|
||||
columnName: column.columnName,
|
||||
source: { alias: column.sourceAlias },
|
||||
};
|
||||
});
|
||||
})
|
||||
);
|
||||
}
|
||||
} catch (err) {
|
||||
console.warn(err.message);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (conditions.length > 0) {
|
||||
select.where = {
|
||||
conditionType: 'and',
|
||||
conditions,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
applySortOnSelect(select: Select, displayedColumnInfo: DisplayedColumnInfo) {
|
||||
|
Loading…
Reference in New Issue
Block a user