@shencom/api
Version:
shencom api group
106 lines (97 loc) • 2.37 kB
TypeScript
type ISortType = 'ASC' | 'DESC';
type IOperateType =
| 'EQ'
| 'LT'
| 'GT'
| 'LTE'
| 'GTE'
| 'NEQ'
| 'IN'
| 'NN'
| 'NULL'
| 'BTW'
| 'LIKE'
| 'LL'
| 'RL';
type ILrType = 'and' | 'or';
interface ISorts<P extends string = string> {
/** 筛选字段 */
orderField: P;
/** 筛选类型 */
orderType: ISortType | (string & {});
}
type IIndexSorts<P extends string = string> = ISorts<P>[];
interface IQuery<P extends string = string> {
/** 搜索关联 */
lr?: ILrType | (string & {});
/** 搜索方式 */
operate: IOperateType | (string & {});
/** 搜索字段 */
prop: P;
/** 搜索值 */
value: any;
}
type IIndexQuery<P extends string = string> = { exps: IQuery<P>[] }[];
interface IIndexInterface<T> {
/** 是否第一页 */
first: boolean;
/** 是否加载完 */
last: boolean;
/** 当前页数 */
number: number;
/** 每页个数 */
size: number;
/** 总数 */
totalElements: number;
/** 总页数 */
totalPages: number;
/** 列表 */
content: T[];
}
interface IIndexBodyInterface<P extends string = string> {
/** 页数,默认: 0 */
page?: number;
/** 个数,默认: 10 */
size?: number;
query?: IIndexQuery<P>;
sorts?: IIndexSorts<P>;
}
interface IExportBodyInterface {
page?: number;
size?: number;
query?: IIndexQuery;
cfg: {
/** 导出模式: 0选中 | 1全部 */
mode: 0 | 1;
/** 导出名称 */
name?: string;
/** 导出类型 */
type: 'XLS' | 'XLSX' | 'CSV' | (string & {});
/** 导出字段名 */
cols: string[];
};
}
declare namespace SC {
export namespace API {
/** 操作符 */
export type Operate = IOperateType;
/** 搜索关联 */
export type Lr = ILrType;
/** 搜索类型 */
export type Query = IQuery;
/** 筛选字段 */
export type Sorts = ISorts;
/** 排序类型 */
export type SortType = ISortType;
/** index 接口查询参数类型 */
export type IndexQuery = IIndexQuery;
/** index 接口排序参数类型 */
export type IndexSorts = IIndexSorts;
/** 分页接口 */
export type IndexInterface<T = Record<string, any>> = IIndexInterface<T>;
/** index 接口参数类型 */
export type IndexBodyInterface = IIndexBodyInterface;
/** export 接口参数类型 */
export type ExportBodyInterface = IExportBodyInterface;
}
}