baja-lite 1.5.16 → 1.5.17

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "baja-lite",
3
- "version": "1.5.16",
3
+ "version": "1.5.17",
4
4
  "description": "some util for self",
5
5
  "homepage": "https://github.com/void-soul/baja-lite",
6
6
  "repository": {
package/sql.d.ts CHANGED
@@ -1125,26 +1125,15 @@ export declare class SqlService<T extends object> {
1125
1125
  // 或者自定义Mapper,自定义Mapper格式如下:
1126
1126
  [
1127
1127
  {columnName: 'dit_id', mapNames: ['DTID'], def: 0, convert: 转换函数}, // 列名ditid,对应属性DTID,如果没有值,将返回默认值0,其中默认值0是可选的
1128
- {columnName: 'event_id', mapNames: ['eventMainInfo', 'id'], def: 0, convert: 转换函数},// 列名event_id对应属性eventMainInfo.id,这种方式将返回嵌套的json对象,其中默认值null是可选的
1128
+ {columnName: 'event_id', mapNames: ['eventMainInfo', 'id'], def: 0, convert: 转换函数},// 列名event_id对应属性eventMainInfo.id,这种方式将返回嵌套的json对象,其中默认值是可选的
1129
1129
  ]
1130
- ```
1131
- #TODO 未完成读取 sqlMapDir
1132
- #### sqlMapDir 目录定义如下,
1133
- `test.ts`
1134
- ```
1135
- export const dict:SqlMappers = [
1136
- {columnName: 'dit_id', mapNames: ['DTID'], def: 0, convert: 转换函数}, // 列名ditid,对应属性DTID,如果没有值,将返回默认值0,其中默认值0是可选的
1137
- {columnName: 'event_id', mapNames: ['eventMainInfo', 'id'], def: 0, convert: 转换函数},// 列名event_id对应属性eventMainInfo.id,这种方式将返回嵌套的json对象,其中默认值null是可选的
1138
- ]
1139
- ```
1140
- 将得到 test.dict 这个map
1141
1130
  12. dataConvert 数据转换器
1142
1131
  ```
1143
1132
  dataConvert: {
1144
1133
  fileName: 'qiniu'
1145
1134
  }
1146
1135
  // 表示列 fileName 按 qiniu的函数格式化
1147
- // qiniu 在开始时定义
1136
+ // qiniu 在项目初始化时定义
1148
1137
  ```
1149
1138
  */
1150
1139
  select<L = T>(option: MethodOption & {
@@ -1267,6 +1256,67 @@ export declare class SqlService<T extends object> {
1267
1256
  mapperIfUndefined?: MapperIfUndefined;
1268
1257
  dataConvert?: Record<string, string>;
1269
1258
  }): L | null;
1259
+ /**
1260
+ # 自由查询:一次执行多个SQL语句!
1261
+ 0. `sync`: 同步(sqlite)或者异步(mysql、remote),影响返回值类型,默认`异步模式`
1262
+ 1. `sql` 或者 `sqlid`
1263
+ 2. `params`
1264
+ 3. `dbName`: 默认使用service注解的`dbName`,可以在某个方法中覆盖
1265
+ 4. `conn`: 仅在开启事务时需要主动传入,传入示例:
1266
+ ```
1267
+ service.transaction(async conn => {
1268
+ service.insert({conn});
1269
+ });
1270
+ ```
1271
+ 5. `dao`: 永远不需要传入该值
1272
+ 6. `hump`: 是否将列名改为驼峰写法?默认情况下按照全局配置
1273
+ 7. `mapper`: 列名-属性 映射工具,优先级高于hump
1274
+ ```
1275
+ // 该属性支持传入mybatis.xml中定义的resultMap块ID,或者读取sqlMapDir目录下的JSON文件(暂未实现).
1276
+ // 注意:resultMap块的寻找逻辑与sql语句逻辑一致,同样是 文件名.ID
1277
+ // 或者自定义Mapper,自定义Mapper格式如下:
1278
+ [
1279
+ // 数据列名ditid将转换为属性`DTID`,如果没有值,将返回默认值0,其中默认值0是可选的
1280
+ {columnName: 'dit_id', mapNames: ['DTID'], def?: 0, convert: 转换函数},
1281
+ // 数据列名event_id将转换为属性`eventMainInfo.id`,这种方式将返回嵌套的json对象,其中默认值0是可选的
1282
+ {columnName: 'event_id', mapNames: ['eventMainInfo', 'id'], def?: 0, convert: 转换函数},
1283
+ ]
1284
+ ```
1285
+ 8. `dataConvert` 数据转换器
1286
+ ```
1287
+ dataConvert: {
1288
+ fileName: 'qiniu'
1289
+ }
1290
+ // 表示列 fileName 按 qiniu的函数格式化
1291
+ // qiniu 在开始时定义
1292
+ ```
1293
+ */
1294
+ selectMuit<T extends any[] = []>(option: MethodOption & {
1295
+ sync?: SyncMode.Async;
1296
+ sqlId?: string;
1297
+ sql?: string;
1298
+ params?: Record<string, any>;
1299
+ context?: any;
1300
+ hump?: boolean;
1301
+ mapper?: string | SqlMapper;
1302
+ mapperIfUndefined?: MapperIfUndefined;
1303
+ dataConvert?: Record<string, string>;
1304
+ }): Promise<{
1305
+ [K in keyof T]: T[K][];
1306
+ }>;
1307
+ selectMuit<T extends any[] = []>(option: MethodOption & {
1308
+ sync: SyncMode.Sync;
1309
+ sqlId?: string;
1310
+ sql?: string;
1311
+ params?: Record<string, any>;
1312
+ context?: any;
1313
+ hump?: boolean;
1314
+ mapper?: string | SqlMapper;
1315
+ mapperIfUndefined?: MapperIfUndefined;
1316
+ dataConvert?: Record<string, string>;
1317
+ }): {
1318
+ [K in keyof T]: T[K][];
1319
+ };
1270
1320
  /**
1271
1321
  # 自由执行sql
1272
1322
  0. `sync`: 同步(sqlite)或者异步(mysql、remote),影响返回值类型,默认`异步模式`
package/sql.js CHANGED
@@ -2884,6 +2884,30 @@ export class SqlService {
2884
2884
  });
2885
2885
  }
2886
2886
  }
2887
+ selectMuit(option) {
2888
+ Throw.if(!option.sqlId && !option.sql, 'not found sql!');
2889
+ if (option.sqlId && globalThis[_resultMap_SQLID][option.sqlId] && !option.mapper) {
2890
+ option.mapper = globalThis[_resultMap_SQLID][option.sqlId];
2891
+ }
2892
+ const _params = Object.assign({}, option.context, option.params);
2893
+ option.sql ?? (option.sql = globalThis[_sqlCache].load(this._matchSqlid(option.sqlId), { ctx: option.context, isCount: false, ..._params }));
2894
+ const { sql, params } = this._generSql(option.dbType, option.sql, _params);
2895
+ if (option.sync === SyncMode.Sync) {
2896
+ const result = option.conn.query(SyncMode.Sync, sql, params);
2897
+ return result.map(item => this._select(SelectResult.RS_CS, result, null, undefined, option.hump, option.mapper, option.mapperIfUndefined, option.dataConvert));
2898
+ }
2899
+ else {
2900
+ return new Promise(async (resolve, reject) => {
2901
+ try {
2902
+ const result = await option.conn.query(SyncMode.Async, sql, params);
2903
+ resolve(result.map(item => this._select(SelectResult.RS_CS, result, null, undefined, option.hump, option.mapper, option.mapperIfUndefined, option.dataConvert)));
2904
+ }
2905
+ catch (error) {
2906
+ reject(error);
2907
+ }
2908
+ });
2909
+ }
2910
+ }
2887
2911
  excute(option) {
2888
2912
  Throw.if(!option.sqlId && !option.sql, 'not found sql!');
2889
2913
  const _params = Object.assign({}, option.context, option.params);
@@ -3376,6 +3400,12 @@ __decorate([
3376
3400
  __metadata("design:paramtypes", [Object]),
3377
3401
  __metadata("design:returntype", Object)
3378
3402
  ], SqlService.prototype, "select", null);
3403
+ __decorate([
3404
+ P(),
3405
+ __metadata("design:type", Function),
3406
+ __metadata("design:paramtypes", [Object]),
3407
+ __metadata("design:returntype", Object)
3408
+ ], SqlService.prototype, "selectMuit", null);
3379
3409
  __decorate([
3380
3410
  P(),
3381
3411
  __metadata("design:type", Function),
@@ -0,0 +1,2 @@
1
+ import 'reflect-metadata';
2
+ export declare function go2(): Promise<void>;
package/test-mysql.js ADDED
@@ -0,0 +1,115 @@
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/my-sdk/baja-lite/xml',
95
+ sqlMap: {
96
+ ['test.test']: `
97
+ SELECT * FROM base_user {{#realname}} WHERE realname LIKE CONCAT(:realname, '%') {{/realname}};
98
+ SELECT * FROM base_user {{#realname}} WHERE realname LIKE CONCAT(:realname, '%') {{/realname}};
99
+ `
100
+ }
101
+ });
102
+ const service = new BaseAuditUserService();
103
+ const data = await service.selectMuit({ sqlId: 'test.test', params: { realname: '张薇' } });
104
+ console.log(11, data[0][0]?.userProvinceCode);
105
+ console.log(11, data[1].length);
106
+ // const list = await service.transaction<number>({
107
+ // fn: async conn => {
108
+ // await service.stream().eq('baseType', '0').in('auditId', ['162400829591265280', '162201628882247680']).excuteSelect();
109
+ // const data = await service.stream().in('auditId', ['162400829591265280', '162201628882247680']).update('labelName', '333').excuteUpdate({ conn });
110
+ // return data;
111
+ // }
112
+ // });
113
+ // console.log(11, list);
114
+ }
115
+ go2();
@@ -0,0 +1,2 @@
1
+ import 'reflect-metadata';
2
+ export declare function go2(): Promise<void>;
@@ -0,0 +1,91 @@
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();
@@ -0,0 +1 @@
1
+ import 'reflect-metadata';
package/test-sqlite.js ADDED
@@ -0,0 +1,90 @@
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 ADDED
@@ -0,0 +1 @@
1
+ export {};
package/test-xml.js ADDED
@@ -0,0 +1,70 @@
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 ADDED
@@ -0,0 +1 @@
1
+ export {};
package/test.js ADDED
@@ -0,0 +1,2 @@
1
+ import { snowflake } from "snowflake";
2
+ console.log(snowflake.generate());