baja-lite 1.2.1 → 1.2.2
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 +3 -3
- package/package.json +3 -3
- package/sql.d.ts +2 -0
- package/sql.js +53 -62
- package/test-mysql.js +71 -98
package/code.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import path from 'path';
|
|
3
2
|
import fs from 'fs';
|
|
4
|
-
import { start } from 'repl';
|
|
5
|
-
import { createPool } from 'mysql2/promise';
|
|
6
3
|
import mustache from 'mustache';
|
|
4
|
+
import { createPool } from 'mysql2/promise';
|
|
5
|
+
import path from 'path';
|
|
6
|
+
import { start } from 'repl';
|
|
7
7
|
import { mkdir } from 'shelljs';
|
|
8
8
|
const lxMap = {
|
|
9
9
|
tinyint: "number",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "baja-lite",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.2",
|
|
4
4
|
"description": "some util for self",
|
|
5
5
|
"homepage": "https://github.com/void-soul/util-man",
|
|
6
6
|
"repository": {
|
|
@@ -61,8 +61,8 @@
|
|
|
61
61
|
"@types/pg-pool": "2.0.6",
|
|
62
62
|
"@types/shelljs": "0.8.15",
|
|
63
63
|
"@types/sqlstring": "2.3.2",
|
|
64
|
-
"@typescript-eslint/eslint-plugin": "8.26.
|
|
65
|
-
"@typescript-eslint/parser": "8.26.
|
|
64
|
+
"@typescript-eslint/eslint-plugin": "8.26.1",
|
|
65
|
+
"@typescript-eslint/parser": "8.26.1",
|
|
66
66
|
"better-sqlite3": "11.8.1",
|
|
67
67
|
"ioredis": "5.6.0",
|
|
68
68
|
"mongodb": "6.14.2",
|
package/sql.d.ts
CHANGED
package/sql.js
CHANGED
|
@@ -271,7 +271,7 @@ class MysqlConnection {
|
|
|
271
271
|
}
|
|
272
272
|
;
|
|
273
273
|
if (globalThis[_GlobalSqlOption].log === 'trace') {
|
|
274
|
-
logger.trace(sql
|
|
274
|
+
logger.trace(`${sql}\n,${JSON.stringify(params ?? '')}`);
|
|
275
275
|
}
|
|
276
276
|
return new Promise(async (resolve, reject) => {
|
|
277
277
|
try {
|
|
@@ -304,7 +304,7 @@ class MysqlConnection {
|
|
|
304
304
|
}
|
|
305
305
|
;
|
|
306
306
|
if (globalThis[_GlobalSqlOption].log === 'trace') {
|
|
307
|
-
logger.trace(sql
|
|
307
|
+
logger.trace(`${sql}\n,${JSON.stringify(params ?? '')}`);
|
|
308
308
|
}
|
|
309
309
|
return new Promise(async (resolve, reject) => {
|
|
310
310
|
try {
|
|
@@ -340,7 +340,7 @@ class MysqlConnection {
|
|
|
340
340
|
}
|
|
341
341
|
;
|
|
342
342
|
if (globalThis[_GlobalSqlOption].log === 'trace') {
|
|
343
|
-
logger.trace(sql
|
|
343
|
+
logger.trace(`${sql}\n,${JSON.stringify(params ?? '')}`);
|
|
344
344
|
}
|
|
345
345
|
return new Promise(async (resolve, reject) => {
|
|
346
346
|
try {
|
|
@@ -374,7 +374,7 @@ class MysqlConnection {
|
|
|
374
374
|
}
|
|
375
375
|
;
|
|
376
376
|
if (globalThis[_GlobalSqlOption].log === 'trace') {
|
|
377
|
-
logger.trace(sql
|
|
377
|
+
logger.trace(`${sql}\n,${JSON.stringify(params ?? '')}`);
|
|
378
378
|
}
|
|
379
379
|
return new Promise(async (resolve, reject) => {
|
|
380
380
|
try {
|
|
@@ -408,7 +408,7 @@ class MysqlConnection {
|
|
|
408
408
|
}
|
|
409
409
|
;
|
|
410
410
|
if (globalThis[_GlobalSqlOption].log === 'trace') {
|
|
411
|
-
logger.trace(sql
|
|
411
|
+
logger.trace(`${sql}\n,${JSON.stringify(params ?? '')}`);
|
|
412
412
|
}
|
|
413
413
|
return new Promise(async (resolve, reject) => {
|
|
414
414
|
try {
|
|
@@ -550,7 +550,7 @@ class PostgresqlConnection {
|
|
|
550
550
|
}
|
|
551
551
|
;
|
|
552
552
|
if (globalThis[_GlobalSqlOption].log === 'trace') {
|
|
553
|
-
logger.trace(sql
|
|
553
|
+
logger.trace(`${sql}\n,${JSON.stringify(params ?? '')}`);
|
|
554
554
|
}
|
|
555
555
|
return new Promise(async (resolve, reject) => {
|
|
556
556
|
try {
|
|
@@ -587,7 +587,7 @@ class PostgresqlConnection {
|
|
|
587
587
|
}
|
|
588
588
|
;
|
|
589
589
|
if (globalThis[_GlobalSqlOption].log === 'trace') {
|
|
590
|
-
logger.trace(sql
|
|
590
|
+
logger.trace(`${sql}\n,${JSON.stringify(params ?? '')}`);
|
|
591
591
|
}
|
|
592
592
|
return new Promise(async (resolve, reject) => {
|
|
593
593
|
try {
|
|
@@ -627,7 +627,7 @@ class PostgresqlConnection {
|
|
|
627
627
|
}
|
|
628
628
|
;
|
|
629
629
|
if (globalThis[_GlobalSqlOption].log === 'trace') {
|
|
630
|
-
logger.trace(sql
|
|
630
|
+
logger.trace(`${sql}\n,${JSON.stringify(params ?? '')}`);
|
|
631
631
|
}
|
|
632
632
|
return new Promise(async (resolve, reject) => {
|
|
633
633
|
try {
|
|
@@ -665,7 +665,7 @@ class PostgresqlConnection {
|
|
|
665
665
|
}
|
|
666
666
|
;
|
|
667
667
|
if (globalThis[_GlobalSqlOption].log === 'trace') {
|
|
668
|
-
logger.trace(sql
|
|
668
|
+
logger.trace(`${sql}\n,${JSON.stringify(params ?? '')}`);
|
|
669
669
|
}
|
|
670
670
|
return new Promise(async (resolve, reject) => {
|
|
671
671
|
try {
|
|
@@ -703,7 +703,7 @@ class PostgresqlConnection {
|
|
|
703
703
|
}
|
|
704
704
|
;
|
|
705
705
|
if (globalThis[_GlobalSqlOption].log === 'trace') {
|
|
706
|
-
logger.trace(sql
|
|
706
|
+
logger.trace(`${sql}\n,${JSON.stringify(params ?? '')}`);
|
|
707
707
|
}
|
|
708
708
|
return new Promise(async (resolve, reject) => {
|
|
709
709
|
try {
|
|
@@ -850,7 +850,7 @@ class SqliteConnection {
|
|
|
850
850
|
}
|
|
851
851
|
;
|
|
852
852
|
if (globalThis[_GlobalSqlOption].log === 'trace') {
|
|
853
|
-
logger.trace(sql
|
|
853
|
+
logger.trace(`${sql}\n,${JSON.stringify(params ?? '')}`);
|
|
854
854
|
}
|
|
855
855
|
const result = this[_daoConnection].prepare(sql).run(params ?? {});
|
|
856
856
|
if (globalThis[_GlobalSqlOption].log === 'trace') {
|
|
@@ -881,7 +881,7 @@ class SqliteConnection {
|
|
|
881
881
|
}
|
|
882
882
|
;
|
|
883
883
|
if (globalThis[_GlobalSqlOption].log === 'trace') {
|
|
884
|
-
logger.trace(sql
|
|
884
|
+
logger.trace(`${sql}\n,${JSON.stringify(params ?? '')}`);
|
|
885
885
|
}
|
|
886
886
|
return this[_daoConnection].prepare(sql).pluck().get(params ?? {});
|
|
887
887
|
}
|
|
@@ -906,7 +906,7 @@ class SqliteConnection {
|
|
|
906
906
|
}
|
|
907
907
|
;
|
|
908
908
|
if (globalThis[_GlobalSqlOption].log === 'trace') {
|
|
909
|
-
logger.trace(sql
|
|
909
|
+
logger.trace(`${sql}\n,${JSON.stringify(params ?? '')}`);
|
|
910
910
|
}
|
|
911
911
|
return this[_daoConnection].prepare(sql).get(params ?? {});
|
|
912
912
|
}
|
|
@@ -932,7 +932,7 @@ class SqliteConnection {
|
|
|
932
932
|
}
|
|
933
933
|
;
|
|
934
934
|
if (globalThis[_GlobalSqlOption].log === 'trace') {
|
|
935
|
-
logger.trace(sql
|
|
935
|
+
logger.trace(`${sql}\n,${JSON.stringify(params ?? '')}`);
|
|
936
936
|
}
|
|
937
937
|
return this[_daoConnection].prepare(sql).raw().all(params ?? {});
|
|
938
938
|
}
|
|
@@ -958,7 +958,7 @@ class SqliteConnection {
|
|
|
958
958
|
}
|
|
959
959
|
;
|
|
960
960
|
if (globalThis[_GlobalSqlOption].log === 'trace') {
|
|
961
|
-
logger.trace(sql
|
|
961
|
+
logger.trace(`${sql}\n,${JSON.stringify(params ?? '')}`);
|
|
962
962
|
}
|
|
963
963
|
return this[_daoConnection].prepare(sql).all(params ?? {});
|
|
964
964
|
}
|
|
@@ -1055,7 +1055,7 @@ export class SqliteRemoteConnection {
|
|
|
1055
1055
|
}
|
|
1056
1056
|
;
|
|
1057
1057
|
if (globalThis[_GlobalSqlOption].log === 'trace') {
|
|
1058
|
-
logger.trace(sql
|
|
1058
|
+
logger.trace(`${sql}\n,${JSON.stringify(params ?? '')}`);
|
|
1059
1059
|
}
|
|
1060
1060
|
return new Promise(async (resolve, reject) => {
|
|
1061
1061
|
try {
|
|
@@ -1085,7 +1085,7 @@ export class SqliteRemoteConnection {
|
|
|
1085
1085
|
}
|
|
1086
1086
|
;
|
|
1087
1087
|
if (globalThis[_GlobalSqlOption].log === 'trace') {
|
|
1088
|
-
logger.trace(sql
|
|
1088
|
+
logger.trace(`${sql}\n,${JSON.stringify(params ?? '')}`);
|
|
1089
1089
|
}
|
|
1090
1090
|
return new Promise(async (resolve, reject) => {
|
|
1091
1091
|
try {
|
|
@@ -1115,7 +1115,7 @@ export class SqliteRemoteConnection {
|
|
|
1115
1115
|
}
|
|
1116
1116
|
;
|
|
1117
1117
|
if (globalThis[_GlobalSqlOption].log === 'trace') {
|
|
1118
|
-
logger.trace(sql
|
|
1118
|
+
logger.trace(`${sql}\n,${JSON.stringify(params ?? '')}`);
|
|
1119
1119
|
}
|
|
1120
1120
|
return new Promise(async (resolve, reject) => {
|
|
1121
1121
|
try {
|
|
@@ -1145,7 +1145,7 @@ export class SqliteRemoteConnection {
|
|
|
1145
1145
|
}
|
|
1146
1146
|
;
|
|
1147
1147
|
if (globalThis[_GlobalSqlOption].log === 'trace') {
|
|
1148
|
-
logger.trace(sql
|
|
1148
|
+
logger.trace(`${sql}\n,${JSON.stringify(params ?? '')}`);
|
|
1149
1149
|
}
|
|
1150
1150
|
return new Promise(async (resolve, reject) => {
|
|
1151
1151
|
try {
|
|
@@ -1175,7 +1175,7 @@ export class SqliteRemoteConnection {
|
|
|
1175
1175
|
}
|
|
1176
1176
|
;
|
|
1177
1177
|
if (globalThis[_GlobalSqlOption].log === 'trace') {
|
|
1178
|
-
logger.trace(sql
|
|
1178
|
+
logger.trace(`${sql}\n,${JSON.stringify(params ?? '')}`);
|
|
1179
1179
|
}
|
|
1180
1180
|
return new Promise(async (resolve, reject) => {
|
|
1181
1181
|
try {
|
|
@@ -3064,27 +3064,7 @@ export class SqlService {
|
|
|
3064
3064
|
}
|
|
3065
3065
|
const _params = Object.assign({}, option.context, option.params);
|
|
3066
3066
|
option.sql ?? (option.sql = globalThis[_sqlCache].load(this._matchSqlid(option.sqlId), { ctx: option.context, isCount: option.isCount, ..._params }));
|
|
3067
|
-
const params =
|
|
3068
|
-
const sql = formatDialect(option.sql?.replace(/\:([A-Za-z0-9._]+)/g, (txt, key) => {
|
|
3069
|
-
let V = LGet(_params, key);
|
|
3070
|
-
if (V !== undefined) {
|
|
3071
|
-
params.push(V);
|
|
3072
|
-
return '?';
|
|
3073
|
-
}
|
|
3074
|
-
const _key = C2P(key);
|
|
3075
|
-
V = LGet(_params, _key);
|
|
3076
|
-
if (V !== undefined) {
|
|
3077
|
-
params.push(V);
|
|
3078
|
-
return '?';
|
|
3079
|
-
}
|
|
3080
|
-
const __key = P2C(key);
|
|
3081
|
-
V = LGet(_params, __key);
|
|
3082
|
-
if (V !== undefined) {
|
|
3083
|
-
params.push(V);
|
|
3084
|
-
return '?';
|
|
3085
|
-
}
|
|
3086
|
-
return txt;
|
|
3087
|
-
}), { dialect: formatDialects[option.dbType] });
|
|
3067
|
+
const { sql, params } = this._generSql(option.dbType, option.sql, _params);
|
|
3088
3068
|
if (option.sync === SyncMode.Sync) {
|
|
3089
3069
|
const result = option.conn.query(SyncMode.Sync, sql, params);
|
|
3090
3070
|
return this._select(option.selectResult, result, option.defValue, option.errorMsg, option.hump, option.mapper, option.mapperIfUndefined);
|
|
@@ -3105,27 +3085,7 @@ export class SqlService {
|
|
|
3105
3085
|
Throw.if(!option.sqlId && !option.sql, 'not found sql!');
|
|
3106
3086
|
const _params = Object.assign({}, option.context, option.params);
|
|
3107
3087
|
option.sql ?? (option.sql = globalThis[_sqlCache].load(this._matchSqlid(option.sqlId), { ctx: option.context, ..._params }));
|
|
3108
|
-
const params =
|
|
3109
|
-
const sql = formatDialect(option.sql?.replace(/\:(\w+)/g, (txt, key) => {
|
|
3110
|
-
let V = LGet(_params, key);
|
|
3111
|
-
if (V !== undefined) {
|
|
3112
|
-
params.push(V);
|
|
3113
|
-
return '?';
|
|
3114
|
-
}
|
|
3115
|
-
const _key = C2P(key);
|
|
3116
|
-
V = LGet(_params, _key);
|
|
3117
|
-
if (V !== undefined) {
|
|
3118
|
-
params.push(V);
|
|
3119
|
-
return '?';
|
|
3120
|
-
}
|
|
3121
|
-
const __key = P2C(key);
|
|
3122
|
-
V = LGet(_params, __key);
|
|
3123
|
-
if (V !== undefined) {
|
|
3124
|
-
params.push(V);
|
|
3125
|
-
return '?';
|
|
3126
|
-
}
|
|
3127
|
-
return txt;
|
|
3128
|
-
}), { dialect: formatDialects[option.dbType] });
|
|
3088
|
+
const { sql, params } = this._generSql(option.dbType, option.sql, _params);
|
|
3129
3089
|
if (option.sync === SyncMode.Sync) {
|
|
3130
3090
|
const result = option.conn.execute(SyncMode.Sync, sql, params);
|
|
3131
3091
|
return result.affectedRows;
|
|
@@ -3549,6 +3509,37 @@ export class SqlService {
|
|
|
3549
3509
|
else
|
|
3550
3510
|
return [`${this[_tableName]}.${sqlid}`, `${this[_className]}.${sqlid}`, `${this[_ClassName]}.${sqlid}`, `${this[_vueName]}.${sqlid}`];
|
|
3551
3511
|
}
|
|
3512
|
+
_setParam(v, ps) {
|
|
3513
|
+
if (v instanceof Array) {
|
|
3514
|
+
ps.push(...v);
|
|
3515
|
+
return v.map(i => '?').join(',');
|
|
3516
|
+
}
|
|
3517
|
+
else {
|
|
3518
|
+
ps.push(v);
|
|
3519
|
+
return '?';
|
|
3520
|
+
}
|
|
3521
|
+
}
|
|
3522
|
+
_generSql(dbType, _sql, _params) {
|
|
3523
|
+
const params = [];
|
|
3524
|
+
const sql = formatDialect(_sql?.replace(/\:(\w+)/g, (txt, key) => {
|
|
3525
|
+
let V = LGet(_params, key);
|
|
3526
|
+
if (V !== undefined) {
|
|
3527
|
+
return this._setParam(V, params);
|
|
3528
|
+
}
|
|
3529
|
+
const _key = C2P(key);
|
|
3530
|
+
V = LGet(_params, _key);
|
|
3531
|
+
if (V !== undefined) {
|
|
3532
|
+
return this._setParam(V, params);
|
|
3533
|
+
}
|
|
3534
|
+
const __key = P2C(key);
|
|
3535
|
+
V = LGet(_params, __key);
|
|
3536
|
+
if (V !== undefined) {
|
|
3537
|
+
return this._setParam(V, params);
|
|
3538
|
+
}
|
|
3539
|
+
return txt;
|
|
3540
|
+
}), { dialect: formatDialects[dbType] });
|
|
3541
|
+
return { params, sql };
|
|
3542
|
+
}
|
|
3552
3543
|
}
|
|
3553
3544
|
__decorate([
|
|
3554
3545
|
P(),
|
package/test-mysql.js
CHANGED
|
@@ -9,127 +9,100 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
9
9
|
};
|
|
10
10
|
import 'reflect-metadata';
|
|
11
11
|
import { Boot } from './boot.js';
|
|
12
|
-
import {
|
|
13
|
-
class
|
|
12
|
+
import { ColumnMode, DB, Field, SqlService, SqlType } from './sql.js';
|
|
13
|
+
class BaseAuditUser {
|
|
14
14
|
}
|
|
15
15
|
__decorate([
|
|
16
|
-
Field({ type: SqlType.varchar, length:
|
|
16
|
+
Field({ type: SqlType.varchar, length: 32, id: true, notNull: true, uuidShort: true }),
|
|
17
17
|
__metadata("design:type", String)
|
|
18
|
-
],
|
|
18
|
+
], BaseAuditUser.prototype, "auditId", void 0);
|
|
19
19
|
__decorate([
|
|
20
|
-
Field({ type: SqlType.varchar, length:
|
|
20
|
+
Field({ type: SqlType.varchar, length: 32, comment: '密码' }),
|
|
21
21
|
__metadata("design:type", String)
|
|
22
|
-
],
|
|
22
|
+
], BaseAuditUser.prototype, "password", void 0);
|
|
23
23
|
__decorate([
|
|
24
|
-
Field({ type: SqlType.varchar, length:
|
|
24
|
+
Field({ type: SqlType.varchar, length: 255, comment: '省' }),
|
|
25
25
|
__metadata("design:type", String)
|
|
26
|
-
],
|
|
27
|
-
|
|
26
|
+
], BaseAuditUser.prototype, "userProvinceCode", void 0);
|
|
27
|
+
__decorate([
|
|
28
|
+
Field({ type: SqlType.varchar, length: 255, comment: '省' }),
|
|
29
|
+
__metadata("design:type", String)
|
|
30
|
+
], BaseAuditUser.prototype, "userProvince", void 0);
|
|
31
|
+
__decorate([
|
|
32
|
+
Field({ type: SqlType.varchar, length: 32, comment: '显示名称' }),
|
|
33
|
+
__metadata("design:type", String)
|
|
34
|
+
], BaseAuditUser.prototype, "labelName", void 0);
|
|
35
|
+
__decorate([
|
|
36
|
+
Field({ type: SqlType.varchar, length: 32, comment: '备注名称' }),
|
|
37
|
+
__metadata("design:type", String)
|
|
38
|
+
], BaseAuditUser.prototype, "remarkName", void 0);
|
|
39
|
+
__decorate([
|
|
40
|
+
Field({ type: SqlType.varchar, length: 32, comment: '初始密码' }),
|
|
41
|
+
__metadata("design:type", String)
|
|
42
|
+
], BaseAuditUser.prototype, "upassword", void 0);
|
|
43
|
+
__decorate([
|
|
44
|
+
Field({ type: SqlType.char, length: 1, def: 0, comment: '是否中心' }),
|
|
45
|
+
__metadata("design:type", String)
|
|
46
|
+
], BaseAuditUser.prototype, "baseType", void 0);
|
|
47
|
+
__decorate([
|
|
48
|
+
Field({ type: SqlType.varchar, length: 32 }),
|
|
49
|
+
__metadata("design:type", String)
|
|
50
|
+
], BaseAuditUser.prototype, "userId", void 0);
|
|
51
|
+
__decorate([
|
|
52
|
+
Field({ type: SqlType.varchar, length: 32 }),
|
|
53
|
+
__metadata("design:type", String)
|
|
54
|
+
], BaseAuditUser.prototype, "companyId", void 0);
|
|
55
|
+
__decorate([
|
|
56
|
+
Field({ type: SqlType.varchar, length: 32 }),
|
|
57
|
+
__metadata("design:type", String)
|
|
58
|
+
], BaseAuditUser.prototype, "username", void 0);
|
|
59
|
+
__decorate([
|
|
60
|
+
Field({ type: SqlType.char, length: 1, def: 0, comment: '状态' }),
|
|
61
|
+
__metadata("design:type", String)
|
|
62
|
+
], BaseAuditUser.prototype, "userStatus", void 0);
|
|
63
|
+
__decorate([
|
|
64
|
+
Field({ type: SqlType.char, length: 1, def: 0, comment: '账户分组' }),
|
|
65
|
+
__metadata("design:type", String)
|
|
66
|
+
], BaseAuditUser.prototype, "groupId", void 0);
|
|
67
|
+
__decorate([
|
|
68
|
+
Field({ type: SqlType.varchar, length: 10 }),
|
|
69
|
+
__metadata("design:type", String)
|
|
70
|
+
], BaseAuditUser.prototype, "startDate", void 0);
|
|
71
|
+
__decorate([
|
|
72
|
+
Field({ type: SqlType.varchar, length: 10 }),
|
|
73
|
+
__metadata("design:type", String)
|
|
74
|
+
], BaseAuditUser.prototype, "endDate", void 0);
|
|
75
|
+
let BaseAuditUserService = class BaseAuditUserService extends SqlService {
|
|
28
76
|
};
|
|
29
|
-
|
|
30
|
-
DB({
|
|
31
|
-
|
|
32
|
-
})
|
|
33
|
-
], AmaService2);
|
|
34
|
-
// interface Menu {
|
|
35
|
-
// resourceid: string;
|
|
36
|
-
// resourcepid: string;
|
|
37
|
-
// resourcename: string;
|
|
38
|
-
// children: Menu[];
|
|
39
|
-
// }
|
|
77
|
+
BaseAuditUserService = __decorate([
|
|
78
|
+
DB({ tableName: 'base_audit_user', clz: BaseAuditUser })
|
|
79
|
+
], BaseAuditUserService);
|
|
40
80
|
export async function go2() {
|
|
41
81
|
await Boot({
|
|
42
82
|
Mysql: {
|
|
43
|
-
host: '
|
|
44
|
-
port:
|
|
83
|
+
host: '127.0.0.1',
|
|
84
|
+
port: 3306,
|
|
45
85
|
user: 'root',
|
|
46
|
-
password: '
|
|
86
|
+
password: 'abcd1234',
|
|
47
87
|
// 数据库名
|
|
48
|
-
database: '
|
|
88
|
+
database: 'sportevent',
|
|
49
89
|
debug: false
|
|
50
90
|
},
|
|
51
|
-
log: '
|
|
91
|
+
log: 'trace',
|
|
52
92
|
columnMode: ColumnMode.HUMP,
|
|
53
93
|
sqlDir: 'E:/pro/baja-lite/xml',
|
|
54
94
|
sqlMap: {
|
|
55
95
|
['test.test']: `SELECT * FROM cp_user {{#username}} WHERE username = :username {{/username}}`
|
|
56
96
|
}
|
|
57
97
|
});
|
|
58
|
-
const service = new
|
|
59
|
-
await service.transaction({
|
|
98
|
+
const service = new BaseAuditUserService();
|
|
99
|
+
const list = await service.transaction({
|
|
60
100
|
fn: async (conn) => {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
// sellerSku: 'sellerSku1',
|
|
65
|
-
// sellerSku2: 'SellerSKU11',
|
|
66
|
-
// }, {
|
|
67
|
-
// sellerSku2: 'SellerSKU2',
|
|
68
|
-
// sellerSku: 'SellerSKU22',
|
|
69
|
-
// }, {
|
|
70
|
-
// sellerSku2: 'SellerSKU3',
|
|
71
|
-
// sellerSku: 'SellerSKU33',
|
|
72
|
-
// }, {
|
|
73
|
-
// sellerSku2: '',
|
|
74
|
-
// sellerSku: 'SellerSKU44',
|
|
75
|
-
// site: '1234'
|
|
76
|
-
// });
|
|
77
|
-
// const rt = await service.insert({
|
|
78
|
-
// data: list,
|
|
79
|
-
// conn,
|
|
80
|
-
// // skipEmptyString: false,
|
|
81
|
-
// // skipUndefined: false
|
|
82
|
-
// mode: InsertMode.InsertWithTempTable,
|
|
83
|
-
// existConditionOtherThanIds: ['sellerSku']
|
|
84
|
-
// });
|
|
85
|
-
// console.log(11, rt);
|
|
86
|
-
// const rt2 = await service.update({
|
|
87
|
-
// data: {
|
|
88
|
-
// sellerSku: 'SellerSKU1',
|
|
89
|
-
// sellerSku2: 'SellerSKU21',
|
|
90
|
-
// site: 'site1'
|
|
91
|
-
// },
|
|
92
|
-
// conn, skipEmptyString: false
|
|
93
|
-
// });
|
|
94
|
-
// console.log(22, rt2);
|
|
95
|
-
// const rt3 = await service.delete({
|
|
96
|
-
// where: [
|
|
97
|
-
// { sellerSku2: 'SellerSKU23', sellerSku: 'SellerSKU3' }
|
|
98
|
-
// ],
|
|
99
|
-
// mode: DeleteMode.TempTable,
|
|
100
|
-
// conn
|
|
101
|
-
// });
|
|
102
|
-
// console.log(33, rt3);
|
|
103
|
-
// const rt4 = await service.template({
|
|
104
|
-
// where: { sellerSku2: 'SellerSKU22', sellerSku: 'sellerSku2' },
|
|
105
|
-
// templateResult: TemplateResult.Many
|
|
106
|
-
// })
|
|
107
|
-
// console.log(44, rt4);
|
|
108
|
-
const rt5 = await service.select({
|
|
109
|
-
sqlId: 'test.test',
|
|
110
|
-
params: { username: '1111' },
|
|
111
|
-
selectResult: SelectResult.RS_CS
|
|
112
|
-
});
|
|
113
|
-
console.log(55, rt5.length);
|
|
114
|
-
// const rt6 = await service.stream().eq('sellerSku', 'SellerSKU1').excuteSelect({
|
|
115
|
-
// selectResult: SelectResult.Many_Row_Many_Column,
|
|
116
|
-
// });
|
|
117
|
-
// console.log(66, rt6);
|
|
118
|
-
return 1;
|
|
101
|
+
await service.stream().eq('baseType', '0').in('auditId', ['162400829591265280', '162201628882247680']).excuteSelect();
|
|
102
|
+
const data = await service.stream().in('auditId', ['162400829591265280', '162201628882247680']).update('labelName', '333').excuteUpdate({ conn });
|
|
103
|
+
return data;
|
|
119
104
|
}
|
|
120
105
|
});
|
|
121
|
-
|
|
122
|
-
// sql: 'SELECT resourceid, resourcepid,resourcename FROM cp_resource ',
|
|
123
|
-
// params: {
|
|
124
|
-
// site: '1234',
|
|
125
|
-
// matchInfo: { reportType: 'yyyy', id: '11' }
|
|
126
|
-
// },
|
|
127
|
-
// // mapper: [
|
|
128
|
-
// // ['site', ['info', 'bSist'], 989],
|
|
129
|
-
// // ['site', ['info2', 'bSist'], 33],
|
|
130
|
-
// // ['site', ['Bsite'], 0]
|
|
131
|
-
// // ]
|
|
132
|
-
// });
|
|
133
|
-
// console.log(data);
|
|
106
|
+
console.log(11, list);
|
|
134
107
|
}
|
|
135
108
|
go2();
|