midway-fatcms 0.0.1-beta.18 → 0.0.1-beta.19
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/.eslintrc.json +3 -1
- package/dist/controller/gateway/AsyncTaskController.js +3 -3
- package/dist/controller/gateway/DocGatewayController.js +1 -1
- package/dist/controller/gateway/PublicApiController.js +4 -6
- package/dist/controller/gateway/StaticController.js +25 -22
- package/dist/controller/helpers.controller.d.ts +1 -1
- package/dist/controller/manage/CrudStandardDesignApi.d.ts +1 -1
- package/dist/controller/manage/CrudStandardDesignApi.js +4 -16
- package/dist/controller/manage/DataDictManageApi.d.ts +1 -1
- package/dist/controller/manage/DeployManageApi.d.ts +1 -1
- package/dist/controller/manage/DeployManageApi.js +32 -30
- package/dist/controller/manage/MenuManageApi.js +1 -1
- package/dist/controller/manage/SuperAdminManageApi.d.ts +2 -2
- package/dist/controller/manage/SysConfigMangeApi.d.ts +1 -1
- package/dist/controller/manage/SysConfigMangeApi.js +3 -3
- package/dist/controller/manage/SystemInfoManageApi.d.ts +1 -1
- package/dist/controller/manage/SystemInfoManageApi.js +7 -1
- package/dist/controller/manage/UserAccountManageApi.d.ts +1 -1
- package/dist/controller/manage/WorkbenchMangeApi.js +1 -1
- package/dist/controller/myinfo/AuthController.js +1 -1
- package/dist/controller/render/AppRenderController.js +6 -2
- package/dist/controller/test.controller.d.ts +1 -1
- package/dist/controller/test.controller.js +4 -4
- package/dist/libs/crud-pro/models/ExecuteContext.d.ts +1 -1
- package/dist/libs/crud-pro/models/TransactionSqlServer.js +1 -1
- package/dist/libs/crud-pro/services/CrudProCachedCfgService.js +1 -1
- package/dist/libs/crud-pro/services/CrudProExecuteSqlService.js +7 -6
- package/dist/libs/crud-pro/services/CrudProGenSqlCondition.d.ts +1 -1
- package/dist/libs/crud-pro/services/CrudProGenSqlCondition.js +2 -4
- package/dist/libs/crud-pro/services/CrudProGenSqlService.js +6 -15
- package/dist/libs/crud-pro/services/CrudProOriginToExecuteSql.js +5 -4
- package/dist/libs/crud-pro/services/CrudProTableMetaService.js +2 -2
- package/dist/libs/crud-pro/utils/MixinUtils.js +1 -1
- package/dist/libs/crud-pro/utils/ValidateUtils.js +1 -1
- package/dist/libs/utils/fatcms-request.js +2 -2
- package/dist/middleware/forbidden.middleware.js +4 -20
- package/dist/middleware/global.middleware.js +1 -4
- package/dist/models/AsyncTaskModel.d.ts +2 -1
- package/dist/models/RedisKeys.d.ts +8 -0
- package/dist/models/RedisKeys.js +11 -0
- package/dist/schedule/runSchedule.d.ts +1 -0
- package/dist/schedule/runSchedule.js +9 -6
- package/dist/service/UserSessionService.js +2 -1
- package/dist/service/VisitStatService.d.ts +1 -1
- package/dist/service/VisitStatService.js +16 -25
- package/dist/service/asyncTask/AsyncTaskRunnerService.d.ts +9 -3
- package/dist/service/asyncTask/AsyncTaskRunnerService.js +57 -21
- package/dist/service/asyncTask/AsyncTaskService.d.ts +1 -1
- package/dist/service/asyncTask/AsyncTaskService.js +3 -2
- package/package.json +1 -1
- package/src/controller/base/BaseApiController.ts +6 -6
- package/src/controller/gateway/AsyncTaskController.ts +17 -22
- package/src/controller/gateway/CrudMtdGatewayController.ts +7 -7
- package/src/controller/gateway/CrudStdGatewayController.ts +4 -4
- package/src/controller/gateway/DocGatewayController.ts +17 -17
- package/src/controller/gateway/FileController.ts +8 -9
- package/src/controller/gateway/ProxyApiGatewayController.ts +4 -4
- package/src/controller/gateway/PublicApiController.ts +19 -22
- package/src/controller/gateway/StaticController.ts +234 -264
- package/src/controller/helpers.controller.ts +1 -1
- package/src/controller/home.controller.ts +0 -5
- package/src/controller/manage/AnyApiMangeApi.ts +4 -4
- package/src/controller/manage/AppLogMangeApi.ts +3 -3
- package/src/controller/manage/AppMangeApi.ts +5 -5
- package/src/controller/manage/AppPageMangeApi.ts +3 -3
- package/src/controller/manage/AppSchemaHistoryApi.ts +1 -1
- package/src/controller/manage/CrudMethodsMangeApi.ts +3 -3
- package/src/controller/manage/CrudStandardDesignApi.ts +25 -77
- package/src/controller/manage/DataDictManageApi.ts +4 -4
- package/src/controller/manage/DeployManageApi.ts +84 -91
- package/src/controller/manage/DocLibManageApi.ts +3 -3
- package/src/controller/manage/DocManageApi.ts +3 -3
- package/src/controller/manage/MenuManageApi.ts +9 -14
- package/src/controller/manage/SuperAdminManageApi.ts +2 -10
- package/src/controller/manage/SysConfigMangeApi.ts +8 -11
- package/src/controller/manage/SystemInfoManageApi.ts +11 -6
- package/src/controller/manage/UserAccountManageApi.ts +2 -2
- package/src/controller/manage/WorkbenchMangeApi.ts +6 -6
- package/src/controller/myinfo/AuthController.ts +4 -8
- package/src/controller/render/AppRenderController.ts +8 -8
- package/src/controller/test.controller.ts +17 -17
- package/src/index.ts +0 -1
- package/src/libs/crud-pro/CrudPro.ts +0 -1
- package/src/libs/crud-pro/interfaces.ts +1 -3
- package/src/libs/crud-pro/models/ExecuteContext.ts +1 -4
- package/src/libs/crud-pro/models/ExecuteContextFunc.ts +1 -2
- package/src/libs/crud-pro/models/RequestModel.ts +1 -1
- package/src/libs/crud-pro/models/ResModel.ts +7 -12
- package/src/libs/crud-pro/models/SqlCfgModel.ts +1 -1
- package/src/libs/crud-pro/models/Transaction.ts +8 -9
- package/src/libs/crud-pro/models/TransactionPostgres.ts +1 -1
- package/src/libs/crud-pro/models/TransactionSqlServer.ts +8 -13
- package/src/libs/crud-pro/services/CrudProCachedCfgService.ts +1 -3
- package/src/libs/crud-pro/services/CrudProExecuteSqlService.ts +36 -48
- package/src/libs/crud-pro/services/CrudProGenSqlCondition.ts +19 -38
- package/src/libs/crud-pro/services/CrudProGenSqlService.ts +15 -32
- package/src/libs/crud-pro/services/CrudProOriginToExecuteSql.ts +23 -27
- package/src/libs/crud-pro/services/CrudProServiceBase.ts +1 -2
- package/src/libs/crud-pro/services/CrudProTableMetaService.ts +6 -14
- package/src/libs/crud-pro/utils/DateTimeUtils.ts +2 -2
- package/src/libs/crud-pro/utils/MixinUtils.ts +1 -1
- package/src/libs/crud-pro/utils/ValidateUtils.ts +1 -3
- package/src/libs/crud-pro/utils/pool/MySQLUtils.ts +1 -1
- package/src/libs/crud-pro/utils/pool/PostgresUtils.ts +3 -3
- package/src/libs/crud-pro/utils/pool/SqlServerUtils.ts +3 -3
- package/src/libs/global-config/global-config.ts +0 -5
- package/src/libs/utils/crypto-utils.ts +2 -4
- package/src/libs/utils/errorToString.ts +3 -8
- package/src/libs/utils/fatcms-request.ts +9 -21
- package/src/libs/utils/ordernum-utils.ts +2 -6
- package/src/libs/utils/parseConfig.ts +7 -15
- package/src/middleware/forbidden.middleware.ts +6 -25
- package/src/middleware/global.middleware.ts +10 -21
- package/src/models/AsyncTaskModel.ts +3 -2
- package/src/models/RedisKeys.ts +13 -0
- package/src/models/bizmodels.ts +1 -2
- package/src/schedule/runSchedule.ts +16 -11
- package/src/service/UserSessionService.ts +5 -4
- package/src/service/VisitStatService.ts +55 -71
- package/src/service/asyncTask/AsyncTaskRunnerService.ts +119 -88
- package/src/service/asyncTask/AsyncTaskService.ts +9 -9
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import * as _ from 'lodash';
|
|
2
|
-
import {PoolClient} from 'pg'
|
|
3
|
-
import {CrudProServiceBase} from './CrudProServiceBase';
|
|
4
|
-
import {SqlCfgModel} from '../models/SqlCfgModel';
|
|
5
|
-
import {KeyOfCrudTypes, KeysOfCustomSQL, KeysOfSqlResPicker, SqlDbType} from '../models/keys';
|
|
6
|
-
import {CommonException, Exceptions} from '../exceptions';
|
|
7
|
-
import {pickAndConvertPgRows} from '../utils/sqlConvert/convertPgType';
|
|
8
|
-
import {replaceQuestionMarks} from
|
|
9
|
-
import {replaceQuestionMarksForMssql} from
|
|
10
|
-
import {ModelUtils} from '../utils/ModelUtils';
|
|
11
|
-
import {MixinUtils} from '../utils/MixinUtils';
|
|
12
|
-
import {FuncContext} from '../models/FuncContext';
|
|
13
|
-
import {ExecuteContext} from
|
|
2
|
+
import { PoolClient } from 'pg';
|
|
3
|
+
import { CrudProServiceBase } from './CrudProServiceBase';
|
|
4
|
+
import { SqlCfgModel } from '../models/SqlCfgModel';
|
|
5
|
+
import { KeyOfCrudTypes, KeysOfCustomSQL, KeysOfSqlResPicker, SqlDbType } from '../models/keys';
|
|
6
|
+
import { CommonException, Exceptions } from '../exceptions';
|
|
7
|
+
import { pickAndConvertPgRows } from '../utils/sqlConvert/convertPgType';
|
|
8
|
+
import { replaceQuestionMarks } from '../utils/sqlConvert/convertPgSql';
|
|
9
|
+
import { replaceQuestionMarksForMssql } from '../utils/sqlConvert/convertMsSql';
|
|
10
|
+
import { ModelUtils } from '../utils/ModelUtils';
|
|
11
|
+
import { MixinUtils } from '../utils/MixinUtils';
|
|
12
|
+
import { FuncContext } from '../models/FuncContext';
|
|
13
|
+
import { ExecuteContext } from '../models/ExecuteContext';
|
|
14
14
|
|
|
15
15
|
const { checkFuncCfgValid } = ModelUtils;
|
|
16
16
|
const { isEmpty } = MixinUtils;
|
|
@@ -33,73 +33,62 @@ class CrudProExecuteSqlService extends CrudProServiceBase {
|
|
|
33
33
|
|
|
34
34
|
const exeCtx = this.getExecuteContext();
|
|
35
35
|
const connection = await this.getTxConnectionBySqlCfg(sqlCfgModel);
|
|
36
|
-
const executeSqlArgs = this.handleExecuteSqlArgsByResModel(exeCtx, sqlCfgModel.executeSqlArgs || [])
|
|
37
|
-
|
|
36
|
+
const executeSqlArgs = this.handleExecuteSqlArgsByResModel(exeCtx, sqlCfgModel.executeSqlArgs || []);
|
|
38
37
|
|
|
39
38
|
let sqlRes: any;
|
|
40
|
-
let queryRes
|
|
39
|
+
let queryRes: any;
|
|
41
40
|
|
|
42
|
-
if (sqlCfgModel.sqlDbType === SqlDbType.postgres) {
|
|
41
|
+
if (sqlCfgModel.sqlDbType === SqlDbType.postgres) {
|
|
42
|
+
// import { PoolClient } from 'pg';
|
|
43
43
|
|
|
44
44
|
const pgClient: PoolClient = connection as any;
|
|
45
45
|
const pgSql = replaceQuestionMarks(sqlCfgModel.executeSql);
|
|
46
46
|
|
|
47
47
|
this.logger.info('executeSqlCfgModel_postgres', pgSql, executeSqlArgs, sqlCfgModel.resPicker);
|
|
48
48
|
|
|
49
|
-
|
|
50
49
|
queryRes = await pgClient.query({
|
|
51
50
|
text: pgSql,
|
|
52
|
-
values: executeSqlArgs || []
|
|
51
|
+
values: executeSqlArgs || [],
|
|
53
52
|
});
|
|
54
|
-
sqlRes = pickAndConvertPgRows(queryRes)
|
|
55
|
-
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
else if (sqlCfgModel.sqlDbType === SqlDbType.sqlserver) {
|
|
59
|
-
|
|
53
|
+
sqlRes = pickAndConvertPgRows(queryRes);
|
|
54
|
+
} else if (sqlCfgModel.sqlDbType === SqlDbType.sqlserver) {
|
|
60
55
|
const mssql = replaceQuestionMarksForMssql(sqlCfgModel.executeSql);
|
|
61
56
|
|
|
62
57
|
this.logger.info('executeSqlCfgModel_sqlserver', mssql, executeSqlArgs, sqlCfgModel.resPicker);
|
|
63
58
|
// SQLServer
|
|
64
59
|
queryRes = await connection.query(mssql, executeSqlArgs);
|
|
65
|
-
sqlRes = _.get(queryRes,'recordsets[0]') || []
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
else {
|
|
69
|
-
|
|
60
|
+
sqlRes = _.get(queryRes, 'recordsets[0]') || [];
|
|
61
|
+
} else {
|
|
70
62
|
this.logger.info('executeSqlCfgModel_mysql', sqlCfgModel.executeSql, executeSqlArgs, sqlCfgModel.resPicker);
|
|
71
63
|
|
|
72
|
-
|
|
73
64
|
// MYSQL
|
|
74
65
|
queryRes = await connection.query(sqlCfgModel.executeSql, executeSqlArgs);
|
|
75
|
-
sqlRes = queryRes[0]
|
|
66
|
+
sqlRes = queryRes[0];
|
|
76
67
|
}
|
|
77
68
|
|
|
78
69
|
const resObject = this.toQueryResByResPicker(sqlRes, queryRes, sqlCfgModel);
|
|
79
70
|
exeCtx.setResModelItem(sqlCfgModel.resName, resObject);
|
|
80
71
|
}
|
|
81
72
|
|
|
82
|
-
|
|
83
73
|
private handleExecuteSqlArgsByResModel(exeCtx: ExecuteContext, executeSqlArgs: any[]): any[] {
|
|
84
|
-
return executeSqlArgs.map(
|
|
85
|
-
if (arg && typeof arg === 'object' && typeof arg.___GENERATE_GET_RES_ATTR___ === 'string'
|
|
74
|
+
return executeSqlArgs.map(arg => {
|
|
75
|
+
if (arg && typeof arg === 'object' && typeof arg.___GENERATE_GET_RES_ATTR___ === 'string') {
|
|
86
76
|
const word: string = arg.___GENERATE_GET_RES_ATTR___;
|
|
87
77
|
if (word.startsWith(KeysOfCustomSQL.SQL_PICK_RES_AS_NUMBER)) {
|
|
88
|
-
const resName = MixinUtils.removeStringPrefix(word, KeysOfCustomSQL.SQL_PICK_RES_AS_NUMBER)
|
|
78
|
+
const resName = MixinUtils.removeStringPrefix(word, KeysOfCustomSQL.SQL_PICK_RES_AS_NUMBER);
|
|
89
79
|
this.logger.info('handleExecuteSqlArgsByResModel resName', resName);
|
|
90
80
|
this.logger.info('handleExecuteSqlArgsByResModel getResModel', exeCtx.getResModel());
|
|
91
81
|
return Number(exeCtx.getResModelItemLodash(resName) || 0);
|
|
92
82
|
}
|
|
93
83
|
if (word.startsWith(KeysOfCustomSQL.SQL_PICK_RES_AS_STRING)) {
|
|
94
|
-
const resName = MixinUtils.removeStringPrefix(word, KeysOfCustomSQL.SQL_PICK_RES_AS_STRING)
|
|
95
|
-
return String(exeCtx.getResModelItemLodash(resName) ||
|
|
84
|
+
const resName = MixinUtils.removeStringPrefix(word, KeysOfCustomSQL.SQL_PICK_RES_AS_STRING);
|
|
85
|
+
return String(exeCtx.getResModelItemLodash(resName) || '');
|
|
96
86
|
}
|
|
97
87
|
}
|
|
98
88
|
return arg;
|
|
99
|
-
})
|
|
89
|
+
});
|
|
100
90
|
}
|
|
101
91
|
|
|
102
|
-
|
|
103
92
|
private executeSqlCfgModelPreCheck(sqlCfgModel: SqlCfgModel): boolean {
|
|
104
93
|
const crudType = sqlCfgModel.getCrudType();
|
|
105
94
|
|
|
@@ -247,16 +236,16 @@ class CrudProExecuteSqlService extends CrudProServiceBase {
|
|
|
247
236
|
if (KeysOfSqlResPicker.UPDATE_RESULT === resPicker) {
|
|
248
237
|
if (sqlCfgModel.sqlDbType === SqlDbType.postgres) {
|
|
249
238
|
return {
|
|
250
|
-
insertId: _.get(queryRes,'rows[0].id'),
|
|
251
|
-
affectedRows: _.get(queryRes,'rowCount')
|
|
252
|
-
}
|
|
239
|
+
insertId: _.get(queryRes, 'rows[0].id'),
|
|
240
|
+
affectedRows: _.get(queryRes, 'rowCount'),
|
|
241
|
+
};
|
|
253
242
|
}
|
|
254
243
|
|
|
255
244
|
if (sqlCfgModel.sqlDbType === SqlDbType.sqlserver) {
|
|
256
245
|
return {
|
|
257
|
-
insertId: _.get(queryRes,'recordset[0].id'),
|
|
258
|
-
affectedRows: _.get(queryRes,'rowsAffected[0]')
|
|
259
|
-
}
|
|
246
|
+
insertId: _.get(queryRes, 'recordset[0].id'),
|
|
247
|
+
affectedRows: _.get(queryRes, 'rowsAffected[0]'),
|
|
248
|
+
};
|
|
260
249
|
}
|
|
261
250
|
|
|
262
251
|
return sqlRes;
|
|
@@ -264,16 +253,15 @@ class CrudProExecuteSqlService extends CrudProServiceBase {
|
|
|
264
253
|
|
|
265
254
|
//其他配置:形如: sqlRes[0].total_count
|
|
266
255
|
if (typeof resPicker === 'string') {
|
|
267
|
-
if (resPicker.startsWith('sqlRes')){
|
|
256
|
+
if (resPicker.startsWith('sqlRes')) {
|
|
268
257
|
return _.get({ sqlRes }, resPicker);
|
|
269
258
|
} else {
|
|
270
|
-
throw
|
|
259
|
+
throw new CommonException(Exceptions.RUN_EXECUTE_VALIDATE, 'resPicker必须是以sqlRes开头');
|
|
271
260
|
}
|
|
272
261
|
}
|
|
273
262
|
|
|
274
263
|
return sqlRes;
|
|
275
264
|
}
|
|
276
|
-
|
|
277
265
|
}
|
|
278
266
|
|
|
279
267
|
export { CrudProExecuteSqlService };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {SqlSegArg} from '../models/SqlSegArg';
|
|
2
|
-
import {MixinUtils} from '../utils/MixinUtils';
|
|
3
|
-
import {KeysOfConditions, SqlDbType} from '../models/keys';
|
|
4
|
-
import {CommonException, Exceptions} from '../exceptions';
|
|
5
|
-
import {ICompareCondition, IRequestCondition} from '../interfaces';
|
|
6
|
-
import {TypeUtils} from '../utils/TypeUtils';
|
|
7
|
-
import {SqlCfgModel} from
|
|
8
|
-
import {toSqlColumnName} from '../utils/sqlConvert/convertColumnName';
|
|
1
|
+
import { SqlSegArg } from '../models/SqlSegArg';
|
|
2
|
+
import { MixinUtils } from '../utils/MixinUtils';
|
|
3
|
+
import { KeysOfConditions, SqlDbType } from '../models/keys';
|
|
4
|
+
import { CommonException, Exceptions } from '../exceptions';
|
|
5
|
+
import { ICompareCondition, IRequestCondition } from '../interfaces';
|
|
6
|
+
import { TypeUtils } from '../utils/TypeUtils';
|
|
7
|
+
import { SqlCfgModel } from '../models/SqlCfgModel';
|
|
8
|
+
import { toSqlColumnName } from '../utils/sqlConvert/convertColumnName';
|
|
9
9
|
|
|
10
10
|
const { equalsIgnoreCase, isEmpty, isNotEmpty } = MixinUtils;
|
|
11
11
|
const { isBasicType, isNumber } = TypeUtils;
|
|
@@ -13,16 +13,14 @@ const { isBasicType, isNumber } = TypeUtils;
|
|
|
13
13
|
const createFunc = (sqlCfg: SqlCfgModel) => {
|
|
14
14
|
return {
|
|
15
15
|
toSqlColumnName: (columnName: string): string => {
|
|
16
|
-
return toSqlColumnName(columnName, sqlCfg)
|
|
16
|
+
return toSqlColumnName(columnName, sqlCfg);
|
|
17
17
|
},
|
|
18
18
|
toMatchSqlColumnName: (columnName: string): string => {
|
|
19
19
|
const arr = columnName.split(',');
|
|
20
|
-
return arr
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
}
|
|
20
|
+
return arr.map(s => toSqlColumnName(s.trim(), sqlCfg)).join(',');
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
};
|
|
26
24
|
|
|
27
25
|
class ValueChecker {
|
|
28
26
|
checkBasicArrayAndNotEmpty(value0: any, message: string) {
|
|
@@ -215,39 +213,28 @@ class CrudProGenSqlCondition {
|
|
|
215
213
|
if (this.sqlCfg.sqlDbType === SqlDbType.postgres) {
|
|
216
214
|
tmpSql = `${toSqlColumnName(key)} like concat(?::text, '%')`; // like前缀匹配
|
|
217
215
|
}
|
|
218
|
-
|
|
219
216
|
} else if (equalsIgnoreCase(KeysOfConditions.$NOT_LIKE, compare)) {
|
|
220
217
|
tmpArgList.push(value0);
|
|
221
218
|
tmpSql = `${toSqlColumnName(key)} COLLATE UTF8MB4_GENERAL_CI not like concat(?, '%')`;
|
|
222
219
|
|
|
223
|
-
|
|
224
220
|
if (this.sqlCfg.sqlDbType === SqlDbType.postgres) {
|
|
225
221
|
tmpSql = `${toSqlColumnName(key)} not like concat(?::text, '%')`;
|
|
226
222
|
}
|
|
227
|
-
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
else if (equalsIgnoreCase(KeysOfConditions.$LIKE_INCLUDE, compare)) {
|
|
223
|
+
} else if (equalsIgnoreCase(KeysOfConditions.$LIKE_INCLUDE, compare)) {
|
|
232
224
|
tmpArgList.push(value0);
|
|
233
225
|
tmpSql = `${toSqlColumnName(key)} COLLATE UTF8MB4_GENERAL_CI like concat('%', ?, '%')`; // like包含
|
|
234
226
|
|
|
235
227
|
if (this.sqlCfg.sqlDbType === SqlDbType.postgres) {
|
|
236
228
|
tmpSql = `${toSqlColumnName(key)} like concat('%', ?::text, '%')`; // like包含
|
|
237
229
|
}
|
|
238
|
-
|
|
239
230
|
} else if (equalsIgnoreCase(KeysOfConditions.$NOT_LIKE_INCLUDE, compare)) {
|
|
240
231
|
tmpArgList.push(value0);
|
|
241
|
-
tmpSql = `${toSqlColumnName(key)} COLLATE UTF8MB4_GENERAL_CI not like concat('%',?, '%')`;
|
|
232
|
+
tmpSql = `${toSqlColumnName(key)} COLLATE UTF8MB4_GENERAL_CI not like concat('%',?, '%')`; // like不包含
|
|
242
233
|
|
|
243
234
|
if (this.sqlCfg.sqlDbType === SqlDbType.postgres) {
|
|
244
|
-
tmpSql = `${toSqlColumnName(key)} not like concat('%',?::text, '%')`;
|
|
235
|
+
tmpSql = `${toSqlColumnName(key)} not like concat('%',?::text, '%')`; // like不包含
|
|
245
236
|
}
|
|
246
|
-
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
else if (equalsIgnoreCase(KeysOfConditions.$MATCH, compare)) {
|
|
237
|
+
} else if (equalsIgnoreCase(KeysOfConditions.$MATCH, compare)) {
|
|
251
238
|
tmpArgList.push(value0);
|
|
252
239
|
tmpSql = `match(${toMatchSqlColumnName(key)}) against(?)`;
|
|
253
240
|
} else if (equalsIgnoreCase(KeysOfConditions.$MATCH_BOOL, compare)) {
|
|
@@ -328,10 +315,7 @@ class CrudProGenSqlCondition {
|
|
|
328
315
|
if (!isBasicType(value0)) {
|
|
329
316
|
throwCommonException(KeysOfConditions.$NOT_LIKE, '字符串');
|
|
330
317
|
}
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
else if (equalsIgnoreCase(KeysOfConditions.$LIKE_INCLUDE, compare)) {
|
|
318
|
+
} else if (equalsIgnoreCase(KeysOfConditions.$LIKE_INCLUDE, compare)) {
|
|
335
319
|
if (!isBasicType(value0)) {
|
|
336
320
|
throwCommonException(KeysOfConditions.$LIKE_INCLUDE, '字符串');
|
|
337
321
|
}
|
|
@@ -339,10 +323,7 @@ class CrudProGenSqlCondition {
|
|
|
339
323
|
if (!isBasicType(value0)) {
|
|
340
324
|
throwCommonException(KeysOfConditions.$NOT_LIKE_INCLUDE, '字符串');
|
|
341
325
|
}
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
else if (equalsIgnoreCase(KeysOfConditions.$MATCH, compare)) {
|
|
326
|
+
} else if (equalsIgnoreCase(KeysOfConditions.$MATCH, compare)) {
|
|
346
327
|
if (!isBasicType(value0)) {
|
|
347
328
|
throwCommonException(KeysOfConditions.$MATCH, '字符串');
|
|
348
329
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { CrudProServiceBase } from './CrudProServiceBase';
|
|
2
2
|
import { CommonException, Exceptions } from '../exceptions';
|
|
3
3
|
import { MixinUtils } from '../utils/MixinUtils';
|
|
4
|
-
import {KeysOfSimpleSQL, KeysOfSqlResPicker, SqlDbType} from '../models/keys';
|
|
5
|
-
import {RequestCfgModel} from
|
|
4
|
+
import { KeysOfSimpleSQL, KeysOfSqlResPicker, SqlDbType } from '../models/keys';
|
|
5
|
+
import { RequestCfgModel } from '../models/RequestCfgModel';
|
|
6
6
|
|
|
7
7
|
const { equalsIgnoreCase, isEmpty, isNotEmpty } = MixinUtils;
|
|
8
8
|
|
|
@@ -96,7 +96,7 @@ class CrudProGenSqlService extends CrudProServiceBase {
|
|
|
96
96
|
* @param cfgModel
|
|
97
97
|
* @private
|
|
98
98
|
*/
|
|
99
|
-
private generateOriginSqlForDelete(cfgModel: RequestCfgModel)
|
|
99
|
+
private generateOriginSqlForDelete(cfgModel: RequestCfgModel): string {
|
|
100
100
|
if (cfgModel.sqlDbType === SqlDbType.postgres) {
|
|
101
101
|
return 'delete from @@table where @@asWhere:condition ';
|
|
102
102
|
}
|
|
@@ -111,49 +111,37 @@ class CrudProGenSqlService extends CrudProServiceBase {
|
|
|
111
111
|
* @param cfgModel
|
|
112
112
|
* @private
|
|
113
113
|
*/
|
|
114
|
-
private generateOriginSqlForDuplicateInsert(cfgModel: RequestCfgModel)
|
|
114
|
+
private generateOriginSqlForDuplicateInsert(cfgModel: RequestCfgModel): string {
|
|
115
115
|
if (cfgModel.sqlDbType === SqlDbType.postgres) {
|
|
116
|
-
const uniqueColumn = cfgModel.uniqueColumn
|
|
116
|
+
const uniqueColumn = cfgModel.uniqueColumn; // id
|
|
117
117
|
if (!Array.isArray(uniqueColumn) || uniqueColumn.length === 0) {
|
|
118
|
-
throw new CommonException(Exceptions.CFG_ERROR_POSTGRES_UNIQUE_COLUMNS_NULL)
|
|
118
|
+
throw new CommonException(Exceptions.CFG_ERROR_POSTGRES_UNIQUE_COLUMNS_NULL);
|
|
119
119
|
}
|
|
120
|
-
const unique_column = uniqueColumn
|
|
121
|
-
|
|
122
|
-
|
|
120
|
+
const unique_column = uniqueColumn
|
|
121
|
+
.map(s => {
|
|
122
|
+
return `"${s}"`;
|
|
123
|
+
})
|
|
124
|
+
.join(',');
|
|
123
125
|
return `insert into @@table ( @@asInsertKeys:data ) values( @@asInsertValues:data ) ON CONFLICT (${unique_column}) DO UPDATE set @@asUpdate:data `; // 关键字的前后,必须有空格
|
|
124
126
|
}
|
|
125
127
|
|
|
126
|
-
|
|
127
128
|
if (cfgModel.sqlDbType === SqlDbType.sqlserver) {
|
|
128
|
-
const uniqueColumn = cfgModel.uniqueColumn
|
|
129
|
+
const uniqueColumn = cfgModel.uniqueColumn; // id
|
|
129
130
|
if (uniqueColumn.length !== 1) {
|
|
130
131
|
throw new CommonException(Exceptions.CFG_UNIQUE_COLUMN_COUNT_MUST_ONE);
|
|
131
132
|
}
|
|
132
133
|
|
|
133
134
|
const uniqueColumnStr = uniqueColumn[0];
|
|
134
|
-
const uniqueColumnVal =
|
|
135
|
-
|
|
136
|
-
const sql =
|
|
137
|
-
`IF EXISTS (SELECT 1 FROM @@table WHERE [${uniqueColumnStr}] = ${uniqueColumnVal})` +
|
|
138
|
-
"BEGIN\n" +
|
|
139
|
-
" UPDATE @@table\n" +
|
|
140
|
-
" SET @@asUpdate:data\n" +
|
|
141
|
-
` WHERE [${uniqueColumnStr}] = ${uniqueColumnVal} ;\n` +
|
|
142
|
-
"END\n" +
|
|
143
|
-
"ELSE\n" +
|
|
144
|
-
"BEGIN\n" +
|
|
145
|
-
" INSERT INTO @@table ( @@asInsertKeys:data )\n" +
|
|
146
|
-
" VALUES ( @@asInsertValues:data );\n" +
|
|
147
|
-
"END";
|
|
135
|
+
const uniqueColumnVal = '@@data.' + uniqueColumnStr;
|
|
136
|
+
|
|
137
|
+
const sql = '' + `IF EXISTS (SELECT 1 FROM @@table WHERE [${uniqueColumnStr}] = ${uniqueColumnVal})` + 'BEGIN\n' + ' UPDATE @@table\n' + ' SET @@asUpdate:data\n' + ` WHERE [${uniqueColumnStr}] = ${uniqueColumnVal} ;\n` + 'END\n' + 'ELSE\n' + 'BEGIN\n' + ' INSERT INTO @@table ( @@asInsertKeys:data )\n' + ' VALUES ( @@asInsertValues:data );\n' + 'END';
|
|
148
138
|
|
|
149
139
|
return sql;
|
|
150
140
|
}
|
|
151
141
|
|
|
152
|
-
|
|
153
142
|
return 'insert into @@table ( @@asInsertKeys:data ) values( @@asInsertValues:data ) on duplicate key update @@asUpdate:data '; // 关键字的前后,必须有空格
|
|
154
143
|
}
|
|
155
144
|
|
|
156
|
-
|
|
157
145
|
/**
|
|
158
146
|
* 创建插入语句
|
|
159
147
|
* @param cfgModel
|
|
@@ -169,9 +157,6 @@ class CrudProGenSqlService extends CrudProServiceBase {
|
|
|
169
157
|
return 'insert into @@table ( @@asInsertKeys:data ) values( @@asInsertValues:data )'; // 关键字的前后,必须有空格
|
|
170
158
|
}
|
|
171
159
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
160
|
private async generateExecuteSql() {
|
|
176
161
|
const exeCtx = this.getExecuteContext();
|
|
177
162
|
|
|
@@ -195,8 +180,6 @@ class CrudProGenSqlService extends CrudProServiceBase {
|
|
|
195
180
|
exeCtx.getSqlCfgModels().push(sqlCfgModel);
|
|
196
181
|
}
|
|
197
182
|
}
|
|
198
|
-
|
|
199
|
-
|
|
200
183
|
}
|
|
201
184
|
|
|
202
185
|
export { CrudProGenSqlService };
|
|
@@ -1,21 +1,20 @@
|
|
|
1
|
-
import {CrudProServiceBase} from './CrudProServiceBase';
|
|
2
|
-
import {SqlCfgModel} from '../models/SqlCfgModel';
|
|
3
|
-
import {MixinUtils} from '../utils/MixinUtils';
|
|
4
|
-
import {SqlSegArg} from '../models/SqlSegArg';
|
|
5
|
-
import {KeysOfCustomSQL, SqlDbType} from '../models/keys';
|
|
6
|
-
import {RequestModel} from '../models/RequestModel';
|
|
7
|
-
import {CommonException, Exceptions} from '../exceptions';
|
|
8
|
-
import {RequestCfgModel} from '../models/RequestCfgModel';
|
|
9
|
-
import {ModelUtils} from '../utils/ModelUtils';
|
|
10
|
-
import {FuncContext} from '../models/FuncContext';
|
|
11
|
-
import {TypeUtils} from '../utils/TypeUtils';
|
|
12
|
-
import {sqlFuncUtils} from '../utils/SqlFuncUtils';
|
|
13
|
-
import {toSqlColumnName, toSqlColumnNamesJoin} from '../utils/sqlConvert/convertColumnName';
|
|
14
|
-
import {CrudProGenSqlCondition} from
|
|
1
|
+
import { CrudProServiceBase } from './CrudProServiceBase';
|
|
2
|
+
import { SqlCfgModel } from '../models/SqlCfgModel';
|
|
3
|
+
import { MixinUtils } from '../utils/MixinUtils';
|
|
4
|
+
import { SqlSegArg } from '../models/SqlSegArg';
|
|
5
|
+
import { KeysOfCustomSQL, SqlDbType } from '../models/keys';
|
|
6
|
+
import { RequestModel } from '../models/RequestModel';
|
|
7
|
+
import { CommonException, Exceptions } from '../exceptions';
|
|
8
|
+
import { RequestCfgModel } from '../models/RequestCfgModel';
|
|
9
|
+
import { ModelUtils } from '../utils/ModelUtils';
|
|
10
|
+
import { FuncContext } from '../models/FuncContext';
|
|
11
|
+
import { TypeUtils } from '../utils/TypeUtils';
|
|
12
|
+
import { sqlFuncUtils } from '../utils/SqlFuncUtils';
|
|
13
|
+
import { toSqlColumnName, toSqlColumnNamesJoin } from '../utils/sqlConvert/convertColumnName';
|
|
14
|
+
import { CrudProGenSqlCondition } from './CrudProGenSqlCondition';
|
|
15
15
|
|
|
16
16
|
const KEYS_CUSTOM_PATTERN = /@@[0-9a-zA-Z:._]+/gm;
|
|
17
17
|
|
|
18
|
-
|
|
19
18
|
/**
|
|
20
19
|
* 存在任何需要排除的
|
|
21
20
|
* @param columns
|
|
@@ -52,10 +51,9 @@ class CrudProOriginToExecuteSql extends CrudProServiceBase {
|
|
|
52
51
|
const argList = [];
|
|
53
52
|
let executeSql = originSql;
|
|
54
53
|
|
|
55
|
-
|
|
56
54
|
// 发现有需要被替换的变量。
|
|
57
55
|
if (sqlArgModelMap) {
|
|
58
|
-
|
|
56
|
+
executeSql = originSql.replace(KEYS_CUSTOM_PATTERN, word => {
|
|
59
57
|
if (!word) {
|
|
60
58
|
return '';
|
|
61
59
|
}
|
|
@@ -73,7 +71,6 @@ class CrudProOriginToExecuteSql extends CrudProServiceBase {
|
|
|
73
71
|
});
|
|
74
72
|
}
|
|
75
73
|
|
|
76
|
-
|
|
77
74
|
sqlCfgModel.executeSqlArgs = argList;
|
|
78
75
|
sqlCfgModel.executeSql = executeSql;
|
|
79
76
|
}
|
|
@@ -115,12 +112,10 @@ class CrudProOriginToExecuteSql extends CrudProServiceBase {
|
|
|
115
112
|
return this.generateOffsetLimit(reqCfg, sqlCfg, reqModel);
|
|
116
113
|
} else if (word === KeysOfCustomSQL.SQL_ORDER_BYS) {
|
|
117
114
|
return this.generateOrderBys(reqModel, sqlCfg);
|
|
118
|
-
} else if ((
|
|
119
|
-
word.startsWith(KeysOfCustomSQL.SQL_GET_DATA_ATTR_START) ||
|
|
120
|
-
word.startsWith(KeysOfCustomSQL.SQL_GET_CONDITION_ATTR_START)) && word.indexOf('.') > 0) {
|
|
115
|
+
} else if ((word.startsWith(KeysOfCustomSQL.SQL_GET_DATA_ATTR_START) || word.startsWith(KeysOfCustomSQL.SQL_GET_CONDITION_ATTR_START)) && word.indexOf('.') > 0) {
|
|
121
116
|
return this.generateGetAttr(reqModel, word); //// data.xxx, condition.xxx
|
|
122
117
|
} else if (word.startsWith(KeysOfCustomSQL.SQL_PICK_RES_AS_NUMBER) || word.startsWith(KeysOfCustomSQL.SQL_PICK_RES_AS_STRING)) {
|
|
123
|
-
return this.generatePickResAs(reqModel,
|
|
118
|
+
return this.generatePickResAs(reqModel, word); // @@pickResAsNumber:replies_count
|
|
124
119
|
} else if (word.startsWith(KeysOfCustomSQL.SQL_AS_UPDATE)) {
|
|
125
120
|
return this.generateDataUpdate(reqModel, sqlCfg, MixinUtils.removeStringPrefix(word, KeysOfCustomSQL.SQL_AS_UPDATE));
|
|
126
121
|
} else if (word.startsWith(KeysOfCustomSQL.SQL_AS_INSERT_KEYS)) {
|
|
@@ -200,7 +195,7 @@ class CrudProOriginToExecuteSql extends CrudProServiceBase {
|
|
|
200
195
|
result.push(reqColumn);
|
|
201
196
|
}
|
|
202
197
|
}
|
|
203
|
-
return new SqlSegArg(toSqlColumnNamesJoin(result,sqlCfgModel));
|
|
198
|
+
return new SqlSegArg(toSqlColumnNamesJoin(result, sqlCfgModel));
|
|
204
199
|
}
|
|
205
200
|
|
|
206
201
|
/**
|
|
@@ -231,7 +226,7 @@ class CrudProOriginToExecuteSql extends CrudProServiceBase {
|
|
|
231
226
|
}
|
|
232
227
|
|
|
233
228
|
if (sqlCfg.sqlDbType === SqlDbType.sqlserver) {
|
|
234
|
-
return new SqlSegArg(' OFFSET ? ROWS FETCH NEXT ? ROWS ONLY ', [
|
|
229
|
+
return new SqlSegArg(' OFFSET ? ROWS FETCH NEXT ? ROWS ONLY ', [req.offset, limit]);
|
|
235
230
|
}
|
|
236
231
|
|
|
237
232
|
return new SqlSegArg(' limit ?,? ', [req.offset, limit]);
|
|
@@ -250,11 +245,12 @@ class CrudProOriginToExecuteSql extends CrudProServiceBase {
|
|
|
250
245
|
return new SqlSegArg(sql);
|
|
251
246
|
}
|
|
252
247
|
|
|
253
|
-
|
|
254
248
|
private generatePickResAs(req: RequestModel, world: string): SqlSegArg {
|
|
255
|
-
return new SqlSegArg(' ? ', [
|
|
249
|
+
return new SqlSegArg(' ? ', [
|
|
250
|
+
{
|
|
256
251
|
___GENERATE_GET_RES_ATTR___: world,
|
|
257
|
-
|
|
252
|
+
},
|
|
253
|
+
]);
|
|
258
254
|
}
|
|
259
255
|
|
|
260
256
|
private generateGetAttr(req: RequestModel, word: string): SqlSegArg {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as _ from 'lodash';
|
|
2
2
|
import { ICurdProServiceHub } from '../models/ServiceHub';
|
|
3
|
-
import {ICrudProCfg, IExecuteUnsafeQueryCtx, ILogger, IPoolConnectionClient} from '../interfaces';
|
|
3
|
+
import { ICrudProCfg, IExecuteUnsafeQueryCtx, ILogger, IPoolConnectionClient } from '../interfaces';
|
|
4
4
|
import { SqlCfgModel } from '../models/SqlCfgModel';
|
|
5
5
|
import { ExecuteContext } from '../models/ExecuteContext';
|
|
6
6
|
import { MixinUtils } from '../utils/MixinUtils';
|
|
@@ -19,7 +19,6 @@ function createBuildInExecuteFuncMap() {
|
|
|
19
19
|
};
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
|
|
23
22
|
const buildInExecuteFuncMap = createBuildInExecuteFuncMap();
|
|
24
23
|
|
|
25
24
|
class CrudProServiceBase {
|
|
@@ -47,7 +47,7 @@ class CrudProTableMetaService extends CrudProServiceBase {
|
|
|
47
47
|
const baseInfo: IExecuteUnsafeQueryCtx = {
|
|
48
48
|
sqlTable: sqlCfgModel.sqlTable,
|
|
49
49
|
sqlDatabase: sqlCfgModel.sqlDatabase,
|
|
50
|
-
sqlDbType: sqlCfgModel.sqlDbType
|
|
50
|
+
sqlDbType: sqlCfgModel.sqlDbType,
|
|
51
51
|
};
|
|
52
52
|
|
|
53
53
|
obj.tableColumns = await this.loadTableColumnInfo(baseInfo);
|
|
@@ -55,19 +55,14 @@ class CrudProTableMetaService extends CrudProServiceBase {
|
|
|
55
55
|
return obj;
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
private async loadTableColumnInfo(baseInfo: IExecuteUnsafeQueryCtx): Promise<string[]>{
|
|
61
|
-
|
|
62
|
-
if(baseInfo.sqlDbType === SqlDbType.mysql) {
|
|
58
|
+
private async loadTableColumnInfo(baseInfo: IExecuteUnsafeQueryCtx): Promise<string[]> {
|
|
59
|
+
if (baseInfo.sqlDbType === SqlDbType.mysql) {
|
|
63
60
|
const [tableDescribe] = await this.executeUnsafeQuery(baseInfo, 'describe ' + baseInfo.sqlTable);
|
|
64
61
|
const tableDescribe2 = JSON.parse(JSON.stringify(tableDescribe));
|
|
65
62
|
return tableDescribe2.map(fieldObj => {
|
|
66
63
|
return fieldObj['Field'];
|
|
67
64
|
});
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
else if(baseInfo.sqlDbType === SqlDbType.postgres) {
|
|
65
|
+
} else if (baseInfo.sqlDbType === SqlDbType.postgres) {
|
|
71
66
|
const schemaname = 'public';
|
|
72
67
|
const columnArraySql = `
|
|
73
68
|
SELECT
|
|
@@ -77,17 +72,14 @@ class CrudProTableMetaService extends CrudProServiceBase {
|
|
|
77
72
|
ORDER BY ordinal_position;
|
|
78
73
|
`.trim();
|
|
79
74
|
const queryRes = await this.executeUnsafeQuery(baseInfo, columnArraySql);
|
|
80
|
-
const rows = pickAndConvertPgRows(queryRes)
|
|
75
|
+
const rows = pickAndConvertPgRows(queryRes);
|
|
81
76
|
return rows.map(fieldObj => {
|
|
82
77
|
return fieldObj['column_name'];
|
|
83
78
|
});
|
|
84
79
|
}
|
|
85
80
|
|
|
86
|
-
|
|
87
|
-
throw new Error("暂不支持的数据库类型:" + baseInfo.sqlDbType)
|
|
81
|
+
throw new Error('暂不支持的数据库类型:' + baseInfo.sqlDbType);
|
|
88
82
|
}
|
|
89
|
-
|
|
90
|
-
|
|
91
83
|
}
|
|
92
84
|
|
|
93
85
|
export { CrudProTableMetaService };
|
|
@@ -9,10 +9,10 @@ const DateTimeUtils = {
|
|
|
9
9
|
getCurrentTimeStampSecond(): number {
|
|
10
10
|
return Math.floor(Date.now() / 1000);
|
|
11
11
|
},
|
|
12
|
-
getCurrentDateFormat(format:string): string {
|
|
12
|
+
getCurrentDateFormat(format: string): string {
|
|
13
13
|
return moment(Date.now()).format(format);
|
|
14
14
|
},
|
|
15
|
-
getYesterdayDateFormat(format:string): string {
|
|
15
|
+
getYesterdayDateFormat(format: string): string {
|
|
16
16
|
return moment(Date.now()).add(-1, 'day').format(format);
|
|
17
17
|
},
|
|
18
18
|
};
|
|
@@ -50,7 +50,7 @@ const MixinUtils = {
|
|
|
50
50
|
},
|
|
51
51
|
|
|
52
52
|
startsWith(str1: string, str2: string): boolean {
|
|
53
|
-
if (typeof str1 ===
|
|
53
|
+
if (typeof str1 === 'string' && typeof str2 === 'string') {
|
|
54
54
|
return str1.startsWith(str2);
|
|
55
55
|
}
|
|
56
56
|
return false;
|
|
@@ -143,9 +143,8 @@ function validateByCfgString(validateCfg: KeysOfValidators | string, itemValue:
|
|
|
143
143
|
return;
|
|
144
144
|
}
|
|
145
145
|
|
|
146
|
-
|
|
147
146
|
// 必填
|
|
148
|
-
if (
|
|
147
|
+
if ('required' === validateCfg) {
|
|
149
148
|
if (isEmpty(itemValue)) {
|
|
150
149
|
throw new CommonException(Exceptions.VALIDATE_ERR, "'参数校验错误,字段 " + errPath + ' 不满足校验配置:' + validateCfg);
|
|
151
150
|
}
|
|
@@ -157,7 +156,6 @@ function validateByCfgString(validateCfg: KeysOfValidators | string, itemValue:
|
|
|
157
156
|
return;
|
|
158
157
|
}
|
|
159
158
|
|
|
160
|
-
|
|
161
159
|
// 校验失败
|
|
162
160
|
if (!validateByCfgStringInner(validateCfg, itemValue)) {
|
|
163
161
|
throw new CommonException(Exceptions.VALIDATE_ERR, "'参数校验错误,字段 " + errPath + ' 不满足校验配置:' + validateCfg);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {Pool} from 'pg';
|
|
2
|
-
import {IConnectionPool} from '../../interfaces';
|
|
3
|
-
import {SqlDbType} from
|
|
1
|
+
import { Pool } from 'pg';
|
|
2
|
+
import { IConnectionPool } from '../../interfaces';
|
|
3
|
+
import { SqlDbType } from '../../models/keys';
|
|
4
4
|
|
|
5
5
|
const POOL_CACHE_MAP: Record<string, IConnectionPool> = {};
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {ConnectionPool} from 'mssql';
|
|
2
|
-
import {IConnectionPool} from '../../interfaces';
|
|
3
|
-
import {SqlDbType} from
|
|
1
|
+
import { ConnectionPool } from 'mssql';
|
|
2
|
+
import { IConnectionPool } from '../../interfaces';
|
|
3
|
+
import { SqlDbType } from '../../models/keys';
|
|
4
4
|
|
|
5
5
|
const POOL_CACHE_MAP: Record<string, IConnectionPool> = {};
|
|
6
6
|
|
|
@@ -19,8 +19,6 @@ interface IGlobalStaticConfig {
|
|
|
19
19
|
*/
|
|
20
20
|
bizUpdateCfgModelForCrudMtd(reqJson: any, cfgModel: any, methodInfo: any, ctx: any): Promise<any>;
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
24
22
|
/**
|
|
25
23
|
* CrudPro: 业务系统自定义的修改cfgModel。这是最底层的!!全局的!!全局的!!全局的!!!
|
|
26
24
|
* @param reqJson
|
|
@@ -28,15 +26,12 @@ interface IGlobalStaticConfig {
|
|
|
28
26
|
*/
|
|
29
27
|
bizUpdateCfgModelForCrudPro(reqJson: any, cfgModel: any): Promise<any>;
|
|
30
28
|
|
|
31
|
-
|
|
32
|
-
|
|
33
29
|
/**
|
|
34
30
|
* 生成用户的账号ID,业务系统可以生成类似工号的ID
|
|
35
31
|
* @param userSubmitData
|
|
36
32
|
*/
|
|
37
33
|
generateUserAccountId(userSubmitData: any): Promise<string>;
|
|
38
34
|
|
|
39
|
-
|
|
40
35
|
/**
|
|
41
36
|
* 将业务系统表中的userId映射为fatcms的UserAccountId
|
|
42
37
|
* @param bizTableUserId 业余系统表中的UserId
|