mirror of
https://github.com/dbgate/dbgate
synced 2024-11-07 20:26:23 +00:00
custyom grid display additional condition
This commit is contained in:
parent
5c080568d8
commit
50b64cf0c6
@ -11,7 +11,7 @@ import type {
|
|||||||
ForeignKeyInfo,
|
ForeignKeyInfo,
|
||||||
} from 'dbgate-types';
|
} from 'dbgate-types';
|
||||||
import { GridConfig, GridCache, createGridCache } from './GridConfig';
|
import { GridConfig, GridCache, createGridCache } from './GridConfig';
|
||||||
import { Expression, Select, treeToSql, dumpSqlSelect, ColumnRefExpression } from 'dbgate-sqltree';
|
import { Expression, Select, treeToSql, dumpSqlSelect, ColumnRefExpression, Condition } from 'dbgate-sqltree';
|
||||||
|
|
||||||
export interface CustomGridColumn {
|
export interface CustomGridColumn {
|
||||||
columnName: string;
|
columnName: string;
|
||||||
@ -30,7 +30,8 @@ export class CustomGridDisplay extends GridDisplay {
|
|||||||
setCache: ChangeCacheFunc,
|
setCache: ChangeCacheFunc,
|
||||||
dbinfo: DatabaseInfo,
|
dbinfo: DatabaseInfo,
|
||||||
serverVersion,
|
serverVersion,
|
||||||
isReadOnly = false
|
isReadOnly = false,
|
||||||
|
public additionalcondition: Condition = null
|
||||||
) {
|
) {
|
||||||
super(config, setConfig, cache, setCache, driver, dbinfo, serverVersion);
|
super(config, setConfig, cache, setCache, driver, dbinfo, serverVersion);
|
||||||
|
|
||||||
@ -68,6 +69,16 @@ export class CustomGridDisplay extends GridDisplay {
|
|||||||
})),
|
})),
|
||||||
options
|
options
|
||||||
);
|
);
|
||||||
|
if (this.additionalcondition) {
|
||||||
|
if (select.where) {
|
||||||
|
select.where = {
|
||||||
|
conditionType: 'and',
|
||||||
|
conditions: [select.where, this.additionalcondition],
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
select.where = this.additionalcondition;
|
||||||
|
}
|
||||||
|
}
|
||||||
return select;
|
return select;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user