baja-lite 1.5.14 → 1.5.16
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/code.js +7 -2
- package/package.json +5 -5
- package/sql.d.ts +16 -0
- package/sql.js +80 -0
- package/test-mysql.d.ts +0 -2
- package/test-mysql.js +0 -109
- package/test-postgresql.d.ts +0 -2
- package/test-postgresql.js +0 -91
- package/test-sqlite.d.ts +0 -1
- package/test-sqlite.js +0 -90
- package/test-xml.d.ts +0 -1
- package/test-xml.js +0 -70
- package/test.d.ts +0 -1
- package/test.js +0 -2
package/code.js
CHANGED
|
@@ -48,8 +48,13 @@ const lxMap = {
|
|
|
48
48
|
geometrycollection: "Object"
|
|
49
49
|
};
|
|
50
50
|
let force = false;
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
let basepath = path.join(import.meta.dirname, '..', '..');
|
|
52
|
+
try {
|
|
53
|
+
fs.statSync(`${basepath}/baja.code.json`);
|
|
54
|
+
}
|
|
55
|
+
catch (error) {
|
|
56
|
+
basepath = path.join(import.meta.dirname, '..', '..', '..', '..', '..');
|
|
57
|
+
}
|
|
53
58
|
const config = path.join(basepath, 'baja.code.json');
|
|
54
59
|
const templatePath = path.join(basepath, 'code-template');
|
|
55
60
|
console.log(`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "baja-lite",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.16",
|
|
4
4
|
"description": "some util for self",
|
|
5
5
|
"homepage": "https://github.com/void-soul/baja-lite",
|
|
6
6
|
"repository": {
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"@types/request-promise": "4.1.51",
|
|
40
40
|
"axios": "1.10.0",
|
|
41
41
|
"baja-lite-field": "1.4.13",
|
|
42
|
-
"decimal.js": "10.
|
|
42
|
+
"decimal.js": "10.6.0",
|
|
43
43
|
"html-parse-stringify": "3.0.1",
|
|
44
44
|
"iterare": "1.2.1",
|
|
45
45
|
"lodash.get": "4.4.2",
|
|
@@ -57,11 +57,11 @@
|
|
|
57
57
|
"@types/better-sqlite3": "7.6.13",
|
|
58
58
|
"@types/lodash.get": "4.4.9",
|
|
59
59
|
"@types/mustache": "4.2.6",
|
|
60
|
-
"@types/node": "24.0.
|
|
60
|
+
"@types/node": "24.0.12",
|
|
61
61
|
"@types/shelljs": "0.8.17",
|
|
62
62
|
"@types/sqlstring": "2.3.2",
|
|
63
|
-
"@typescript-eslint/eslint-plugin": "8.
|
|
64
|
-
"@typescript-eslint/parser": "8.
|
|
63
|
+
"@typescript-eslint/eslint-plugin": "8.36.0",
|
|
64
|
+
"@typescript-eslint/parser": "8.36.0",
|
|
65
65
|
"better-sqlite3": "12.2.0",
|
|
66
66
|
"ioredis": "5.6.1",
|
|
67
67
|
"mongodb": "6.17.0",
|
package/sql.d.ts
CHANGED
|
@@ -1641,6 +1641,10 @@ declare class StreamQuery<T extends object> {
|
|
|
1641
1641
|
isNULL(key: keyof T): this;
|
|
1642
1642
|
/** AND key IS NOT NULL */
|
|
1643
1643
|
isNotNULL(key: keyof T): this;
|
|
1644
|
+
/** AND (key IS NULL OR key = '') */
|
|
1645
|
+
isEmpty(key: keyof T): this;
|
|
1646
|
+
/** AND key IS NOT NULL AND key <> ''*/
|
|
1647
|
+
isNotEmpty(key: keyof T): this;
|
|
1644
1648
|
/** AND key BETWEEN :value1 AND :value2 */
|
|
1645
1649
|
between(key: keyof T, value1: string | number, value2: string | number, { paramName, skipEmptyString, breakExcuteIfEmpty }?: {
|
|
1646
1650
|
paramName?: string | undefined;
|
|
@@ -1721,6 +1725,18 @@ declare class StreamQuery<T extends object> {
|
|
|
1721
1725
|
skipEmptyString?: boolean | undefined;
|
|
1722
1726
|
breakExcuteIfEmpty?: boolean | undefined;
|
|
1723
1727
|
}): this;
|
|
1728
|
+
/** AND FIND_IN_SET(:value, key) */
|
|
1729
|
+
findInSet(key: keyof T, value: string | number, { paramName, skipEmptyString, breakExcuteIfEmpty }?: {
|
|
1730
|
+
paramName?: string | undefined;
|
|
1731
|
+
skipEmptyString?: boolean | undefined;
|
|
1732
|
+
breakExcuteIfEmpty?: boolean | undefined;
|
|
1733
|
+
}): this;
|
|
1734
|
+
/** AND FIND_IN_SET(key, :value) */
|
|
1735
|
+
findInSet2(key: keyof T, value: string | number, { paramName, skipEmptyString, breakExcuteIfEmpty }?: {
|
|
1736
|
+
paramName?: string | undefined;
|
|
1737
|
+
skipEmptyString?: boolean | undefined;
|
|
1738
|
+
breakExcuteIfEmpty?: boolean | undefined;
|
|
1739
|
+
}): this;
|
|
1724
1740
|
and(fn: StreamQuery<T> | ((stream: StreamQuery<T>) => boolean | void)): this;
|
|
1725
1741
|
or(fn: StreamQuery<T> | ((stream: StreamQuery<T>) => boolean | void)): this;
|
|
1726
1742
|
/** SET key = IFNULL(key, 0) + :value */
|
package/sql.js
CHANGED
|
@@ -3601,6 +3601,16 @@ class StreamQuery {
|
|
|
3601
3601
|
isNULL(key) { return this._null(key); }
|
|
3602
3602
|
/** AND key IS NOT NULL */
|
|
3603
3603
|
isNotNULL(key) { return this._null(key, 'NOT'); }
|
|
3604
|
+
/** AND (key IS NULL OR key = '') */
|
|
3605
|
+
isEmpty(key) {
|
|
3606
|
+
this._wheres.push(`AND (${this[_fields][String(key)]?.C2()} IS NULL OR ${this[_fields][String(key)]?.C2()} = '')`);
|
|
3607
|
+
return this;
|
|
3608
|
+
}
|
|
3609
|
+
/** AND key IS NOT NULL AND key <> ''*/
|
|
3610
|
+
isNotEmpty(key) {
|
|
3611
|
+
this._wheres.push(`AND ${this[_fields][String(key)]?.C2()} IS NOT NULL AND ${this[_fields][String(key)]?.C2()} <> ''`);
|
|
3612
|
+
return this;
|
|
3613
|
+
}
|
|
3604
3614
|
/** AND key BETWEEN :value1 AND :value2 */
|
|
3605
3615
|
between(key, value1, value2, { paramName = '', skipEmptyString = true, breakExcuteIfEmpty = true } = {}) { return this._between(key, value1, value2, { paramName, skipEmptyString, breakExcuteIfEmpty }); }
|
|
3606
3616
|
/** AND key NOT BETWEEN :value1 AND :value2 */
|
|
@@ -3629,6 +3639,52 @@ class StreamQuery {
|
|
|
3629
3639
|
includes(key, value, { paramName = '', skipEmptyString = true, breakExcuteIfEmpty = true } = {}) { return this._includes(key, value, { paramName, skipEmptyString, breakExcuteIfEmpty }); }
|
|
3630
3640
|
/** AND NOT LOCATE(key, :value) = 0 */
|
|
3631
3641
|
notIncludes(key, value, { paramName = '', skipEmptyString = true, breakExcuteIfEmpty = true } = {}) { return this._includes(key, value, { paramName, skipEmptyString, not: 'NOT', breakExcuteIfEmpty }); }
|
|
3642
|
+
/** AND FIND_IN_SET(:value, key) */
|
|
3643
|
+
findInSet(key, value, { paramName = '', skipEmptyString = true, breakExcuteIfEmpty = true } = {}) {
|
|
3644
|
+
if (value === null
|
|
3645
|
+
|| value === undefined
|
|
3646
|
+
|| (emptyString(`${value ?? ''}`) && skipEmptyString)) {
|
|
3647
|
+
if (breakExcuteIfEmpty) {
|
|
3648
|
+
this.if_exec = false;
|
|
3649
|
+
}
|
|
3650
|
+
return this;
|
|
3651
|
+
}
|
|
3652
|
+
if (paramName !== undefined && this._paramKeys.hasOwnProperty(paramName)) {
|
|
3653
|
+
this._param[this._paramKeys[paramName]] = value;
|
|
3654
|
+
}
|
|
3655
|
+
else {
|
|
3656
|
+
const pkey = `p${this._prefix}${this._index++}`;
|
|
3657
|
+
this._wheres.push(`AND FIND_IN_SET(:${pkey}, ${this[_fields][String(key)]?.C2()})`);
|
|
3658
|
+
this._param[pkey] = value;
|
|
3659
|
+
if (paramName) {
|
|
3660
|
+
this._paramKeys[paramName] = pkey;
|
|
3661
|
+
}
|
|
3662
|
+
}
|
|
3663
|
+
return this;
|
|
3664
|
+
}
|
|
3665
|
+
/** AND FIND_IN_SET(key, :value) */
|
|
3666
|
+
findInSet2(key, value, { paramName = '', skipEmptyString = true, breakExcuteIfEmpty = true } = {}) {
|
|
3667
|
+
if (value === null
|
|
3668
|
+
|| value === undefined
|
|
3669
|
+
|| (emptyString(`${value ?? ''}`) && skipEmptyString)) {
|
|
3670
|
+
if (breakExcuteIfEmpty) {
|
|
3671
|
+
this.if_exec = false;
|
|
3672
|
+
}
|
|
3673
|
+
return this;
|
|
3674
|
+
}
|
|
3675
|
+
if (paramName !== undefined && this._paramKeys.hasOwnProperty(paramName)) {
|
|
3676
|
+
this._param[this._paramKeys[paramName]] = value;
|
|
3677
|
+
}
|
|
3678
|
+
else {
|
|
3679
|
+
const pkey = `p${this._prefix}${this._index++}`;
|
|
3680
|
+
this._wheres.push(`AND FIND_IN_SET(${this[_fields][String(key)]?.C2()}, :${pkey})`);
|
|
3681
|
+
this._param[pkey] = value;
|
|
3682
|
+
if (paramName) {
|
|
3683
|
+
this._paramKeys[paramName] = pkey;
|
|
3684
|
+
}
|
|
3685
|
+
}
|
|
3686
|
+
return this;
|
|
3687
|
+
}
|
|
3632
3688
|
and(fn) {
|
|
3633
3689
|
if (fn instanceof StreamQuery) {
|
|
3634
3690
|
this._andQuerys.push(fn);
|
|
@@ -4393,6 +4449,18 @@ __decorate([
|
|
|
4393
4449
|
__metadata("design:paramtypes", [Object]),
|
|
4394
4450
|
__metadata("design:returntype", void 0)
|
|
4395
4451
|
], StreamQuery.prototype, "isNotNULL", null);
|
|
4452
|
+
__decorate([
|
|
4453
|
+
IF_PROCEED(),
|
|
4454
|
+
__metadata("design:type", Function),
|
|
4455
|
+
__metadata("design:paramtypes", [Object]),
|
|
4456
|
+
__metadata("design:returntype", void 0)
|
|
4457
|
+
], StreamQuery.prototype, "isEmpty", null);
|
|
4458
|
+
__decorate([
|
|
4459
|
+
IF_PROCEED(),
|
|
4460
|
+
__metadata("design:type", Function),
|
|
4461
|
+
__metadata("design:paramtypes", [Object]),
|
|
4462
|
+
__metadata("design:returntype", void 0)
|
|
4463
|
+
], StreamQuery.prototype, "isNotEmpty", null);
|
|
4396
4464
|
__decorate([
|
|
4397
4465
|
IF_PROCEED(),
|
|
4398
4466
|
__metadata("design:type", Function),
|
|
@@ -4477,6 +4545,18 @@ __decorate([
|
|
|
4477
4545
|
__metadata("design:paramtypes", [Object, Object, Object]),
|
|
4478
4546
|
__metadata("design:returntype", void 0)
|
|
4479
4547
|
], StreamQuery.prototype, "notIncludes", null);
|
|
4548
|
+
__decorate([
|
|
4549
|
+
IF_PROCEED(),
|
|
4550
|
+
__metadata("design:type", Function),
|
|
4551
|
+
__metadata("design:paramtypes", [Object, Object, Object]),
|
|
4552
|
+
__metadata("design:returntype", void 0)
|
|
4553
|
+
], StreamQuery.prototype, "findInSet", null);
|
|
4554
|
+
__decorate([
|
|
4555
|
+
IF_PROCEED(),
|
|
4556
|
+
__metadata("design:type", Function),
|
|
4557
|
+
__metadata("design:paramtypes", [Object, Object, Object]),
|
|
4558
|
+
__metadata("design:returntype", void 0)
|
|
4559
|
+
], StreamQuery.prototype, "findInSet2", null);
|
|
4480
4560
|
__decorate([
|
|
4481
4561
|
IF_PROCEED(),
|
|
4482
4562
|
__metadata("design:type", Function),
|
package/test-mysql.d.ts
DELETED
package/test-mysql.js
DELETED
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
-
};
|
|
10
|
-
import { Field, SqlType } from 'baja-lite-field';
|
|
11
|
-
import 'reflect-metadata';
|
|
12
|
-
import { Boot } from './boot.js';
|
|
13
|
-
import { ColumnMode, DB, SqlService } from './sql.js';
|
|
14
|
-
class BaseAuditUser {
|
|
15
|
-
}
|
|
16
|
-
__decorate([
|
|
17
|
-
Field({ type: SqlType.varchar, length: 32, id: true, notNull: true, uuidShort: true }),
|
|
18
|
-
__metadata("design:type", String)
|
|
19
|
-
], BaseAuditUser.prototype, "auditId", void 0);
|
|
20
|
-
__decorate([
|
|
21
|
-
Field({ type: SqlType.varchar, length: 32, comment: '密码' }),
|
|
22
|
-
__metadata("design:type", String)
|
|
23
|
-
], BaseAuditUser.prototype, "password", void 0);
|
|
24
|
-
__decorate([
|
|
25
|
-
Field({ type: SqlType.varchar, length: 255, comment: '省' }),
|
|
26
|
-
__metadata("design:type", String)
|
|
27
|
-
], BaseAuditUser.prototype, "userProvinceCode", void 0);
|
|
28
|
-
__decorate([
|
|
29
|
-
Field({ type: SqlType.varchar, length: 255, comment: '省' }),
|
|
30
|
-
__metadata("design:type", String)
|
|
31
|
-
], BaseAuditUser.prototype, "userProvince", void 0);
|
|
32
|
-
__decorate([
|
|
33
|
-
Field({ type: SqlType.varchar, length: 32, comment: '显示名称' }),
|
|
34
|
-
__metadata("design:type", String)
|
|
35
|
-
], BaseAuditUser.prototype, "labelName", void 0);
|
|
36
|
-
__decorate([
|
|
37
|
-
Field({ type: SqlType.varchar, length: 32, comment: '备注名称' }),
|
|
38
|
-
__metadata("design:type", String)
|
|
39
|
-
], BaseAuditUser.prototype, "remarkName", void 0);
|
|
40
|
-
__decorate([
|
|
41
|
-
Field({ type: SqlType.varchar, length: 32, comment: '初始密码' }),
|
|
42
|
-
__metadata("design:type", String)
|
|
43
|
-
], BaseAuditUser.prototype, "upassword", void 0);
|
|
44
|
-
__decorate([
|
|
45
|
-
Field({ type: SqlType.char, length: 1, def: 0, comment: '是否中心' }),
|
|
46
|
-
__metadata("design:type", String)
|
|
47
|
-
], BaseAuditUser.prototype, "baseType", void 0);
|
|
48
|
-
__decorate([
|
|
49
|
-
Field({ type: SqlType.varchar, length: 32 }),
|
|
50
|
-
__metadata("design:type", String)
|
|
51
|
-
], BaseAuditUser.prototype, "userId", void 0);
|
|
52
|
-
__decorate([
|
|
53
|
-
Field({ type: SqlType.varchar, length: 32 }),
|
|
54
|
-
__metadata("design:type", String)
|
|
55
|
-
], BaseAuditUser.prototype, "companyId", void 0);
|
|
56
|
-
__decorate([
|
|
57
|
-
Field({ type: SqlType.varchar, length: 32 }),
|
|
58
|
-
__metadata("design:type", String)
|
|
59
|
-
], BaseAuditUser.prototype, "username", void 0);
|
|
60
|
-
__decorate([
|
|
61
|
-
Field({ type: SqlType.char, length: 1, def: 0, comment: '状态' }),
|
|
62
|
-
__metadata("design:type", String)
|
|
63
|
-
], BaseAuditUser.prototype, "userStatus", void 0);
|
|
64
|
-
__decorate([
|
|
65
|
-
Field({ type: SqlType.char, length: 1, def: 0, comment: '账户分组' }),
|
|
66
|
-
__metadata("design:type", String)
|
|
67
|
-
], BaseAuditUser.prototype, "groupId", void 0);
|
|
68
|
-
__decorate([
|
|
69
|
-
Field({ type: SqlType.varchar, length: 10 }),
|
|
70
|
-
__metadata("design:type", String)
|
|
71
|
-
], BaseAuditUser.prototype, "startDate", void 0);
|
|
72
|
-
__decorate([
|
|
73
|
-
Field({ type: SqlType.varchar, length: 10 }),
|
|
74
|
-
__metadata("design:type", String)
|
|
75
|
-
], BaseAuditUser.prototype, "endDate", void 0);
|
|
76
|
-
let BaseAuditUserService = class BaseAuditUserService extends SqlService {
|
|
77
|
-
};
|
|
78
|
-
BaseAuditUserService = __decorate([
|
|
79
|
-
DB({ tableName: 'base_audit_user', clz: BaseAuditUser })
|
|
80
|
-
], BaseAuditUserService);
|
|
81
|
-
export async function go2() {
|
|
82
|
-
await Boot({
|
|
83
|
-
Mysql: {
|
|
84
|
-
host: '127.0.0.1',
|
|
85
|
-
port: 3306,
|
|
86
|
-
user: 'root',
|
|
87
|
-
password: 'abcd1234',
|
|
88
|
-
// 数据库名
|
|
89
|
-
database: 'sportevent',
|
|
90
|
-
debug: false
|
|
91
|
-
},
|
|
92
|
-
log: 'trace',
|
|
93
|
-
columnMode: ColumnMode.HUMP,
|
|
94
|
-
sqlDir: 'E:/pro/baja-lite/xml',
|
|
95
|
-
sqlMap: {
|
|
96
|
-
['test.test']: `SELECT * FROM cp_user {{#username}} WHERE username = :username {{/username}}`
|
|
97
|
-
}
|
|
98
|
-
});
|
|
99
|
-
const service = new BaseAuditUserService();
|
|
100
|
-
const list = await service.transaction({
|
|
101
|
-
fn: async (conn) => {
|
|
102
|
-
await service.stream().eq('baseType', '0').in('auditId', ['162400829591265280', '162201628882247680']).excuteSelect();
|
|
103
|
-
const data = await service.stream().in('auditId', ['162400829591265280', '162201628882247680']).update('labelName', '333').excuteUpdate({ conn });
|
|
104
|
-
return data;
|
|
105
|
-
}
|
|
106
|
-
});
|
|
107
|
-
console.log(11, list);
|
|
108
|
-
}
|
|
109
|
-
go2();
|
package/test-postgresql.d.ts
DELETED
package/test-postgresql.js
DELETED
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
-
};
|
|
10
|
-
import { DBType, Field, SqlType } from 'baja-lite-field';
|
|
11
|
-
import 'reflect-metadata';
|
|
12
|
-
import { Boot } from './boot.js';
|
|
13
|
-
import { ColumnMode, DB, SelectResult, SqlService, } from './sql.js';
|
|
14
|
-
class AmaFuck2 {
|
|
15
|
-
}
|
|
16
|
-
__decorate([
|
|
17
|
-
Field({ type: SqlType.int, length: 200, id: true, uuid: true }),
|
|
18
|
-
__metadata("design:type", Number)
|
|
19
|
-
], AmaFuck2.prototype, "userid", void 0);
|
|
20
|
-
__decorate([
|
|
21
|
-
Field({ type: SqlType.varchar, length: 200, def: '333' }),
|
|
22
|
-
__metadata("design:type", String)
|
|
23
|
-
], AmaFuck2.prototype, "username", void 0);
|
|
24
|
-
__decorate([
|
|
25
|
-
Field({ type: SqlType.varchar, length: 200 }),
|
|
26
|
-
__metadata("design:type", String)
|
|
27
|
-
], AmaFuck2.prototype, "pwd", void 0);
|
|
28
|
-
let AmaService2 = class AmaService2 extends SqlService {
|
|
29
|
-
};
|
|
30
|
-
AmaService2 = __decorate([
|
|
31
|
-
DB({
|
|
32
|
-
tableName: 'nfc_user', clz: AmaFuck2, dbType: DBType.Postgresql
|
|
33
|
-
})
|
|
34
|
-
], AmaService2);
|
|
35
|
-
// interface Menu {
|
|
36
|
-
// resourceid: string;
|
|
37
|
-
// resourcepid: string;
|
|
38
|
-
// resourcename: string;
|
|
39
|
-
// children: Menu[];
|
|
40
|
-
// }
|
|
41
|
-
export async function go2() {
|
|
42
|
-
await Boot({
|
|
43
|
-
Postgresql: {
|
|
44
|
-
database: 'nfc',
|
|
45
|
-
user: 'postgres',
|
|
46
|
-
password: 'abcd1234',
|
|
47
|
-
port: 5432,
|
|
48
|
-
host: '127.0.0.1'
|
|
49
|
-
},
|
|
50
|
-
log: 'info',
|
|
51
|
-
columnMode: ColumnMode.HUMP,
|
|
52
|
-
sqlDir: 'E:/pro/baja-lite/xml',
|
|
53
|
-
sqlMap: {
|
|
54
|
-
['test.test']: `SELECT * FROM nfc_user {{#username}} WHERE username = :username {{/username}}`
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
const service = new AmaService2();
|
|
58
|
-
await service.transaction({
|
|
59
|
-
fn: async (conn) => {
|
|
60
|
-
const rt5 = await service.select({
|
|
61
|
-
sqlId: 'test.test',
|
|
62
|
-
params: { username: '1111' },
|
|
63
|
-
selectResult: SelectResult.RS_CS,
|
|
64
|
-
conn
|
|
65
|
-
});
|
|
66
|
-
console.log(55, rt5.length);
|
|
67
|
-
await service.insert({
|
|
68
|
-
data: {
|
|
69
|
-
userid: 22,
|
|
70
|
-
username: '222',
|
|
71
|
-
pwd: '333'
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
return 1;
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
// const data = await service.select<Menu>({
|
|
78
|
-
// sql: 'SELECT resourceid, resourcepid,resourcename FROM cp_resource ',
|
|
79
|
-
// params: {
|
|
80
|
-
// site: '1234',
|
|
81
|
-
// matchInfo: { reportType: 'yyyy', id: '11' }
|
|
82
|
-
// },
|
|
83
|
-
// // mapper: [
|
|
84
|
-
// // ['site', ['info', 'bSist'], 989],
|
|
85
|
-
// // ['site', ['info2', 'bSist'], 33],
|
|
86
|
-
// // ['site', ['Bsite'], 0]
|
|
87
|
-
// // ]
|
|
88
|
-
// });
|
|
89
|
-
// console.log(data);
|
|
90
|
-
}
|
|
91
|
-
go2();
|
package/test-sqlite.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import 'reflect-metadata';
|
package/test-sqlite.js
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
-
};
|
|
10
|
-
import { DBType, Field, SqlType } from 'baja-lite-field';
|
|
11
|
-
import 'reflect-metadata';
|
|
12
|
-
import { Boot } from './boot';
|
|
13
|
-
import { DB, DeleteMode, InsertMode, SqlService, SyncMode } from './sql';
|
|
14
|
-
class AmaFuck {
|
|
15
|
-
}
|
|
16
|
-
__decorate([
|
|
17
|
-
Field({ type: SqlType.varchar }),
|
|
18
|
-
__metadata("design:type", String)
|
|
19
|
-
], AmaFuck.prototype, "site", void 0);
|
|
20
|
-
__decorate([
|
|
21
|
-
Field({ type: SqlType.varchar }),
|
|
22
|
-
__metadata("design:type", String)
|
|
23
|
-
], AmaFuck.prototype, "SellerSKU2", void 0);
|
|
24
|
-
__decorate([
|
|
25
|
-
Field({ type: SqlType.varchar, id: true }),
|
|
26
|
-
__metadata("design:type", String)
|
|
27
|
-
], AmaFuck.prototype, "SellerSKU", void 0);
|
|
28
|
-
let AmaService = class AmaService extends SqlService {
|
|
29
|
-
};
|
|
30
|
-
AmaService = __decorate([
|
|
31
|
-
DB({
|
|
32
|
-
tableName: 'ama_fuck2', clz: AmaFuck, dbType: DBType.Sqlite, sqliteVersion: '0.0.3'
|
|
33
|
-
})
|
|
34
|
-
], AmaService);
|
|
35
|
-
async function go() {
|
|
36
|
-
await Boot({
|
|
37
|
-
Sqlite: 'd:1.db',
|
|
38
|
-
log: 'info'
|
|
39
|
-
});
|
|
40
|
-
const service = new AmaService();
|
|
41
|
-
const ret = service.transaction({
|
|
42
|
-
sync: SyncMode.Sync,
|
|
43
|
-
fn: conn => {
|
|
44
|
-
const list = new Array({
|
|
45
|
-
SellerSKU: '1',
|
|
46
|
-
site: '111'
|
|
47
|
-
}, {
|
|
48
|
-
SellerSKU: '2',
|
|
49
|
-
SellerSKU2: '22',
|
|
50
|
-
}, {
|
|
51
|
-
SellerSKU2: '33',
|
|
52
|
-
SellerSKU: '3',
|
|
53
|
-
site: '333'
|
|
54
|
-
}, {
|
|
55
|
-
SellerSKU2: '44',
|
|
56
|
-
SellerSKU: '4',
|
|
57
|
-
site: '444'
|
|
58
|
-
}, {
|
|
59
|
-
SellerSKU2: '',
|
|
60
|
-
SellerSKU: '66',
|
|
61
|
-
site: undefined
|
|
62
|
-
});
|
|
63
|
-
const rt = service.insert({
|
|
64
|
-
sync: SyncMode.Sync,
|
|
65
|
-
data: list,
|
|
66
|
-
conn, skipEmptyString: false, mode: InsertMode.InsertWithTempTable
|
|
67
|
-
});
|
|
68
|
-
console.log(rt);
|
|
69
|
-
const rt2 = service.update({
|
|
70
|
-
sync: SyncMode.Sync,
|
|
71
|
-
data: list,
|
|
72
|
-
conn, skipEmptyString: false
|
|
73
|
-
});
|
|
74
|
-
console.log(rt2);
|
|
75
|
-
const rt3 = service.delete({
|
|
76
|
-
sync: SyncMode.Sync,
|
|
77
|
-
where: [
|
|
78
|
-
{ SellerSKU2: '11', SellerSKU: '1' },
|
|
79
|
-
{ SellerSKU2: '22', SellerSKU: '2' },
|
|
80
|
-
{ SellerSKU2: '33', SellerSKU: '3' }
|
|
81
|
-
],
|
|
82
|
-
mode: DeleteMode.TempTable
|
|
83
|
-
});
|
|
84
|
-
console.log(rt3);
|
|
85
|
-
return 1;
|
|
86
|
-
}
|
|
87
|
-
});
|
|
88
|
-
return ret;
|
|
89
|
-
}
|
|
90
|
-
go();
|
package/test-xml.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/test-xml.js
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import HTML from 'html-parse-stringify';
|
|
2
|
-
console.log((HTML.parse(`
|
|
3
|
-
<sql id="reportField">
|
|
4
|
-
a.left_e_foul leftEFoul,
|
|
5
|
-
a.right_e_foul rightEFoul,
|
|
6
|
-
a.left_em_foul leftEmFoul,
|
|
7
|
-
a.right_em_foul rightEmFoul,
|
|
8
|
-
a.left_s_foul leftSFoul,
|
|
9
|
-
a.right_s_foul rightSFoul,
|
|
10
|
-
a.left_sb_foul leftSbFoul,
|
|
11
|
-
a.right_sb_foul rightSbFoul,
|
|
12
|
-
a.left_p_foul leftPFoul,
|
|
13
|
-
a.right_p_foul rightPFoul,
|
|
14
|
-
a.left_attack_goal leftAttackGoal,
|
|
15
|
-
a.right_attack_goal rightAttackGoal,
|
|
16
|
-
a.left_point_goal leftPointGoal,
|
|
17
|
-
a.right_point_goal rightPointGoal,
|
|
18
|
-
a.left_over_time_goal leftOverTimeGoal,
|
|
19
|
-
a.right_over_time_goal rightOverTimeGoal,
|
|
20
|
-
a.left_normal_goal leftNormalGoal,
|
|
21
|
-
a.right_normal_goal rightNormalGoal,
|
|
22
|
-
a.left_own_goal leftOwnGoal,
|
|
23
|
-
a.right_own_goal rightOwnGoal,
|
|
24
|
-
a.left_time_out leftTimeOut,
|
|
25
|
-
a.right_time_out rightTimeOut,
|
|
26
|
-
a.left_coach_y_card leftCoachYCard,
|
|
27
|
-
a.right_coach_y_card rightCoachYCard,
|
|
28
|
-
a.left_player_r_card leftPlayerRCard,
|
|
29
|
-
a.right_player_r_card rightPlayerRCard,
|
|
30
|
-
a.left_jump_ball leftJumpBall,
|
|
31
|
-
a.right_jump_ball rightJumpBall
|
|
32
|
-
</sql>
|
|
33
|
-
<select id="matchReport" resultType="org.jeecg.modules.event.entity.EventMatchReport">
|
|
34
|
-
select
|
|
35
|
-
b.event_name eventName,
|
|
36
|
-
a.match_id matchId,
|
|
37
|
-
a.event_times eventTimes,
|
|
38
|
-
a.team_left_id teamLeftId,
|
|
39
|
-
a.team_RIGHt_id teamRightId,
|
|
40
|
-
a.team_left_name teamLeftName,
|
|
41
|
-
a.team_right_name teamRightName,
|
|
42
|
-
a.team_left_image teamLeftImage,
|
|
43
|
-
a.team_right_image teamRightImage,
|
|
44
|
-
<include refid="reportField" />
|
|
45
|
-
<if test="matchInfo.reportType!=null and matchInfo.reportType!=''">
|
|
46
|
-
from view_match_report a
|
|
47
|
-
</if>
|
|
48
|
-
<if test="matchInfo.reportType==null or matchInfo.reportType==''">
|
|
49
|
-
from event_match_report a
|
|
50
|
-
</if>
|
|
51
|
-
left join event_main_info b on a.event_id = b.id
|
|
52
|
-
<where>
|
|
53
|
-
<if test="matchInfo.id!=null and matchInfo.id!=''">
|
|
54
|
-
and a.match_id = #{matchInfo.id}
|
|
55
|
-
</if>
|
|
56
|
-
<if test="matchInfo.eventId!=null and matchInfo.eventId!=''">
|
|
57
|
-
and a.event_id = #{matchInfo.eventId}
|
|
58
|
-
</if>
|
|
59
|
-
<if test="matchInfo.teamLeftId!=null and matchInfo.teamLeftId!=''">
|
|
60
|
-
and (a.team_left_id = #{matchInfo.teamLeftId} OR a.team_right_id = #{matchInfo.teamLeftId})
|
|
61
|
-
</if>
|
|
62
|
-
<if test="dataIdList!=null">
|
|
63
|
-
and a.event_id in
|
|
64
|
-
<foreach collection="dataIdList" item="item" open="(" close=")" separator=",">
|
|
65
|
-
#{item}
|
|
66
|
-
</foreach>
|
|
67
|
-
</if>
|
|
68
|
-
</where>
|
|
69
|
-
</select>
|
|
70
|
-
>`)));
|
package/test.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/test.js
DELETED