midway-fatcms 0.0.1-beta.2 → 0.0.1-beta.20
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 +12 -0
- package/.prettierrc.js +4 -0
- package/README.md +7 -0
- package/dist/config/config.default.js +52 -15
- package/dist/configuration.d.ts +1 -0
- package/dist/configuration.js +33 -8
- package/dist/controller/base/BaseApiController.d.ts +1 -1
- package/dist/controller/base/BaseApiController.js +9 -6
- package/dist/controller/gateway/AsyncTaskController.d.ts +14 -0
- package/dist/controller/gateway/AsyncTaskController.js +108 -0
- package/dist/controller/gateway/CrudMtdGatewayController.d.ts +3 -3
- package/dist/controller/gateway/CrudMtdGatewayController.js +9 -6
- package/dist/controller/gateway/DocGatewayController.js +14 -9
- package/dist/controller/gateway/PublicApiController.js +4 -6
- package/dist/controller/gateway/StaticController.d.ts +2 -0
- package/dist/controller/gateway/StaticController.js +59 -40
- package/dist/controller/helpers.controller.d.ts +1 -1
- package/dist/controller/home.controller.js +2 -2
- package/dist/controller/manage/CrudStandardDesignApi.d.ts +1 -1
- package/dist/controller/manage/CrudStandardDesignApi.js +78 -75
- package/dist/controller/manage/DataDictManageApi.d.ts +1 -1
- package/dist/controller/manage/DeployManageApi.d.ts +1 -1
- package/dist/controller/manage/DeployManageApi.js +38 -34
- package/dist/controller/manage/MenuManageApi.js +1 -1
- package/dist/controller/manage/SuperAdminManageApi.d.ts +2 -2
- package/dist/controller/manage/SuperAdminManageApi.js +12 -8
- package/dist/controller/manage/SysConfigMangeApi.d.ts +1 -1
- package/dist/controller/manage/SysConfigMangeApi.js +6 -4
- package/dist/controller/manage/SystemInfoManageApi.d.ts +1 -1
- package/dist/controller/manage/SystemInfoManageApi.js +7 -1
- package/dist/controller/manage/UserAccountManageApi.d.ts +2 -2
- package/dist/controller/manage/UserAccountManageApi.js +5 -0
- package/dist/controller/manage/WorkbenchMangeApi.js +1 -1
- package/dist/controller/myinfo/AuthController.d.ts +0 -4
- package/dist/controller/myinfo/AuthController.js +1 -54
- package/dist/controller/render/AppRenderController.js +10 -4
- package/dist/controller/test.controller.d.ts +1 -1
- package/dist/controller/test.controller.js +5 -5
- package/dist/index.d.ts +34 -4
- package/dist/index.js +34 -4
- package/dist/libs/crud-pro/CrudPro.d.ts +1 -0
- package/dist/libs/crud-pro/CrudPro.js +5 -0
- package/dist/libs/crud-pro/defaultConfigs.js +2 -0
- package/dist/libs/crud-pro/interfaces.d.ts +7 -1
- package/dist/libs/crud-pro/models/ExecuteContext.d.ts +2 -1
- package/dist/libs/crud-pro/models/ExecuteContextFunc.d.ts +8 -1
- package/dist/libs/crud-pro/models/ExecuteContextFunc.js +8 -0
- package/dist/libs/crud-pro/models/RequestCfgModel.d.ts +1 -1
- package/dist/libs/crud-pro/models/ResModel.d.ts +16 -0
- package/dist/libs/crud-pro/models/ResModel.js +2 -0
- package/dist/libs/crud-pro/models/SqlCfgModel.d.ts +1 -1
- package/dist/libs/crud-pro/models/TransactionSqlServer.js +1 -1
- package/dist/libs/crud-pro/services/CrudProCachedCfgService.d.ts +1 -0
- package/dist/libs/crud-pro/services/CrudProCachedCfgService.js +22 -11
- package/dist/libs/crud-pro/services/CrudProExecuteSqlService.js +10 -9
- package/dist/libs/crud-pro/services/CrudProGenSqlCondition.d.ts +1 -1
- package/dist/libs/crud-pro/services/CrudProGenSqlCondition.js +10 -12
- package/dist/libs/crud-pro/services/CrudProGenSqlService.js +14 -23
- package/dist/libs/crud-pro/services/CrudProOriginToExecuteSql.js +7 -6
- package/dist/libs/crud-pro/services/CrudProServiceBase.d.ts +2 -6
- package/dist/libs/crud-pro/services/CrudProServiceBase.js +3 -2
- package/dist/libs/crud-pro/services/CrudProTableMetaService.d.ts +1 -0
- package/dist/libs/crud-pro/services/CrudProTableMetaService.js +31 -7
- package/dist/libs/crud-pro/utils/DatabaseName.js +24 -3
- package/dist/libs/crud-pro/utils/MixinUtils.js +1 -1
- package/dist/libs/crud-pro/utils/ValidateUtils.js +1 -1
- package/dist/libs/crud-pro/utils/sqlConvert/convertColumnName.js +2 -2
- package/dist/libs/global-config/global-config.d.ts +45 -0
- package/dist/libs/global-config/global-config.js +33 -0
- package/dist/libs/utils/errorToString.d.ts +2 -0
- package/dist/libs/utils/errorToString.js +57 -0
- package/dist/libs/utils/fatcms-request.js +2 -2
- package/dist/middleware/forbidden.middleware.js +4 -20
- package/dist/middleware/global.middleware.js +8 -1
- package/dist/models/AsyncTaskModel.d.ts +69 -0
- package/dist/models/AsyncTaskModel.js +26 -0
- package/dist/models/RedisKeys.d.ts +8 -0
- package/dist/models/RedisKeys.js +11 -0
- package/dist/models/SystemTables.d.ts +1 -3
- package/dist/models/SystemTables.js +2 -4
- package/dist/schedule/anonymousContext.d.ts +13 -0
- package/dist/schedule/anonymousContext.js +59 -0
- package/dist/schedule/index.d.ts +4 -3
- package/dist/schedule/index.js +8 -67
- package/dist/schedule/runSchedule.d.ts +15 -0
- package/dist/schedule/runSchedule.js +68 -0
- package/dist/schedule/scheduleNames.d.ts +13 -0
- package/dist/schedule/scheduleNames.js +17 -0
- package/dist/service/AuthService.js +8 -5
- package/dist/service/EnumInfoService.js +7 -4
- package/dist/service/FileCenterService.js +13 -9
- package/dist/service/SysConfigService.js +4 -2
- package/dist/service/UserAccountService.js +10 -6
- package/dist/service/UserSessionService.js +2 -1
- package/dist/service/VisitStatService.d.ts +1 -1
- package/dist/service/VisitStatService.js +20 -27
- package/dist/service/WorkbenchService.js +4 -2
- package/dist/service/anyapi/AnyApiService.js +4 -2
- package/dist/service/asyncTask/AsyncTaskRunnerService.d.ts +37 -0
- package/dist/service/asyncTask/AsyncTaskRunnerService.js +226 -0
- package/dist/service/asyncTask/AsyncTaskService.d.ts +7 -0
- package/dist/service/asyncTask/AsyncTaskService.js +34 -0
- package/dist/service/crudstd/CrudStdService.d.ts +1 -0
- package/dist/service/crudstd/CrudStdService.js +34 -3
- package/dist/service/curd/CrudProQuick.d.ts +24 -0
- package/dist/service/curd/CrudProQuick.js +105 -0
- package/dist/service/curd/CurdMixByAccountService.js +12 -6
- package/dist/service/curd/CurdMixByDictService.js +4 -2
- package/dist/service/curd/CurdMixByLinkToCustomService.d.ts +10 -1
- package/dist/service/curd/CurdMixByLinkToCustomService.js +72 -24
- package/dist/service/curd/CurdMixBySysConfigService.js +4 -2
- package/dist/service/curd/CurdMixByWorkbenchService.js +4 -2
- package/dist/service/curd/CurdMixService.d.ts +1 -1
- package/dist/service/curd/CurdMixService.js +2 -2
- package/dist/service/curd/CurdMixUtils.d.ts +7 -0
- package/dist/service/curd/CurdMixUtils.js +65 -28
- package/dist/service/curd/CurdProService.d.ts +2 -10
- package/dist/service/curd/CurdProService.js +31 -146
- package/dist/service/curd/fixCfgModel.d.ts +3 -0
- package/dist/service/curd/fixCfgModel.js +107 -0
- package/dist/service/proxyapi/ProxyApiLoadService.js +7 -4
- package/dist/views/404_app.html +31 -0
- package/dist/views/404_workbench.html +34 -0
- package/dist/views/static/favicon.ico +0 -0
- package/package.json +9 -2
- package/src/config/config.default.ts +58 -27
- package/src/configuration.ts +42 -9
- package/src/controller/base/BaseApiController.ts +19 -19
- package/src/controller/gateway/AnyApiGatewayController.ts +1 -1
- package/src/controller/gateway/AsyncTaskController.ts +83 -0
- package/src/controller/gateway/CrudMtdGatewayController.ts +17 -13
- package/src/controller/gateway/CrudStdGatewayController.ts +4 -4
- package/src/controller/gateway/DocGatewayController.ts +25 -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 -242
- package/src/controller/helpers.controller.ts +1 -1
- package/src/controller/home.controller.ts +8 -15
- package/src/controller/manage/AnyApiMangeApi.ts +9 -9
- 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 +106 -113
- package/src/controller/manage/DataDictManageApi.ts +4 -4
- package/src/controller/manage/DeployManageApi.ts +85 -89
- package/src/controller/manage/DocLibManageApi.ts +3 -3
- package/src/controller/manage/DocManageApi.ts +8 -8
- package/src/controller/manage/MenuManageApi.ts +9 -14
- package/src/controller/manage/SuperAdminManageApi.ts +14 -13
- package/src/controller/manage/SysConfigMangeApi.ts +9 -9
- package/src/controller/manage/SystemInfoManageApi.ts +11 -6
- package/src/controller/manage/UserAccountManageApi.ts +8 -2
- package/src/controller/manage/WorkbenchMangeApi.ts +6 -6
- package/src/controller/myinfo/AuthController.ts +6 -72
- package/src/controller/render/AppRenderController.ts +24 -21
- package/src/controller/test.controller.ts +18 -18
- package/src/index.ts +38 -4
- package/src/libs/crud-pro/CrudPro.ts +7 -0
- package/src/libs/crud-pro/defaultConfigs.ts +2 -0
- package/src/libs/crud-pro/interfaces.ts +10 -3
- package/src/libs/crud-pro/models/ExecuteContext.ts +3 -3
- package/src/libs/crud-pro/models/ExecuteContextFunc.ts +11 -1
- package/src/libs/crud-pro/models/RequestCfgModel.ts +1 -1
- package/src/libs/crud-pro/models/RequestModel.ts +1 -1
- package/src/libs/crud-pro/models/ResModel.ts +19 -0
- package/src/libs/crud-pro/models/SqlCfgModel.ts +2 -2
- 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 +26 -19
- package/src/libs/crud-pro/services/CrudProExecuteSqlService.ts +38 -50
- package/src/libs/crud-pro/services/CrudProGenSqlCondition.ts +26 -45
- package/src/libs/crud-pro/services/CrudProGenSqlService.ts +23 -40
- package/src/libs/crud-pro/services/CrudProOriginToExecuteSql.ts +25 -29
- package/src/libs/crud-pro/services/CrudProServiceBase.ts +5 -9
- package/src/libs/crud-pro/services/CrudProTableMetaService.ts +35 -9
- package/src/libs/crud-pro/utils/DatabaseName.ts +35 -15
- 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/crud-pro/utils/sqlConvert/convertColumnName.ts +2 -2
- package/src/libs/global-config/global-config.ts +78 -0
- package/src/libs/utils/crypto-utils.ts +2 -4
- package/src/libs/utils/errorToString.ts +61 -0
- 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 +18 -16
- package/src/models/AsyncTaskModel.ts +79 -0
- package/src/models/RedisKeys.ts +13 -0
- package/src/models/SystemTables.ts +1 -4
- package/src/models/bizmodels.ts +1 -2
- package/src/schedule/anonymousContext.ts +79 -0
- package/src/schedule/index.ts +11 -72
- package/src/schedule/runSchedule.ts +83 -0
- package/src/schedule/scheduleNames.ts +21 -0
- package/src/service/AuthService.ts +13 -8
- package/src/service/EnumInfoService.ts +8 -3
- package/src/service/FileCenterService.ts +12 -6
- package/src/service/SysConfigService.ts +10 -6
- package/src/service/UserAccountService.ts +14 -4
- package/src/service/UserSessionService.ts +5 -4
- package/src/service/VisitStatService.ts +57 -70
- package/src/service/WorkbenchService.ts +7 -2
- package/src/service/anyapi/AnyApiService.ts +11 -8
- package/src/service/asyncTask/AsyncTaskRunnerService.ts +249 -0
- package/src/service/asyncTask/AsyncTaskService.ts +21 -0
- package/src/service/base/BaseService.ts +2 -2
- package/src/service/crudstd/CrudStdService.ts +43 -5
- package/src/service/curd/CrudProQuick.ts +137 -0
- package/src/service/curd/CurdMixByAccountService.ts +14 -6
- package/src/service/curd/CurdMixByDictService.ts +8 -2
- package/src/service/curd/CurdMixByLinkToCustomService.ts +101 -50
- package/src/service/curd/CurdMixBySysConfigService.ts +7 -2
- package/src/service/curd/CurdMixByWorkbenchService.ts +6 -2
- package/src/service/curd/CurdMixService.ts +3 -3
- package/src/service/curd/CurdMixUtils.ts +82 -39
- package/src/service/curd/CurdProService.ts +45 -189
- package/src/service/curd/fixCfgModel.ts +139 -0
- package/src/service/proxyapi/ProxyApiLoadService.ts +12 -3
- package/src/views/404_app.html +31 -0
- package/src/views/404_workbench.html +34 -0
- package/src/views/static/favicon.ico +0 -0
- package/tsconfig.json +32 -0
- package/dist/controller/medstatistic/MedAdminController.d.ts +0 -35
- package/dist/controller/medstatistic/MedAdminController.js +0 -205
- package/dist/controller/medstatistic/MedClientController.d.ts +0 -28
- package/dist/controller/medstatistic/MedClientController.js +0 -188
- package/dist/controller/medstatistic/MedMessageService.d.ts +0 -19
- package/dist/controller/medstatistic/MedMessageService.js +0 -95
- package/dist/controller/medstatistic/MedScoreService.d.ts +0 -21
- package/dist/controller/medstatistic/MedScoreService.js +0 -107
- package/dist/controller/medstatistic/constants.d.ts +0 -32
- package/dist/controller/medstatistic/constants.js +0 -43
- package/src/controller/medstatistic/MedAdminController.ts +0 -221
- package/src/controller/medstatistic/MedClientController.ts +0 -188
- package/src/controller/medstatistic/MedMessageService.ts +0 -89
- package/src/controller/medstatistic/MedScoreService.ts +0 -108
- package/src/controller/medstatistic/constants.ts +0 -63
|
@@ -5,10 +5,11 @@ import { LRUCache } from 'lru-cache';
|
|
|
5
5
|
import { CurdProService } from './CurdProService';
|
|
6
6
|
import { ExecuteContext, IExecuteContextHandler } from '../../libs/crud-pro/models/ExecuteContext';
|
|
7
7
|
import { CrudMixUtils, RelatedType } from './CurdMixUtils';
|
|
8
|
-
import {
|
|
8
|
+
import { SystemTables } from '../../models/SystemTables';
|
|
9
9
|
import { KeysOfSimpleSQL } from '../../libs/crud-pro/models/keys';
|
|
10
10
|
import { ColumnRelation } from '../../libs/crud-pro/interfaces';
|
|
11
11
|
import { MixinUtils } from '../../libs/crud-pro/utils/MixinUtils';
|
|
12
|
+
import { GLOBAL_STATIC_CONFIG } from '@/libs/global-config/global-config';
|
|
12
13
|
|
|
13
14
|
const lruCache = new LRUCache<string, any>({
|
|
14
15
|
max: 500,
|
|
@@ -29,6 +30,9 @@ export class CurdMixByWorkbenchService implements IExecuteContextHandler {
|
|
|
29
30
|
protected curdProService: CurdProService;
|
|
30
31
|
|
|
31
32
|
private async loadWorkbenchListMap() {
|
|
33
|
+
|
|
34
|
+
const { SystemDbName, SystemDbType } = GLOBAL_STATIC_CONFIG.getConfig();
|
|
35
|
+
|
|
32
36
|
let workbenchListMap = lruCache.get('workbenchListMap');
|
|
33
37
|
if (!workbenchListMap) {
|
|
34
38
|
const reqJson = {
|
|
@@ -39,7 +43,7 @@ export class CurdMixByWorkbenchService implements IExecuteContextHandler {
|
|
|
39
43
|
sqlTable: SystemTables.sys_workbench,
|
|
40
44
|
sqlSimpleName: KeysOfSimpleSQL.SIMPLE_QUERY,
|
|
41
45
|
sqlDatabase: SystemDbName,
|
|
42
|
-
|
|
46
|
+
sqlDbType: SystemDbType,
|
|
43
47
|
});
|
|
44
48
|
const workbenchList = res.getResRows();
|
|
45
49
|
workbenchListMap = MixinUtils.toNewMap(workbenchList, (obj: any) => obj.workbench_code);
|
|
@@ -8,7 +8,7 @@ import { RelatedType } from './CurdMixUtils';
|
|
|
8
8
|
import { CurdMixByWorkbenchService } from './CurdMixByWorkbenchService';
|
|
9
9
|
import { IRequestCfgModel2 } from '../../models/bizmodels';
|
|
10
10
|
import {CurdMixByLinkToCustomService} from "./CurdMixByLinkToCustomService";
|
|
11
|
-
import {SqlDbType} from "
|
|
11
|
+
import {SqlDbType} from "@/libs/crud-pro/models/keys";
|
|
12
12
|
|
|
13
13
|
@Provide()
|
|
14
14
|
export class CurdMixService {
|
|
@@ -44,9 +44,9 @@ export class CurdMixService {
|
|
|
44
44
|
return this.curdProService.executeCrudByCfg(reqJson, cfgModel);
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
getBbUtil(
|
|
47
|
+
getBbUtil(sqlDatabase: string, sqlDbType: SqlDbType, sqlTable?: string) {
|
|
48
48
|
this.prepare();
|
|
49
|
-
return this.curdProService.getBbUtil(
|
|
49
|
+
return this.curdProService.getBbUtil(sqlDatabase, sqlDbType, sqlTable);
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
async executeSQL(sqlCfgModel: ISqlCfgModel) {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {ColumnRelation, CopyAttr} from '
|
|
2
|
-
import { ExecuteContext } from '
|
|
3
|
-
import { KeyOfCrudTypes } from '
|
|
4
|
-
import { MixinUtils } from '
|
|
5
|
-
import { SqlCfgModel } from '
|
|
6
|
-
import { RequestCfgModel } from '
|
|
1
|
+
import { ColumnRelation, CopyAttr } from '@/libs/crud-pro/interfaces';
|
|
2
|
+
import { ExecuteContext } from '@/libs/crud-pro/models/ExecuteContext';
|
|
3
|
+
import { KeyOfCrudTypes } from '@/libs/crud-pro/models/keys';
|
|
4
|
+
import { MixinUtils } from '@/libs/crud-pro/utils/MixinUtils';
|
|
5
|
+
import { SqlCfgModel } from '@/libs/crud-pro/models/SqlCfgModel';
|
|
6
|
+
import { RequestCfgModel } from '@/libs/crud-pro/models/RequestCfgModel';
|
|
7
7
|
import * as _ from 'lodash';
|
|
8
|
-
import { MultiKeyMap } from '
|
|
9
|
-
import { parseJsonObject } from '
|
|
8
|
+
import { MultiKeyMap } from '@/libs/crud-pro/utils/MultiKeyMap';
|
|
9
|
+
import { parseJsonObject } from '@/libs/utils/functions';
|
|
10
10
|
|
|
11
11
|
enum RelatedType {
|
|
12
12
|
dict = 'dict', // 关联数据字典
|
|
@@ -33,7 +33,7 @@ function getColumnsRelationAll(sqlCfg: SqlCfgModel, cfgModel: RequestCfgModel):
|
|
|
33
33
|
|
|
34
34
|
|
|
35
35
|
|
|
36
|
-
function copyBySingleSourceValue(row: any, sourceValue:any, targetColumns: CopyAttr[], getValue: any
|
|
36
|
+
function copyBySingleSourceValue(row: any, sourceValue: any, targetColumns: CopyAttr[], getValue: any) {
|
|
37
37
|
// const codeObject = map.get(sourceValue);
|
|
38
38
|
const codeObject = getValue(sourceValue);
|
|
39
39
|
if (typeof codeObject === 'undefined' || codeObject === null) {
|
|
@@ -59,46 +59,54 @@ function copyBySingleSourceValue(row: any, sourceValue:any, targetColumns: CopyA
|
|
|
59
59
|
|
|
60
60
|
|
|
61
61
|
|
|
62
|
-
function copyByArraySourceValue(row: any, sourceValue:any, targetColumns: CopyAttr[], getValue: any ): boolean {
|
|
63
|
-
let isSetArray = false;
|
|
64
|
-
// 支持关联JSON数组
|
|
65
|
-
if (typeof sourceValue === 'string' && sourceValue.startsWith('[') && sourceValue.endsWith(']')) {
|
|
66
|
-
const codes = parseJsonObject(sourceValue);
|
|
67
|
-
if (Array.isArray(codes)) {
|
|
68
|
-
for (let codeIndex = 0; codeIndex < codes.length; codeIndex++) {
|
|
69
|
-
const code = codes[codeIndex];
|
|
70
|
-
// const codeObject = map.get(code);
|
|
71
|
-
const codeObject = getValue(code);
|
|
72
|
-
if (codeObject) {
|
|
73
|
-
if (Array.isArray(targetColumns)) {
|
|
74
|
-
for (let i = 0; i < targetColumns.length; i++) {
|
|
75
|
-
const targetColumn = targetColumns[i];
|
|
76
62
|
|
|
77
|
-
if (targetColumn.from === '*') {
|
|
78
63
|
|
|
79
|
-
const toStr = targetColumn.to.replace('$ARRAY_INDEX', `${codeIndex}`);
|
|
80
|
-
_.set(row, toStr, codeObject);
|
|
81
64
|
|
|
82
|
-
isSetArray = true;
|
|
83
65
|
|
|
84
|
-
|
|
66
|
+
function copyByArraySourceValueInner(row: any, codes: any[], targetColumns: CopyAttr[], getValue: any, resultObj: any) {
|
|
67
|
+
|
|
68
|
+
for (let codeIndex = 0; codeIndex < codes.length; codeIndex++) {
|
|
69
|
+
const code = codes[codeIndex];
|
|
70
|
+
// const codeObject = map.get(code);
|
|
71
|
+
const codeObject = getValue(code);
|
|
72
|
+
if (codeObject) {
|
|
73
|
+
if (Array.isArray(targetColumns)) {
|
|
74
|
+
for (let i = 0; i < targetColumns.length; i++) {
|
|
75
|
+
const targetColumn = targetColumns[i];
|
|
76
|
+
|
|
77
|
+
if (targetColumn.from === '*') {
|
|
85
78
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
const toStr = targetColumn.to.replace('$ARRAY_INDEX', `${codeIndex}`);
|
|
89
|
-
_.set(row, toStr, dictAttrValue);
|
|
90
|
-
isSetArray = true;
|
|
79
|
+
const toStr = targetColumn.to.replace('$ARRAY_INDEX', `${codeIndex}`);
|
|
80
|
+
_.set(row, toStr, codeObject);
|
|
91
81
|
|
|
92
|
-
|
|
93
|
-
|
|
82
|
+
resultObj.isSetArray = true;
|
|
83
|
+
} else {
|
|
84
|
+
const dictAttrValue = _.get(codeObject, targetColumn.from);
|
|
85
|
+
if (typeof dictAttrValue !== 'undefined' && dictAttrValue !== null) {
|
|
86
|
+
const toStr = targetColumn.to.replace('$ARRAY_INDEX', `${codeIndex}`);
|
|
87
|
+
_.set(row, toStr, dictAttrValue);
|
|
88
|
+
resultObj.isSetArray = true;
|
|
94
89
|
}
|
|
95
90
|
}
|
|
96
91
|
}
|
|
97
92
|
}
|
|
98
93
|
}
|
|
99
94
|
}
|
|
95
|
+
}
|
|
100
96
|
|
|
101
|
-
|
|
97
|
+
function copyByArraySourceValue(row: any, sourceValue: any, targetColumns: CopyAttr[], getValue: any): boolean {
|
|
98
|
+
const resultObj = {isSetArray: false }
|
|
99
|
+
// 支持关联JSON数组。使用 字符串存储的类型
|
|
100
|
+
if (typeof sourceValue === 'string' && sourceValue.startsWith('[') && sourceValue.endsWith(']')) {
|
|
101
|
+
const codes = parseJsonObject(sourceValue);
|
|
102
|
+
if (Array.isArray(codes)) {
|
|
103
|
+
copyByArraySourceValueInner(row, codes, targetColumns, getValue, resultObj);
|
|
104
|
+
}
|
|
105
|
+
} else if(Array.isArray(sourceValue)) {
|
|
106
|
+
// 直接使用JSON或者postgres的数组存储的类型
|
|
107
|
+
copyByArraySourceValueInner(row, sourceValue, targetColumns, getValue, resultObj);
|
|
108
|
+
}
|
|
109
|
+
return resultObj.isSetArray;
|
|
102
110
|
}
|
|
103
111
|
|
|
104
112
|
|
|
@@ -134,7 +142,7 @@ class CrudMixUtils {
|
|
|
134
142
|
}
|
|
135
143
|
}
|
|
136
144
|
}
|
|
137
|
-
return _.uniqBy(relationResult,(obj: ColumnRelation)=> {
|
|
145
|
+
return _.uniqBy(relationResult, (obj: ColumnRelation) => {
|
|
138
146
|
return `${obj.relatedCode}_${obj.relatedType}_${obj.sourceColumn}_${JSON.stringify(obj.targetColumns)}`;
|
|
139
147
|
});
|
|
140
148
|
}
|
|
@@ -191,7 +199,7 @@ class CrudMixUtils {
|
|
|
191
199
|
}
|
|
192
200
|
|
|
193
201
|
const sourceValue = _.get(row, sourceColumn);
|
|
194
|
-
if (typeof sourceValue ==='undefined' || sourceValue ===null) {
|
|
202
|
+
if (typeof sourceValue === 'undefined' || sourceValue === null) {
|
|
195
203
|
return;
|
|
196
204
|
}
|
|
197
205
|
|
|
@@ -216,7 +224,7 @@ class CrudMixUtils {
|
|
|
216
224
|
* @param columnRelation
|
|
217
225
|
*/
|
|
218
226
|
public copyColumnRelationToRowNoRelatedCode(row: any, map: Map<string, any>, columnRelation: ColumnRelation) {
|
|
219
|
-
const {sourceColumn, targetColumns} = columnRelation;
|
|
227
|
+
const { sourceColumn, targetColumns } = columnRelation;
|
|
220
228
|
if (!sourceColumn || !targetColumns) {
|
|
221
229
|
return;
|
|
222
230
|
}
|
|
@@ -243,6 +251,41 @@ class CrudMixUtils {
|
|
|
243
251
|
|
|
244
252
|
}
|
|
245
253
|
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* 专门COPY用户信息到row上面。无relatedCode模式
|
|
257
|
+
* @param row
|
|
258
|
+
* @param map
|
|
259
|
+
* @param columnRelation
|
|
260
|
+
*/
|
|
261
|
+
public copyUserInfoToRowNoRelatedCode(row: any, map: Map<string, any>, columnRelation: ColumnRelation) {
|
|
262
|
+
const { targetColumns } = columnRelation;
|
|
263
|
+
if (!targetColumns) {
|
|
264
|
+
return;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
const tmpSourceColumn = '__fatcmsUserAccountId__';
|
|
268
|
+
|
|
269
|
+
const sourceValue = _.get(row, tmpSourceColumn);
|
|
270
|
+
if (!sourceValue) {
|
|
271
|
+
return;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
const getValue = (code: string) => {
|
|
275
|
+
if (!map) {
|
|
276
|
+
return null;
|
|
277
|
+
}
|
|
278
|
+
if (typeof map.get === 'function') {
|
|
279
|
+
return map.get(`${code}`);
|
|
280
|
+
}
|
|
281
|
+
return map[code];
|
|
282
|
+
};
|
|
283
|
+
|
|
284
|
+
const isSetArray = copyByArraySourceValue(row, sourceValue, targetColumns, getValue);
|
|
285
|
+
if (!isSetArray) {
|
|
286
|
+
copyBySingleSourceValue(row, sourceValue, targetColumns, getValue);
|
|
287
|
+
}
|
|
288
|
+
}
|
|
246
289
|
}
|
|
247
290
|
|
|
248
291
|
export { CrudMixUtils, RelatedType, FuncRowColumnRelation };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as _ from 'lodash';
|
|
2
2
|
import {Config, Inject, Provide} from '@midwayjs/core';
|
|
3
|
-
import {CrudPro} from '
|
|
3
|
+
import {CrudPro} from '@/libs/crud-pro/CrudPro';
|
|
4
4
|
import {Context} from '@midwayjs/koa';
|
|
5
5
|
import {
|
|
6
6
|
IConnectionPool,
|
|
@@ -8,27 +8,26 @@ import {
|
|
|
8
8
|
IRequestCfgModel,
|
|
9
9
|
IRequestModel,
|
|
10
10
|
ISqlCfgModel
|
|
11
|
-
} from '
|
|
12
|
-
import {SqlCfgModel} from '
|
|
11
|
+
} from '@/libs/crud-pro/interfaces';
|
|
12
|
+
import {SqlCfgModel} from '@/libs/crud-pro/models/SqlCfgModel';
|
|
13
13
|
import {getConnectionPool as getMySQLConnectionPool} from '../../libs/crud-pro/utils/pool/MySQLUtils';
|
|
14
14
|
import {getConnectionPool as getPostgresConnectionPool} from '../../libs/crud-pro/utils/pool/PostgresUtils';
|
|
15
15
|
import {getConnectionPool as getSqlServerConnectionPool} from '../../libs/crud-pro/utils/pool/SqlServerUtils';
|
|
16
|
-
import {
|
|
17
|
-
import {CommonException, Exceptions} from '
|
|
18
|
-
import {UserSessionInfo} from '
|
|
19
|
-
import {BaseExecuteContextFunc} from '
|
|
20
|
-
import {ExecuteContext, IExecuteContextHandler} from '
|
|
16
|
+
import { SqlDbType} from '@/libs/crud-pro/models/keys';
|
|
17
|
+
import {CommonException, Exceptions} from '@/libs/crud-pro/exceptions';
|
|
18
|
+
import {UserSessionInfo} from '@/models/userSession';
|
|
19
|
+
import {BaseExecuteContextFunc} from '@/libs/crud-pro/models/ExecuteContextFunc';
|
|
20
|
+
import {ExecuteContext, IExecuteContextHandler} from '@/libs/crud-pro/models/ExecuteContext';
|
|
21
21
|
import {RelatedType} from './CurdMixUtils';
|
|
22
22
|
import {BaseService} from '../base/BaseService';
|
|
23
23
|
import {
|
|
24
|
-
CTX_VISITOR_ACCOUNT_TYPE,
|
|
25
|
-
CTX_VISITOR_AVATAR,
|
|
26
|
-
CTX_VISITOR_ID,
|
|
27
|
-
CTX_VISITOR_NICKNAME,
|
|
28
24
|
IRequestCfgModel2,
|
|
29
25
|
IVisitorExt,
|
|
30
|
-
} from '
|
|
31
|
-
import {IWorkbenchEntity} from '
|
|
26
|
+
} from '@/models/bizmodels';
|
|
27
|
+
import {IWorkbenchEntity} from '@/models/SystemEntities';
|
|
28
|
+
import {CrudProQuick} from "@/service/curd/CrudProQuick";
|
|
29
|
+
import {fixCfgModel} from "./fixCfgModel";
|
|
30
|
+
import {GLOBAL_STATIC_CONFIG} from "@/libs/global-config/global-config";
|
|
32
31
|
|
|
33
32
|
function toVisitor(ctx: Context): IVisitorExt {
|
|
34
33
|
const workbenchInfo: IWorkbenchEntity = ctx.workbenchInfo;
|
|
@@ -82,19 +81,21 @@ class MyContextFunc extends BaseExecuteContextFunc {
|
|
|
82
81
|
throw new CommonException(Exceptions.DB_QUERY_PARAM_EMPTY, '查询语句中未指定数据库');
|
|
83
82
|
}
|
|
84
83
|
const dataBaseName = sqlCfgModel.sqlDatabase;
|
|
85
|
-
const
|
|
84
|
+
const sqlDbType = sqlCfgModel.sqlDbType;
|
|
86
85
|
|
|
87
|
-
if (
|
|
86
|
+
if (sqlDbType === SqlDbType.postgres) {
|
|
88
87
|
const dbConfig = _.get(this.postgres2Config, dataBaseName);
|
|
89
88
|
if (!dbConfig) {
|
|
89
|
+
console.error('postgres配置中不存在此数据库', JSON.stringify(sqlCfgModel));
|
|
90
90
|
throw new CommonException(Exceptions.DB_NOT_FOUND, 'postgres配置中不存在此数据库:' + dataBaseName);
|
|
91
91
|
}
|
|
92
92
|
return getPostgresConnectionPool(dataBaseName, dbConfig);
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
-
if (
|
|
95
|
+
if (sqlDbType === SqlDbType.sqlserver) {
|
|
96
96
|
const dbConfig = _.get(this.sqlserver2Config, dataBaseName);
|
|
97
97
|
if (!dbConfig) {
|
|
98
|
+
console.error('sqlserver配置中不存在此数据库', JSON.stringify(sqlCfgModel));
|
|
98
99
|
throw new CommonException(Exceptions.DB_NOT_FOUND, 'sqlserver配置中不存在此数据库:' + dataBaseName);
|
|
99
100
|
}
|
|
100
101
|
return getSqlServerConnectionPool(dataBaseName, dbConfig);
|
|
@@ -102,6 +103,7 @@ class MyContextFunc extends BaseExecuteContextFunc {
|
|
|
102
103
|
|
|
103
104
|
const dbConfig = _.get(this.mysql2Config, dataBaseName);
|
|
104
105
|
if (!dbConfig) {
|
|
106
|
+
console.error('MySQL配置中不存在此数据库', JSON.stringify(sqlCfgModel));
|
|
105
107
|
throw new CommonException(Exceptions.DB_NOT_FOUND, 'MySQL配置中不存在此数据库:' + dataBaseName);
|
|
106
108
|
}
|
|
107
109
|
return getMySQLConnectionPool(dataBaseName, dbConfig);
|
|
@@ -118,50 +120,23 @@ class MyContextFunc extends BaseExecuteContextFunc {
|
|
|
118
120
|
}
|
|
119
121
|
return null;
|
|
120
122
|
}
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
export class DBUtils {
|
|
124
|
-
private readonly sqlDatabase: string;
|
|
125
|
-
private readonly sqlDdType: SqlDbType;
|
|
126
|
-
private readonly curdProService: CurdProService;
|
|
127
123
|
|
|
128
|
-
constructor(sqlDatabase: string, sqlDdType: SqlDbType, curdProService: CurdProService) {
|
|
129
|
-
this.sqlDatabase = sqlDatabase;
|
|
130
|
-
this.sqlDdType = sqlDdType;
|
|
131
|
-
this.curdProService = curdProService;
|
|
132
|
-
}
|
|
133
124
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
125
|
+
/**
|
|
126
|
+
* 在执行之前可以根据业务需要修改需要执行的内容
|
|
127
|
+
* @param reqJson
|
|
128
|
+
* @param cfgJson
|
|
129
|
+
*/
|
|
130
|
+
async beforeExecuteSQLList(reqJson: IRequestModel, cfgJson: IRequestCfgModel): Promise<any> {
|
|
131
|
+
const { bizUpdateCfgModelForCrudPro } = GLOBAL_STATIC_CONFIG.getConfig();
|
|
132
|
+
if (typeof bizUpdateCfgModelForCrudPro === "function") {
|
|
133
|
+
await bizUpdateCfgModelForCrudPro(reqJson, cfgJson)
|
|
134
|
+
}
|
|
135
|
+
return Promise.resolve();
|
|
144
136
|
}
|
|
145
137
|
|
|
146
|
-
public async getList(reqJson: IRequestModel, sqlTable: string): Promise<any[]> {
|
|
147
|
-
const cfgModel: IRequestCfgModel = {
|
|
148
|
-
sqlTable,
|
|
149
|
-
sqlSimpleName: KeysOfSimpleSQL.SIMPLE_QUERY,
|
|
150
|
-
sqlDatabase: this.sqlDatabase,
|
|
151
|
-
sqlDdType: this.sqlDdType,
|
|
152
|
-
updateCfg: {},
|
|
153
|
-
};
|
|
154
|
-
const res = await this.curdProService.executeCrudByCfg(reqJson, cfgModel);
|
|
155
|
-
return res.getResRows();
|
|
156
|
-
}
|
|
157
138
|
}
|
|
158
139
|
|
|
159
|
-
function isSimpleQuery(sqlSimpleName: KeysOfSimpleSQL): boolean {
|
|
160
|
-
return sqlSimpleName === KeysOfSimpleSQL.SIMPLE_QUERY ||
|
|
161
|
-
sqlSimpleName === KeysOfSimpleSQL.SIMPLE_QUERY_COUNT ||
|
|
162
|
-
sqlSimpleName === KeysOfSimpleSQL.SIMPLE_QUERY_PAGE ||
|
|
163
|
-
sqlSimpleName === KeysOfSimpleSQL.SIMPLE_QUERY_ONE
|
|
164
|
-
}
|
|
165
140
|
|
|
166
141
|
@Provide()
|
|
167
142
|
export class CurdProService extends BaseService {
|
|
@@ -196,9 +171,15 @@ export class CurdProService extends BaseService {
|
|
|
196
171
|
|
|
197
172
|
const crudPro = new CrudPro();
|
|
198
173
|
crudPro.transaction = this.ctx.transaction;
|
|
199
|
-
crudPro.logger = this.getContextLogger();
|
|
174
|
+
crudPro.logger = this.getContextLogger() as any;
|
|
200
175
|
crudPro.visitor = visitor;
|
|
201
|
-
|
|
176
|
+
|
|
177
|
+
const crudProCfg: ICrudProCfg = this.crudProCfg || {};
|
|
178
|
+
const { SystemDbName, SystemDbType } = GLOBAL_STATIC_CONFIG.getConfig();
|
|
179
|
+
crudProCfg.sysDatabaseName = SystemDbName;
|
|
180
|
+
crudProCfg.sysDatabaseDbType = SystemDbType;
|
|
181
|
+
|
|
182
|
+
crudPro.contextCfg = crudProCfg;
|
|
202
183
|
|
|
203
184
|
crudPro.contextFunc = new MyContextFunc({
|
|
204
185
|
mysql2Config: this.mysql2Config,
|
|
@@ -213,7 +194,7 @@ export class CurdProService extends BaseService {
|
|
|
213
194
|
* 依赖缓存中与加载的配置
|
|
214
195
|
* @param reqJson
|
|
215
196
|
*/
|
|
216
|
-
async executeCrud(reqJson: IRequestModel) {
|
|
197
|
+
async executeCrud(reqJson: IRequestModel): Promise<ExecuteContext> {
|
|
217
198
|
if (!reqJson.method) {
|
|
218
199
|
throw new Error('Method not implemented');
|
|
219
200
|
}
|
|
@@ -234,141 +215,16 @@ export class CurdProService extends BaseService {
|
|
|
234
215
|
// 直接执行一个请求
|
|
235
216
|
async executeCrudByCfg(reqJson: IRequestModel, cfgModel: IRequestCfgModel2): Promise<ExecuteContext> {
|
|
236
217
|
this.logInfo('executeCrudByCfg', cfgModel);
|
|
237
|
-
|
|
238
|
-
if (!cfgModel.method) {
|
|
239
|
-
const req = this.ctx.req;
|
|
240
|
-
if (req) {
|
|
241
|
-
cfgModel.method = `${req.method}:${req.url}`;
|
|
242
|
-
} else {
|
|
243
|
-
cfgModel.method = 'anonymous';
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
if (!cfgModel.updateCfg) {
|
|
248
|
-
cfgModel.updateCfg = {};
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
// 应用标准的updateCfg
|
|
252
|
-
this.applyStandardUpdateCfg(cfgModel);
|
|
253
|
-
|
|
254
218
|
const curdPro = this.getCrudPro();
|
|
255
|
-
return await curdPro.executeCrudByCfg(reqJson, cfgModel);
|
|
256
|
-
}
|
|
257
|
-
|
|
258
219
|
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
const enableStandardUpdateCfg = cfgModel.enableStandardUpdateCfg; // 用于设置data字段
|
|
264
|
-
const enableStandardUpdateCfgCondition = cfgModel.enableStandardUpdateCfgCondition; // 用于设置condition字段
|
|
265
|
-
|
|
266
|
-
// 彻底关闭
|
|
267
|
-
if (enableStandardUpdateCfg === false) {
|
|
268
|
-
return ;
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
const getDataCfgArray = ()=>{
|
|
272
|
-
// 明确有配置
|
|
273
|
-
if (Array.isArray(enableStandardUpdateCfg)) {
|
|
274
|
-
if (enableStandardUpdateCfg.includes('null')) {
|
|
275
|
-
return [];
|
|
276
|
-
}
|
|
277
|
-
return enableStandardUpdateCfg;
|
|
278
|
-
}
|
|
279
|
-
// update 、insert 添加 by
|
|
280
|
-
return ['by']; // 创建/修改语句默认添加by
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
const getConditionCfgArray = ()=>{
|
|
284
|
-
// 明确有配置
|
|
285
|
-
if (Array.isArray(enableStandardUpdateCfgCondition)) {
|
|
286
|
-
if (enableStandardUpdateCfgCondition.includes('null')) {
|
|
287
|
-
return [];
|
|
288
|
-
}
|
|
289
|
-
return enableStandardUpdateCfgCondition;
|
|
290
|
-
}
|
|
291
|
-
return [];
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
const dataCfgArray = getDataCfgArray();
|
|
296
|
-
const conditionCfgArray = getConditionCfgArray();
|
|
297
|
-
|
|
298
|
-
const mapping = {
|
|
299
|
-
|
|
300
|
-
'condition.created_by': {contextAsString: CTX_VISITOR_ID},
|
|
301
|
-
'condition.created_account_type': {contextAsString: CTX_VISITOR_ACCOUNT_TYPE},
|
|
302
|
-
|
|
303
|
-
'data.created_by': {contextAsString: CTX_VISITOR_ID},
|
|
304
|
-
'data.created_avatar': {contextAsString: CTX_VISITOR_AVATAR},
|
|
305
|
-
'data.created_nickname': {contextAsString: CTX_VISITOR_NICKNAME},
|
|
306
|
-
'data.created_account_type': {contextAsString: CTX_VISITOR_ACCOUNT_TYPE},
|
|
307
|
-
|
|
308
|
-
'data.modified_by': {contextAsString: CTX_VISITOR_ID},
|
|
309
|
-
'data.modified_avatar': {contextAsString: CTX_VISITOR_AVATAR},
|
|
310
|
-
'data.modified_nickname': {contextAsString: CTX_VISITOR_NICKNAME},
|
|
311
|
-
'data.modified_account_type': {contextAsString: CTX_VISITOR_ACCOUNT_TYPE},
|
|
312
|
-
};
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
const buildUpdateCfgBy = (cfgArray: string[], prefix: string): any => {
|
|
316
|
-
const obj: any = {};
|
|
317
|
-
if (Array.isArray(cfgArray)) {
|
|
318
|
-
for (let i = 0; i < cfgArray.length; i++) {
|
|
319
|
-
const suffix = cfgArray[i];
|
|
320
|
-
if (suffix) {
|
|
321
|
-
const key = `${prefix}_${suffix}`
|
|
322
|
-
obj[key] = mapping[key]
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
return obj;
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
// 查询语句
|
|
330
|
-
if (isSimpleQuery(sqlSimpleName) ) {
|
|
331
|
-
const updateCfgObj = buildUpdateCfgBy(conditionCfgArray, 'condition.created'); // 查询用户本人创建的
|
|
332
|
-
Object.assign(cfgModel.updateCfg, updateCfgObj);
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
// 删除语句
|
|
336
|
-
if (sqlSimpleName === KeysOfSimpleSQL.SIMPLE_DELETE) {
|
|
337
|
-
const updateCfgObj = buildUpdateCfgBy(conditionCfgArray, 'condition.created'); // 删除用户本人创建的
|
|
338
|
-
Object.assign(cfgModel.updateCfg, updateCfgObj);
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
// 插入语句
|
|
342
|
-
if (sqlSimpleName === KeysOfSimpleSQL.SIMPLE_INSERT) {
|
|
343
|
-
const updateCfgObj1 = buildUpdateCfgBy(dataCfgArray,'data.created')
|
|
344
|
-
Object.assign(cfgModel.updateCfg, updateCfgObj1);
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
// 更新语句
|
|
348
|
-
if (sqlSimpleName === KeysOfSimpleSQL.SIMPLE_UPDATE) {
|
|
349
|
-
const updateCfgObj1 = buildUpdateCfgBy(dataCfgArray,'data.modified')
|
|
350
|
-
const updateCfgObj2 = buildUpdateCfgBy(conditionCfgArray, 'condition.created'); // 更新用户本人创建的
|
|
351
|
-
Object.assign(cfgModel.updateCfg, updateCfgObj1);
|
|
352
|
-
Object.assign(cfgModel.updateCfg, updateCfgObj2);
|
|
353
|
-
}
|
|
354
|
-
|
|
355
|
-
// 插入或更新
|
|
356
|
-
if (sqlSimpleName === KeysOfSimpleSQL.SIMPLE_INSERT_OR_UPDATE ||
|
|
357
|
-
sqlSimpleName === KeysOfSimpleSQL.SIMPLE_INSERT_ON_DUPLICATE_UPDATE) {
|
|
358
|
-
const updateCfgObj1 = buildUpdateCfgBy(dataCfgArray,'data.created')
|
|
359
|
-
const updateCfgObj2 = buildUpdateCfgBy(dataCfgArray,'data.modified')
|
|
360
|
-
const updateCfgObj3 = buildUpdateCfgBy(conditionCfgArray, 'condition.created'); // 更新用户本人创建的
|
|
361
|
-
Object.assign(cfgModel.updateCfg, updateCfgObj1);
|
|
362
|
-
Object.assign(cfgModel.updateCfg, updateCfgObj2);
|
|
363
|
-
Object.assign(cfgModel.updateCfg, updateCfgObj3);
|
|
364
|
-
}
|
|
220
|
+
// 应用标准的updateCfg。
|
|
221
|
+
fixCfgModel(cfgModel);
|
|
222
|
+
return await curdPro.executeCrudByCfg(reqJson, cfgModel);
|
|
365
223
|
}
|
|
366
224
|
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
getBbUtil(database: string, sqlDdType: SqlDbType): DBUtils {
|
|
371
|
-
return new DBUtils(database, sqlDdType, this);
|
|
225
|
+
getBbUtil(sqlDatabase: string, sqlDbType: SqlDbType, sqlTable?: string): CrudProQuick {
|
|
226
|
+
const curdPro = this.getCrudPro();
|
|
227
|
+
return new CrudProQuick(curdPro, sqlDatabase, sqlDbType, sqlTable);
|
|
372
228
|
}
|
|
373
229
|
|
|
374
230
|
public async getCachedCfgByMethod(method: string): Promise<IRequestCfgModel> {
|