baja-lite 1.0.6 → 1.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/boot-remote.js +4 -0
- package/cjs/boot.js +4 -0
- package/cjs/code.js +27 -12
- package/cjs/convert-xml.js +7 -4
- package/cjs/enum.d.ts +8 -0
- package/cjs/enum.js +33 -1
- package/cjs/fn.js +45 -35
- package/cjs/list.js +24 -0
- package/cjs/math.d.ts +14 -0
- package/cjs/math.js +39 -0
- package/cjs/set-ex.d.ts +8 -7
- package/cjs/set-ex.js +51 -58
- package/cjs/sql.d.ts +89 -34
- package/cjs/sql.js +348 -223
- package/cjs/sqlite.d.ts +5 -8
- package/cjs/sqlite.js +25 -22
- package/cjs/test-mysql.js +29 -21
- package/es/boot-remote.js +5 -1
- package/es/boot.js +5 -1
- package/es/code.js +27 -12
- package/es/convert-xml.js +4 -4
- package/es/enum.d.ts +8 -0
- package/es/enum.js +31 -0
- package/es/fn.js +45 -35
- package/es/list.js +24 -0
- package/es/math.d.ts +14 -0
- package/es/math.js +37 -0
- package/es/set-ex.d.ts +8 -7
- package/es/set-ex.js +48 -58
- package/es/sql.d.ts +89 -34
- package/es/sql.js +349 -224
- package/es/sqlite.d.ts +5 -8
- package/es/sqlite.js +25 -22
- package/es/test-mysql.js +30 -22
- package/package.json +70 -70
- package/src/boot-remote.ts +5 -1
- package/src/boot.ts +5 -1
- package/src/code.ts +45 -14
- package/src/convert-xml.ts +4 -6
- package/src/enum.ts +43 -3
- package/src/fn.ts +41 -33
- package/src/list.ts +27 -1
- package/src/math.ts +41 -3
- package/src/object.ts +1 -1
- package/src/set-ex.ts +49 -58
- package/src/sql.ts +357 -214
- package/src/sqlite.ts +26 -20
- package/src/test-mysql.ts +30 -28
package/es/set-ex.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ export declare class SetEx<T> extends Set {
|
|
|
6
6
|
private _onExist2?;
|
|
7
7
|
private _onNotExist2?;
|
|
8
8
|
private _replaceIfExits2;
|
|
9
|
+
private _map;
|
|
9
10
|
/**
|
|
10
11
|
* @param key 识别是否存在的对象的属性名
|
|
11
12
|
* @param onExist 当存在时作何操作? oldData/newData 哪个将添加到set,由replaceItemWhenExits决定,默认是oldData生效
|
|
@@ -58,16 +59,16 @@ export declare class SetEx<T> extends Set {
|
|
|
58
59
|
addAll2(values: T[]): T[];
|
|
59
60
|
/**
|
|
60
61
|
* 用key找到匹配的第一个对象
|
|
61
|
-
* @param {*}
|
|
62
|
+
* @param {*} key 这是对象的关键属性,而非对象
|
|
62
63
|
* @returns {(T | null)}
|
|
63
64
|
*/
|
|
64
|
-
find(
|
|
65
|
+
find(key: T[keyof T]): T | null;
|
|
65
66
|
/**
|
|
66
67
|
* 用key找到匹配的所有对象
|
|
67
|
-
* @param {*}
|
|
68
|
+
* @param {*} key 这是对象的关键属性,而非对象
|
|
68
69
|
* @returns {T[]}
|
|
69
70
|
*/
|
|
70
|
-
findAll(
|
|
71
|
+
findAll(key: T[keyof T]): T[];
|
|
71
72
|
/**
|
|
72
73
|
*
|
|
73
74
|
* 用函数回调找到匹配的第一个对象
|
|
@@ -88,7 +89,7 @@ export declare class SetEx<T> extends Set {
|
|
|
88
89
|
* @param {*} value 这是对象的关键属性,而非对象
|
|
89
90
|
* @returns {boolean}
|
|
90
91
|
*/
|
|
91
|
-
has(
|
|
92
|
+
has(key: T[keyof T]): boolean;
|
|
92
93
|
/**
|
|
93
94
|
* 转为数组
|
|
94
95
|
* @param param0
|
|
@@ -118,10 +119,10 @@ export declare class SetEx<T> extends Set {
|
|
|
118
119
|
/**
|
|
119
120
|
*
|
|
120
121
|
* 删除key对应的对象
|
|
121
|
-
* @param {*}
|
|
122
|
+
* @param {*} _key 这是对象的关键属性,而非对象
|
|
122
123
|
* @returns {boolean}
|
|
123
124
|
*/
|
|
124
|
-
delete(
|
|
125
|
+
delete(_key: T[keyof T]): boolean;
|
|
125
126
|
/**
|
|
126
127
|
*
|
|
127
128
|
* 重置
|
package/es/set-ex.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import iterate from "iterare";
|
|
1
2
|
export class SetEx extends Set {
|
|
2
3
|
/**
|
|
3
4
|
* @param key 识别是否存在的对象的属性名
|
|
@@ -8,6 +9,7 @@ export class SetEx extends Set {
|
|
|
8
9
|
*/
|
|
9
10
|
constructor(option) {
|
|
10
11
|
super();
|
|
12
|
+
this._map = new Map();
|
|
11
13
|
this._key = option.key;
|
|
12
14
|
this._onExist1 = option.onExist1;
|
|
13
15
|
this._onNotExist1 = option.onNotExist1;
|
|
@@ -27,21 +29,22 @@ export class SetEx extends Set {
|
|
|
27
29
|
*/
|
|
28
30
|
add(value) {
|
|
29
31
|
let flag = false;
|
|
30
|
-
this.
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
if (this._replaceIfExits1 === true) {
|
|
37
|
-
super.delete(item);
|
|
38
|
-
flag = false;
|
|
39
|
-
}
|
|
40
|
-
return false;
|
|
32
|
+
const key = value[this._key];
|
|
33
|
+
const item = this._map.get(key);
|
|
34
|
+
if (item) {
|
|
35
|
+
flag = true;
|
|
36
|
+
if (this._onExist1) {
|
|
37
|
+
this._onExist1(item, value);
|
|
41
38
|
}
|
|
42
|
-
|
|
39
|
+
if (this._replaceIfExits1 === true) {
|
|
40
|
+
super.delete(item);
|
|
41
|
+
this._map.delete(key);
|
|
42
|
+
flag = false;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
43
45
|
if (flag === false) {
|
|
44
46
|
super.add(value);
|
|
47
|
+
this._map.set(key, value);
|
|
45
48
|
if (this._onNotExist1) {
|
|
46
49
|
this._onNotExist1(value);
|
|
47
50
|
}
|
|
@@ -67,25 +70,26 @@ export class SetEx extends Set {
|
|
|
67
70
|
*/
|
|
68
71
|
add2(value) {
|
|
69
72
|
let flag = false;
|
|
73
|
+
const key = value[this._key];
|
|
74
|
+
const item = this._map.get(key);
|
|
70
75
|
let tmp = value;
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
this._onExist2(item, value);
|
|
76
|
-
}
|
|
77
|
-
if (this._replaceIfExits2 === true) {
|
|
78
|
-
super.delete(value);
|
|
79
|
-
flag = false;
|
|
80
|
-
}
|
|
81
|
-
else {
|
|
82
|
-
tmp = item;
|
|
83
|
-
}
|
|
84
|
-
return false;
|
|
76
|
+
if (item) {
|
|
77
|
+
flag = true;
|
|
78
|
+
if (this._onExist2) {
|
|
79
|
+
this._onExist2(item, value);
|
|
85
80
|
}
|
|
86
|
-
|
|
81
|
+
if (this._replaceIfExits2 === true) {
|
|
82
|
+
super.delete(value);
|
|
83
|
+
this._map.delete(key);
|
|
84
|
+
flag = false;
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
tmp = item;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
87
90
|
if (flag === false) {
|
|
88
91
|
super.add(value);
|
|
92
|
+
this._map.set(key, value);
|
|
89
93
|
if (this._onNotExist2) {
|
|
90
94
|
this._onNotExist2(value);
|
|
91
95
|
}
|
|
@@ -107,30 +111,19 @@ export class SetEx extends Set {
|
|
|
107
111
|
}
|
|
108
112
|
/**
|
|
109
113
|
* 用key找到匹配的第一个对象
|
|
110
|
-
* @param {*}
|
|
114
|
+
* @param {*} key 这是对象的关键属性,而非对象
|
|
111
115
|
* @returns {(T | null)}
|
|
112
116
|
*/
|
|
113
|
-
find(
|
|
114
|
-
|
|
115
|
-
if (item[this._key] === value) {
|
|
116
|
-
return item;
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
return null;
|
|
117
|
+
find(key) {
|
|
118
|
+
return this._map.get(key) ?? null;
|
|
120
119
|
}
|
|
121
120
|
/**
|
|
122
121
|
* 用key找到匹配的所有对象
|
|
123
|
-
* @param {*}
|
|
122
|
+
* @param {*} key 这是对象的关键属性,而非对象
|
|
124
123
|
* @returns {T[]}
|
|
125
124
|
*/
|
|
126
|
-
findAll(
|
|
127
|
-
|
|
128
|
-
this.forEach((item) => {
|
|
129
|
-
if (item[this._key] === value) {
|
|
130
|
-
res.push(item);
|
|
131
|
-
}
|
|
132
|
-
});
|
|
133
|
-
return res;
|
|
125
|
+
findAll(key) {
|
|
126
|
+
return iterate(key).map(k => this._map.get(k)).filter(v => v !== undefined).toArray();
|
|
134
127
|
}
|
|
135
128
|
/**
|
|
136
129
|
*
|
|
@@ -167,13 +160,8 @@ export class SetEx extends Set {
|
|
|
167
160
|
* @param {*} value 这是对象的关键属性,而非对象
|
|
168
161
|
* @returns {boolean}
|
|
169
162
|
*/
|
|
170
|
-
has(
|
|
171
|
-
|
|
172
|
-
if (item[this._key] === value) {
|
|
173
|
-
return true;
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
return false;
|
|
163
|
+
has(key) {
|
|
164
|
+
return this._map.has(key);
|
|
177
165
|
}
|
|
178
166
|
/**
|
|
179
167
|
* 转为数组
|
|
@@ -209,15 +197,16 @@ export class SetEx extends Set {
|
|
|
209
197
|
/**
|
|
210
198
|
*
|
|
211
199
|
* 删除key对应的对象
|
|
212
|
-
* @param {*}
|
|
200
|
+
* @param {*} _key 这是对象的关键属性,而非对象
|
|
213
201
|
* @returns {boolean}
|
|
214
202
|
*/
|
|
215
|
-
delete(
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
203
|
+
delete(_key) {
|
|
204
|
+
const key = _key;
|
|
205
|
+
const item = this._map.get(key);
|
|
206
|
+
if (item) {
|
|
207
|
+
super.delete(item);
|
|
208
|
+
this._map.delete(key);
|
|
209
|
+
return true;
|
|
221
210
|
}
|
|
222
211
|
return false;
|
|
223
212
|
}
|
|
@@ -230,6 +219,7 @@ export class SetEx extends Set {
|
|
|
230
219
|
*/
|
|
231
220
|
reset(option) {
|
|
232
221
|
this.clear();
|
|
222
|
+
this._map.clear();
|
|
233
223
|
if (option.key) {
|
|
234
224
|
this._key = option.key;
|
|
235
225
|
}
|
package/es/sql.d.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { XML } from './convert-xml';
|
|
2
2
|
import { ArrayList } from './list';
|
|
3
|
+
import { EnumMap } from 'enum';
|
|
3
4
|
declare const _daoDBName: unique symbol;
|
|
4
5
|
declare const _tableName: unique symbol;
|
|
5
6
|
declare const _className: unique symbol;
|
|
6
7
|
declare const _ClassName: unique symbol;
|
|
7
8
|
declare const _vueName: unique symbol;
|
|
8
9
|
declare const _ids: unique symbol;
|
|
10
|
+
declare const _logicIds: unique symbol;
|
|
9
11
|
declare const _columns: unique symbol;
|
|
10
12
|
declare const _columnsNoId: unique symbol;
|
|
11
13
|
declare const _fields: unique symbol;
|
|
@@ -14,16 +16,19 @@ declare const _deleteState: unique symbol;
|
|
|
14
16
|
declare const _transformer: unique symbol;
|
|
15
17
|
declare const _index: unique symbol;
|
|
16
18
|
declare const _def: unique symbol;
|
|
19
|
+
declare const _comment: unique symbol;
|
|
17
20
|
export declare const _sqlCache: unique symbol;
|
|
18
21
|
export declare const _dao: unique symbol;
|
|
19
22
|
export declare const _primaryDB: unique symbol;
|
|
20
23
|
declare const _dbType: unique symbol;
|
|
24
|
+
declare const _formatDialect: unique symbol;
|
|
21
25
|
declare const _sqlite_version: unique symbol;
|
|
22
26
|
declare const _daoConnection: unique symbol;
|
|
23
27
|
declare const _inTransaction: unique symbol;
|
|
24
28
|
declare const _daoDB: unique symbol;
|
|
25
29
|
declare const _sqliteRemoteName: unique symbol;
|
|
26
30
|
declare const _SqlOption: unique symbol;
|
|
31
|
+
export declare const _enums: unique symbol;
|
|
27
32
|
export declare const _Hump: unique symbol;
|
|
28
33
|
export declare const _GlobalSqlOption: unique symbol;
|
|
29
34
|
export declare const _EventBus: unique symbol;
|
|
@@ -213,6 +218,8 @@ interface ServiceOption {
|
|
|
213
218
|
dbType?: DBType;
|
|
214
219
|
/** SQLite版本以及升级为该版本时需要执行的SQL,初始版本为0.0.1,切记每个位置不要变为两位数*/
|
|
215
220
|
sqliteVersion?: string;
|
|
221
|
+
/** 备注 */
|
|
222
|
+
comment?: string;
|
|
216
223
|
}
|
|
217
224
|
/**
|
|
218
225
|
# 全局行为配置文件
|
|
@@ -274,6 +281,23 @@ export interface GlobalSqlOptionForWeb {
|
|
|
274
281
|
]
|
|
275
282
|
*/
|
|
276
283
|
sqlMapperMap?: SqlMappers;
|
|
284
|
+
/** 提供的枚举MAP */
|
|
285
|
+
enums?: EnumMap;
|
|
286
|
+
/**
|
|
287
|
+
* `列名与属性映射` 是否自动将下划线转为驼峰,默认NONE,即不转.
|
|
288
|
+
* 当设置为columnMode.HUMP时,切记将代码生成器中属性名称改对
|
|
289
|
+
* # 自定义sql查询时,无法自动转换哦,可使用标签转换:
|
|
290
|
+
*```
|
|
291
|
+
SELECT
|
|
292
|
+
* {{#hump}} seller_sku2, seller_sku {{/hump}}
|
|
293
|
+
* ```
|
|
294
|
+
* 转换为
|
|
295
|
+
*```
|
|
296
|
+
SELECT
|
|
297
|
+
* {{#hump}} seller_sku2 sellerSku2, seller_sku sellerSku {{/hump}}
|
|
298
|
+
* ```
|
|
299
|
+
*/
|
|
300
|
+
columnMode?: ColumnMode;
|
|
277
301
|
}
|
|
278
302
|
/**
|
|
279
303
|
# 全局行为配置文件
|
|
@@ -335,12 +359,13 @@ export interface GlobalSqlOption extends GlobalSqlOptionForWeb {
|
|
|
335
359
|
export default {
|
|
336
360
|
'sql_1': 'SELECT * FROM user WHERE username = :username',
|
|
337
361
|
'sql_2': (options: {
|
|
338
|
-
ctx
|
|
362
|
+
ctx?: any;
|
|
339
363
|
isCount?: boolean;
|
|
364
|
+
isSum?: boolean;
|
|
340
365
|
limitStart?: number;
|
|
341
366
|
limitEnd?: number;
|
|
342
367
|
orderBy?: string;
|
|
343
|
-
|
|
368
|
+
params?: Record<string, any>;
|
|
344
369
|
}) => {
|
|
345
370
|
return `
|
|
346
371
|
SELECT * FROM user u LEFT JOIN organ o ON u.orgid = o.orgid
|
|
@@ -405,21 +430,6 @@ export interface GlobalSqlOption extends GlobalSqlOptionForWeb {
|
|
|
405
430
|
```
|
|
406
431
|
*/
|
|
407
432
|
Redis?: Record<string, Record<string, any>> | Record<string, any>;
|
|
408
|
-
/**
|
|
409
|
-
* `列名与属性映射` 是否自动将下划线转为驼峰,默认NONE,即不转.
|
|
410
|
-
* 当设置为columnMode.HUMP时,切记将代码生成器中属性名称改对
|
|
411
|
-
* # 自定义sql查询时,无法自动转换哦,可使用标签转换:
|
|
412
|
-
*```
|
|
413
|
-
SELECT
|
|
414
|
-
* {{#hump}} seller_sku2, seller_sku {{/hump}}
|
|
415
|
-
* ```
|
|
416
|
-
* 转换为
|
|
417
|
-
*```
|
|
418
|
-
SELECT
|
|
419
|
-
* {{#hump}} seller_sku2 sellerSku2, seller_sku sellerSku {{/hump}}
|
|
420
|
-
* ```
|
|
421
|
-
*/
|
|
422
|
-
columnMode?: ColumnMode;
|
|
423
433
|
/**
|
|
424
434
|
* 读取查询语句时,是否扫描JS文件?
|
|
425
435
|
* JS文件需要默认导出一个 SqlModel对象
|
|
@@ -436,9 +446,16 @@ interface FieldOption extends Object {
|
|
|
436
446
|
index?: boolean;
|
|
437
447
|
id?: boolean;
|
|
438
448
|
logicDelete?: string | number;
|
|
449
|
+
/** 是否逻辑唯一,用于导入时检测数据是否存在 */
|
|
450
|
+
logicId?: boolean;
|
|
439
451
|
/** 仅在生成 表时有效 */
|
|
440
452
|
notNull?: boolean;
|
|
453
|
+
/** 注释,影响到默认导出导入标题 */
|
|
441
454
|
comment?: string;
|
|
455
|
+
/** 可以导入的字段,默认TRUE,ID默认FALSE */
|
|
456
|
+
importable?: boolean;
|
|
457
|
+
/** 可以导出的字段,默认TRUE,ID默认FALSE */
|
|
458
|
+
exportable?: boolean;
|
|
442
459
|
/** sqlite 无效,与UUID只能有一个 */
|
|
443
460
|
uuidShort?: boolean;
|
|
444
461
|
/** 与uuidShort只能有一个 */
|
|
@@ -454,6 +471,7 @@ interface AField extends FieldOption {
|
|
|
454
471
|
[DBType.Mysql]: () => string;
|
|
455
472
|
[DBType.Sqlite]: () => string;
|
|
456
473
|
[DBType.SqliteRemote]: () => string;
|
|
474
|
+
Data2SQL: (data: any) => any;
|
|
457
475
|
}
|
|
458
476
|
export interface PageQuery<L> {
|
|
459
477
|
sum?: Record<string, number>;
|
|
@@ -463,14 +481,11 @@ export interface PageQuery<L> {
|
|
|
463
481
|
}
|
|
464
482
|
/** sqlite electron服务端需要支持的接口 */
|
|
465
483
|
export interface SqliteRemoteInterface {
|
|
466
|
-
execute(
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
get<One_Row_Many_Column = any>(dbName: string, sql?: string, params?: any): Promise<One_Row_Many_Column | null>;
|
|
472
|
-
raw<Many_Row_One_Column = any>(dbName: string, sql?: string, params?: any): Promise<Many_Row_One_Column[]>;
|
|
473
|
-
query<Many_Row_Many_Column = any>(dbName: string, sql?: string, params?: any): Promise<Many_Row_Many_Column[]>;
|
|
484
|
+
execute(inData: Uint8Array): Promise<Uint8Array>;
|
|
485
|
+
pluck(inData: Uint8Array): Promise<Uint8Array>;
|
|
486
|
+
get(inData: Uint8Array): Promise<Uint8Array>;
|
|
487
|
+
raw(inData: Uint8Array): Promise<Uint8Array>;
|
|
488
|
+
query(inData: Uint8Array): Promise<Uint8Array>;
|
|
474
489
|
initDB(dbName: string): Promise<void>;
|
|
475
490
|
export(dbName: string): Promise<void>;
|
|
476
491
|
restore(dbName: string, fromName: string): Promise<void>;
|
|
@@ -575,6 +590,7 @@ export declare class SqliteRemoteConnection implements Connection {
|
|
|
575
590
|
export declare class SqliteRemote implements Dao {
|
|
576
591
|
[_sqliteRemoteName]: string;
|
|
577
592
|
[_daoDB]: SqliteRemoteInterface;
|
|
593
|
+
private connection?;
|
|
578
594
|
constructor(db: SqliteRemoteInterface, name: string);
|
|
579
595
|
createConnection(sync: SyncMode.Sync): Connection | null;
|
|
580
596
|
createConnection(sync: SyncMode.Async): Promise<Connection | null>;
|
|
@@ -592,22 +608,22 @@ export declare class SqliteRemote implements Dao {
|
|
|
592
608
|
export type SqlMapper = ([string, string[], any?])[];
|
|
593
609
|
export type SqlMappers = Record<string, SqlMapper>;
|
|
594
610
|
export type SqlModel = Record<string, string | ((options: {
|
|
595
|
-
ctx
|
|
611
|
+
ctx?: any;
|
|
596
612
|
isCount?: boolean;
|
|
597
613
|
isSum?: boolean;
|
|
598
614
|
limitStart?: number;
|
|
599
615
|
limitEnd?: number;
|
|
600
616
|
orderBy?: string;
|
|
601
|
-
|
|
617
|
+
params?: any;
|
|
602
618
|
}) => string)>;
|
|
603
619
|
type _SqlModel = Record<string, string | ((options: {
|
|
604
|
-
ctx
|
|
620
|
+
ctx?: any;
|
|
605
621
|
isCount?: boolean;
|
|
606
622
|
isSum?: boolean;
|
|
607
623
|
limitStart?: number;
|
|
608
624
|
limitEnd?: number;
|
|
609
625
|
orderBy?: string;
|
|
610
|
-
|
|
626
|
+
params?: any;
|
|
611
627
|
}) => string) | XML[]>;
|
|
612
628
|
/**
|
|
613
629
|
* ifUndefined默认是MapperIfUndefined.Skip
|
|
@@ -644,7 +660,7 @@ export declare class SqlCache {
|
|
|
644
660
|
jsMode?: boolean;
|
|
645
661
|
}): Promise<void>;
|
|
646
662
|
load(sqlids: string[], options: {
|
|
647
|
-
ctx
|
|
663
|
+
ctx?: any;
|
|
648
664
|
isCount?: boolean;
|
|
649
665
|
isSum?: boolean;
|
|
650
666
|
limitStart?: number;
|
|
@@ -664,6 +680,7 @@ export declare const DB: (config: ServiceOption) => <C extends {
|
|
|
664
680
|
[_vueName]: string | undefined;
|
|
665
681
|
[_daoDBName]: string | undefined;
|
|
666
682
|
[_dbType]: DBType;
|
|
683
|
+
[_formatDialect]: any;
|
|
667
684
|
[_sqlite_version]: string | undefined;
|
|
668
685
|
[_SqlOption]: {
|
|
669
686
|
maxDeal: number;
|
|
@@ -672,11 +689,13 @@ export declare const DB: (config: ServiceOption) => <C extends {
|
|
|
672
689
|
skipEmptyString: boolean;
|
|
673
690
|
} & ServiceOption;
|
|
674
691
|
[_ids]: any;
|
|
692
|
+
[_logicIds]: any;
|
|
675
693
|
[_fields]: any;
|
|
676
694
|
[_columns]: any;
|
|
677
695
|
[_columnsNoId]: any;
|
|
678
696
|
[_index]: any;
|
|
679
697
|
[_def]: any;
|
|
698
|
+
[_comment]: string | undefined;
|
|
680
699
|
[_stateFileName]: any;
|
|
681
700
|
[_deleteState]: any;
|
|
682
701
|
[_transformer]: <L extends Object>(data: L, option?: MethodOption & {
|
|
@@ -733,6 +752,7 @@ export declare class SqlService<T extends object> {
|
|
|
733
752
|
private [_ClassName]?;
|
|
734
753
|
private [_vueName]?;
|
|
735
754
|
private [_daoDBName]?;
|
|
755
|
+
private [_comment]?;
|
|
736
756
|
private [_ids]?;
|
|
737
757
|
private [_fields]?;
|
|
738
758
|
private [_columns]?;
|
|
@@ -741,6 +761,7 @@ export declare class SqlService<T extends object> {
|
|
|
741
761
|
private [_deleteState]?;
|
|
742
762
|
private [_SqlOption]?;
|
|
743
763
|
private [_dbType]?;
|
|
764
|
+
private [_formatDialect]?;
|
|
744
765
|
private [_sqlite_version]?;
|
|
745
766
|
private [_index]?;
|
|
746
767
|
private [_def]?;
|
|
@@ -1246,8 +1267,8 @@ export declare class SqlService<T extends object> {
|
|
|
1246
1267
|
sqlId: string;
|
|
1247
1268
|
context?: any;
|
|
1248
1269
|
params: Record<string, any>;
|
|
1249
|
-
pageSize
|
|
1250
|
-
pageNumber
|
|
1270
|
+
pageSize?: number;
|
|
1271
|
+
pageNumber?: number;
|
|
1251
1272
|
limitSelf?: boolean;
|
|
1252
1273
|
countSelf?: boolean;
|
|
1253
1274
|
sumSelf?: boolean;
|
|
@@ -1261,8 +1282,8 @@ export declare class SqlService<T extends object> {
|
|
|
1261
1282
|
sqlId: string;
|
|
1262
1283
|
context?: any;
|
|
1263
1284
|
params: Record<string, any>;
|
|
1264
|
-
pageSize
|
|
1265
|
-
pageNumber
|
|
1285
|
+
pageSize?: number;
|
|
1286
|
+
pageNumber?: number;
|
|
1266
1287
|
limitSelf?: boolean;
|
|
1267
1288
|
countSelf?: boolean;
|
|
1268
1289
|
sumSelf?: boolean;
|
|
@@ -1271,6 +1292,40 @@ export declare class SqlService<T extends object> {
|
|
|
1271
1292
|
mapper?: string | SqlMapper;
|
|
1272
1293
|
mapperIfUndefined?: MapperIfUndefined;
|
|
1273
1294
|
}): PageQuery<L>;
|
|
1295
|
+
/**
|
|
1296
|
+
* 导出数据,可以为EJS-EXCEL直接使用
|
|
1297
|
+
* @param list
|
|
1298
|
+
* @returns
|
|
1299
|
+
*/
|
|
1300
|
+
exp<L = T>(list: L[]): {
|
|
1301
|
+
title: string | undefined;
|
|
1302
|
+
titleSpan: string;
|
|
1303
|
+
columnTitles: string[];
|
|
1304
|
+
datas: any[][];
|
|
1305
|
+
};
|
|
1306
|
+
/**
|
|
1307
|
+
* 导入数据的模板
|
|
1308
|
+
* @returns
|
|
1309
|
+
*/
|
|
1310
|
+
imp(): {
|
|
1311
|
+
title: string | undefined;
|
|
1312
|
+
titleSpan: string;
|
|
1313
|
+
columnTitles: string[];
|
|
1314
|
+
};
|
|
1315
|
+
/**
|
|
1316
|
+
* 初始化表结构
|
|
1317
|
+
* 只有sqlite、sqliteremote需要
|
|
1318
|
+
* force: 是否强制,默认false, 强制时会删除再创建
|
|
1319
|
+
* @param option
|
|
1320
|
+
*/
|
|
1321
|
+
init(option?: MethodOption & {
|
|
1322
|
+
sync?: SyncMode.Async;
|
|
1323
|
+
force?: boolean;
|
|
1324
|
+
}): Promise<void>;
|
|
1325
|
+
init(option: MethodOption & {
|
|
1326
|
+
sync: SyncMode.Sync;
|
|
1327
|
+
force?: boolean;
|
|
1328
|
+
}): void;
|
|
1274
1329
|
/**
|
|
1275
1330
|
#创建表
|
|
1276
1331
|
** `tableName` 表名称
|