@shencom/api
Version:
shencom api group
141 lines (138 loc) • 3.27 kB
TypeScript
/**
* 查询操作类型枚举
*
* @export
* @enum {string}
*/
declare enum OperateEnum {
/** 等于 */
EQ = "EQ",
/** 小于 */
LT = "LT",
/** 大于 */
GT = "GT",
/** 小于等于 */
LTE = "LTE",
/** 大于等于 */
GTE = "GTE",
/** 不等于 */
NEQ = "NEQ",
/** 包含 */
IN = "IN",
/** 非空 */
NN = "NN",
/** 为空 */
NULL = "NULL",
/** 区间 */
BTW = "BTW",
/** 模糊匹配 */
LIKE = "LIKE",
/** 左模糊匹配 */
LL = "LL",
/** 右模糊匹配 */
RL = "RL"
}
/**
* 查询逻辑关系枚举
*
* @export
* @enum {string}
*/
declare enum LrEnum {
/** 并且 */
AND = "and",
/** 或者 */
OR = "or"
}
declare const LR: readonly [{
readonly label: "并且";
readonly value: LrEnum.AND;
}, {
readonly label: "或者";
readonly value: LrEnum.OR;
}];
type QueryLr = (typeof LR)[number]['value'];
type Operate = OperateEnum;
declare const sortType: readonly ["ASC", "DESC"];
type SortType = (typeof sortType)[number];
interface ISorts<P extends string = string> {
/** 筛选字段 */
orderField: P;
/** 筛选类型 */
orderType: SortType | (string & {});
}
type IIndexSorts<P extends string = string> = ISorts<P>[];
interface IQuery<P extends string = string> {
/** 搜索关联 */
lr?: QueryLr | (string & {});
/** 搜索方式 */
operate: Operate | (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 {
namespace API {
/** 操作符 */
type Operate = Operate;
/** 搜索关联 */
type Lr = QueryLr;
/** 搜索类型 */
type Query = IQuery;
/** 筛选字段 */
type Sorts = ISorts;
/** index 接口查询参数类型 */
type IndexQuery = IIndexQuery;
/** index 接口排序参数类型 */
type IndexSorts = IIndexSorts;
/** 分页接口 */
type IndexInterface<T = Record<string, any>> = IIndexInterface<T>;
/** index 接口参数类型 */
type IndexBodyInterface = IIndexBodyInterface;
/** export 接口参数类型 */
type ExportBodyInterface = IExportBodyInterface;
}
}