baja-lite 1.5.13 → 1.5.15

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 CHANGED
@@ -48,8 +48,13 @@ const lxMap = {
48
48
  geometrycollection: "Object"
49
49
  };
50
50
  let force = false;
51
- const basepath = path.join(import.meta.dirname, '..', '..');
52
- console.log(basepath);
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.13",
3
+ "version": "1.5.15",
4
4
  "description": "some util for self",
5
5
  "homepage": "https://github.com/void-soul/baja-lite",
6
6
  "repository": {
@@ -38,8 +38,8 @@
38
38
  "@msgpack/msgpack": "3.1.2",
39
39
  "@types/request-promise": "4.1.51",
40
40
  "axios": "1.10.0",
41
- "baja-lite-field": "1.4.12",
42
- "decimal.js": "10.5.0",
41
+ "baja-lite-field": "1.4.13",
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",
package/test-mysql.d.ts DELETED
@@ -1,2 +0,0 @@
1
- import 'reflect-metadata';
2
- export declare function go2(): Promise<void>;
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();
@@ -1,2 +0,0 @@
1
- import 'reflect-metadata';
2
- export declare function go2(): Promise<void>;
@@ -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
@@ -1,2 +0,0 @@
1
- import { snowflake } from "snowflake";
2
- console.log(snowflake.generate());