import { DataAgg, SortDir } from '../meta/basetype'; /** * 在查询条件中,指定某个值是null(因为自然的null在后台将被解析为空条件,将被忽略) */ export declare const NULLVALUE = "$$__null__$$"; /** * 在查询条件中,指定某个值是not null */ export declare const NOTNULLVALUE = "$$__notnull__$$"; /** 在新增实体是,向后台获取初始化实体的时候使用的ID */ export declare const NEWENTITYID = "-1"; export interface AggDataItem { [agg: string]: any; } export interface AggData { [fieldName: string]: AggDataItem; } export interface QueryAgg { field: string; aggregate: DataAgg; } export interface QueryColumn { propName?: string; field?: string; agg?: DataAgg; } export interface QuerySort { field: string; dir?: SortDir; } /** * 查询条件 * * 属性名称代表查询的字段或者属性名称(支持嵌套表达)。有如下特殊表达方式: * * 1 *(prop1,prop2...) : 表对括号里面的属性进行模糊匹配并用【或】进行连接; * * 2 ** : 全文模糊匹配 * * 3 *** : 全文模糊(分词)匹配 * * 属性值表示比较的值。有如下表示方法: * * 1 : 当多个子以空格分隔的时候,表示对多个值进行多次匹配(and); * * 2 [val1,val2] */ export interface QueryParams { [param: string]: any; } /** * 向后台提交通用查询的封装格式 */ export interface RestQuery { /** * 分页开始行 */ first?: number; /** * 分页的页面大小(条数),如果小于等于0表示不分页 */ rows?: number; orderBy?: string; limit?: number; aggregate?: QueryAgg[]; /** * 排序设置 */ sort?: QuerySort[]; /** * 查询条件 */ search?: QueryParams; /** * 查询属性列定义,如果为空,表示返回所有属性 */ columns?: QueryColumn[] | string; } /** * 后台返回的页面数据 */ export interface PageData { /** * 分页开始行 */ first: number; /** * 分页的页面大小(条数) */ rows: number; /** * 返回的数据列表 */ datas: T[]; /** * 总的数据条数 */ total: number; /** * 汇总数据 */ aggregates?: AggData; } /** * 转换排序表达式到排序设置数组 * @param orderBy 排序表达式: * [asc|desc], [asc|desc], * Ex: deptname desc * 多个排序属性用逗号隔开,如果未指定升序或者降序,则默认为升序。 * @returns 若传入空字符串或者null则返回[] */ export declare function orderByToSorts(orderBy: string): QuerySort[];