midway-fatcms 0.0.1-beta.2 → 0.0.1-beta.22
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 +14 -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/CrudStdGatewayController.d.ts +5 -5
- 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/AnyApiMangeApi.js +2 -2
- package/dist/controller/manage/AppLogMangeApi.js +2 -2
- package/dist/controller/manage/AppMangeApi.js +2 -2
- package/dist/controller/manage/AppPageMangeApi.js +2 -2
- package/dist/controller/manage/AppSchemaHistoryApi.js +2 -2
- package/dist/controller/manage/CrudMethodsMangeApi.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/DataDictManageApi.js +1 -1
- package/dist/controller/manage/DeployManageApi.d.ts +1 -1
- package/dist/controller/manage/DeployManageApi.js +38 -34
- package/dist/controller/manage/DocLibManageApi.js +2 -2
- package/dist/controller/manage/DocManageApi.js +2 -2
- package/dist/controller/manage/FileManageApi.js +1 -1
- package/dist/controller/manage/LowCodeTplManageApi.js +2 -2
- package/dist/controller/manage/MenuManageApi.js +2 -2
- package/dist/controller/manage/ProxyApiMangeApi.js +2 -2
- 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 +8 -6
- 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 +7 -2
- package/dist/controller/manage/WorkbenchMangeApi.js +3 -3
- 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 +27 -15
- package/dist/libs/crud-pro/services/CrudProExecuteSqlService.js +13 -17
- 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 +32 -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/crud-pro/utils/sqlConvert/convertMix.d.ts +3 -0
- package/dist/libs/crud-pro/utils/sqlConvert/convertMix.js +22 -0
- 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 +232 -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 +2 -1
- package/dist/service/crudstd/CrudStdService.js +48 -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 +26 -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 +11 -11
- package/src/controller/manage/AppLogMangeApi.ts +5 -5
- package/src/controller/manage/AppMangeApi.ts +7 -7
- package/src/controller/manage/AppPageMangeApi.ts +5 -5
- package/src/controller/manage/AppSchemaHistoryApi.ts +3 -3
- package/src/controller/manage/CrudMethodsMangeApi.ts +5 -5
- package/src/controller/manage/CrudStandardDesignApi.ts +106 -113
- package/src/controller/manage/DataDictManageApi.ts +5 -5
- package/src/controller/manage/DeployManageApi.ts +85 -89
- package/src/controller/manage/DocLibManageApi.ts +5 -5
- package/src/controller/manage/DocManageApi.ts +10 -10
- package/src/controller/manage/FileManageApi.ts +1 -1
- package/src/controller/manage/LowCodeTplManageApi.ts +2 -2
- package/src/controller/manage/MenuManageApi.ts +10 -15
- package/src/controller/manage/ProxyApiMangeApi.ts +2 -2
- package/src/controller/manage/SuperAdminManageApi.ts +14 -13
- package/src/controller/manage/SysConfigMangeApi.ts +11 -11
- package/src/controller/manage/SystemInfoManageApi.ts +11 -6
- package/src/controller/manage/UserAccountManageApi.ts +10 -4
- package/src/controller/manage/WorkbenchMangeApi.ts +8 -8
- 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 +32 -23
- package/src/libs/crud-pro/services/CrudProExecuteSqlService.ts +38 -54
- 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 +36 -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/crud-pro/utils/sqlConvert/convertMix.ts +26 -0
- 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 +255 -0
- package/src/service/asyncTask/AsyncTaskService.ts +21 -0
- package/src/service/base/BaseService.ts +2 -2
- package/src/service/crudstd/CrudStdService.ts +60 -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
|
@@ -1,19 +1,46 @@
|
|
|
1
|
-
import {Inject, Provide} from '@midwayjs/core';
|
|
2
|
-
import {Context} from '@midwayjs/koa';
|
|
1
|
+
import { Inject, Provide } from '@midwayjs/core';
|
|
2
|
+
import { Context } from '@midwayjs/koa';
|
|
3
3
|
import * as _ from 'lodash';
|
|
4
|
-
import {CurdProService} from './CurdProService';
|
|
5
|
-
import {ExecuteContext, IExecuteContextHandler} from '../../libs/crud-pro/models/ExecuteContext';
|
|
6
|
-
import {CrudMixUtils, RelatedType} from './CurdMixUtils';
|
|
7
|
-
import {KeysOfSimpleSQL} from '../../libs/crud-pro/models/keys';
|
|
8
|
-
import {ColumnRelation} from '../../libs/crud-pro/interfaces';
|
|
9
|
-
import {BizException} from
|
|
10
|
-
import {Exceptions} from
|
|
11
|
-
import {RedisCacheService} from
|
|
12
|
-
import {parseDatabaseName} from
|
|
4
|
+
import { CurdProService } from './CurdProService';
|
|
5
|
+
import { ExecuteContext, IExecuteContextHandler } from '../../libs/crud-pro/models/ExecuteContext';
|
|
6
|
+
import { CrudMixUtils, RelatedType } from './CurdMixUtils';
|
|
7
|
+
import { KeysOfSimpleSQL } from '../../libs/crud-pro/models/keys';
|
|
8
|
+
import { ColumnRelation } from '../../libs/crud-pro/interfaces';
|
|
9
|
+
import { BizException } from '../../models/devops';
|
|
10
|
+
import { Exceptions } from '../../libs/crud-pro/exceptions';
|
|
11
|
+
import { RedisCacheService } from '../base/RedisCacheService';
|
|
12
|
+
import { parseDatabaseName } from '../../libs/crud-pro/utils/DatabaseName';
|
|
13
|
+
import { GLOBAL_STATIC_CONFIG } from '@/libs/global-config/global-config';
|
|
14
|
+
import { IRequestCfgModel2 } from '@/models/bizmodels';
|
|
13
15
|
|
|
14
16
|
const linkToCustomMixUtils = new CrudMixUtils(RelatedType.linkToCustom);
|
|
15
17
|
const TMP_CTX_KEY = _.uniqueId('CurdMixByLinkToCustomService');
|
|
16
18
|
|
|
19
|
+
function toMapObject(rows: any[], fieldsArr: string[]): Map<string, any> {
|
|
20
|
+
const valueKey = fieldsArr[0];
|
|
21
|
+
const labelKey = fieldsArr[1];
|
|
22
|
+
|
|
23
|
+
const isObjectMode = fieldsArr.length > 2 || labelKey === '*';
|
|
24
|
+
|
|
25
|
+
const map = new Map<string, any>();
|
|
26
|
+
for (let i = 0; i < rows.length; i++) {
|
|
27
|
+
const rowObj = rows[i];
|
|
28
|
+
const value = rowObj[valueKey];
|
|
29
|
+
|
|
30
|
+
if (typeof value !== 'undefined') {
|
|
31
|
+
const valueStr = '' + value;
|
|
32
|
+
if (isObjectMode) {
|
|
33
|
+
map.set(valueStr, rowObj);
|
|
34
|
+
} else {
|
|
35
|
+
const label = rowObj[labelKey];
|
|
36
|
+
if (label) {
|
|
37
|
+
map.set(valueStr, label);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return map;
|
|
43
|
+
}
|
|
17
44
|
|
|
18
45
|
@Provide()
|
|
19
46
|
export class CurdMixByLinkToCustomService implements IExecuteContextHandler {
|
|
@@ -26,7 +53,6 @@ export class CurdMixByLinkToCustomService implements IExecuteContextHandler {
|
|
|
26
53
|
@Inject()
|
|
27
54
|
protected redisCacheService: RedisCacheService;
|
|
28
55
|
|
|
29
|
-
|
|
30
56
|
async handleExecuteContextPrepare(executeContext: ExecuteContext) {
|
|
31
57
|
const relations = linkToCustomMixUtils.pickColumnRelations(executeContext);
|
|
32
58
|
|
|
@@ -37,7 +63,7 @@ export class CurdMixByLinkToCustomService implements IExecuteContextHandler {
|
|
|
37
63
|
}
|
|
38
64
|
|
|
39
65
|
async handleExecuteContext(executeContext: ExecuteContext): Promise<void> {
|
|
40
|
-
const dataInfoMap = executeContext[TMP_CTX_KEY] as Map<string,Map<string,any
|
|
66
|
+
const dataInfoMap = executeContext[TMP_CTX_KEY] as Map<string, Map<string, any>>;
|
|
41
67
|
if (!dataInfoMap || dataInfoMap.size === 0) {
|
|
42
68
|
return;
|
|
43
69
|
}
|
|
@@ -45,19 +71,17 @@ export class CurdMixByLinkToCustomService implements IExecuteContextHandler {
|
|
|
45
71
|
const relatedCode = columnRelation.relatedCode;
|
|
46
72
|
const dataMap = dataInfoMap.get(relatedCode);
|
|
47
73
|
if (dataMap) {
|
|
48
|
-
|
|
49
74
|
const sourceColumn = columnRelation.sourceColumn;
|
|
50
75
|
const targetColumns = columnRelation.targetColumns;
|
|
51
76
|
if (!Array.isArray(targetColumns) || targetColumns.length === 0) {
|
|
52
77
|
columnRelation.targetColumns = [
|
|
53
78
|
{
|
|
54
|
-
|
|
55
|
-
|
|
79
|
+
from: '*',
|
|
80
|
+
to: `${sourceColumn}_info[$ARRAY_INDEX]`,
|
|
56
81
|
},
|
|
57
82
|
];
|
|
58
83
|
}
|
|
59
84
|
|
|
60
|
-
|
|
61
85
|
// this.ctx.logger.info("CurdMixByLinkToCustomService ==> dataMap", dataMap)
|
|
62
86
|
|
|
63
87
|
linkToCustomMixUtils.copyColumnRelationToRowNoRelatedCode(row, dataMap, columnRelation);
|
|
@@ -65,11 +89,10 @@ export class CurdMixByLinkToCustomService implements IExecuteContextHandler {
|
|
|
65
89
|
});
|
|
66
90
|
}
|
|
67
91
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
const cacheKey = "linkToCustom@@"+code;
|
|
92
|
+
public async queryInfoByLinkToCustom(code: string): Promise<Map<string, any>> {
|
|
93
|
+
const cacheKey = 'linkToCustom@@' + code;
|
|
71
94
|
let values;
|
|
72
|
-
const expireSecond = 2 * 60
|
|
95
|
+
const expireSecond = 2 * 60; // 2分钟
|
|
73
96
|
const enumMap = await this.redisCacheService.getJsonObject(cacheKey);
|
|
74
97
|
if (!enumMap || Object.keys(enumMap).length === 0) {
|
|
75
98
|
values = await this.queryInfoByLinkToCustomImpl(code);
|
|
@@ -78,16 +101,21 @@ export class CurdMixByLinkToCustomService implements IExecuteContextHandler {
|
|
|
78
101
|
return values;
|
|
79
102
|
}
|
|
80
103
|
|
|
81
|
-
|
|
82
104
|
/**
|
|
83
105
|
* code形如:mysql_________fatcms~~~sys_perm_role~~~role_code,role_name,xxx_name
|
|
84
106
|
* code形如:fatcms~~~sys_perm_role~~~role_code,role_name,xxx_name
|
|
85
107
|
* code形如:fatcms~~~sys_perm_role~~~id,*
|
|
108
|
+
* code形如:GET_BY_CRUD_METHOD~~~GetActiveLineEnum~~~id,*
|
|
109
|
+
* code形如:GET_BY_CRUD_METHOD~~~GetActiveLineEnum~~~id,name
|
|
86
110
|
* 【数据库】~~~【表名】~~~【value】,【label】,【style】
|
|
87
111
|
* @param code
|
|
88
112
|
* @private
|
|
89
113
|
*/
|
|
90
|
-
private async queryInfoByLinkToCustomImpl(code: string): Promise<Map<string,any>>{
|
|
114
|
+
private async queryInfoByLinkToCustomImpl(code: string): Promise<Map<string, any>> {
|
|
115
|
+
if (code.startsWith('GET_BY_CRUD_METHOD')) {
|
|
116
|
+
return this.queryInfoByLinkToCustomByCrudMethod(code);
|
|
117
|
+
}
|
|
118
|
+
|
|
91
119
|
const arr = code
|
|
92
120
|
.split('~~~')
|
|
93
121
|
.map(s => s.trim())
|
|
@@ -95,9 +123,10 @@ export class CurdMixByLinkToCustomService implements IExecuteContextHandler {
|
|
|
95
123
|
if (arr.length !== 3) {
|
|
96
124
|
throw new BizException('linkToCustom枚举值查询字符串,必须符合固定格式', Exceptions.CFG_ERROR);
|
|
97
125
|
}
|
|
126
|
+
|
|
98
127
|
const [sqlDatabase, sqlTable, fields] = arr;
|
|
99
128
|
|
|
100
|
-
const {dbType, dbName} = parseDatabaseName(sqlDatabase);
|
|
129
|
+
const { dbType, dbName } = parseDatabaseName(sqlDatabase);
|
|
101
130
|
|
|
102
131
|
const fieldsArr = fields
|
|
103
132
|
.split(',')
|
|
@@ -108,15 +137,11 @@ export class CurdMixByLinkToCustomService implements IExecuteContextHandler {
|
|
|
108
137
|
throw new BizException('linkToCustom枚举值查询字符串,fields字段必须符合固定格式', Exceptions.CFG_ERROR);
|
|
109
138
|
}
|
|
110
139
|
|
|
111
|
-
const valueKey = fieldsArr[0];
|
|
112
140
|
const labelKey = fieldsArr[1];
|
|
113
|
-
|
|
114
|
-
const isObjectMode = fieldsArr.length > 2 || labelKey === "*";
|
|
115
|
-
|
|
116
141
|
const res1 = await this.curdProService.executeCrudByCfg(
|
|
117
142
|
{
|
|
118
143
|
condition: {},
|
|
119
|
-
columns: labelKey ===
|
|
144
|
+
columns: labelKey === '*' ? null : fields,
|
|
120
145
|
limit: 4000,
|
|
121
146
|
offset: 0,
|
|
122
147
|
},
|
|
@@ -124,44 +149,70 @@ export class CurdMixByLinkToCustomService implements IExecuteContextHandler {
|
|
|
124
149
|
sqlTable,
|
|
125
150
|
sqlSimpleName: KeysOfSimpleSQL.SIMPLE_QUERY,
|
|
126
151
|
sqlDatabase: dbName,
|
|
127
|
-
|
|
152
|
+
sqlDbType: dbType,
|
|
128
153
|
maxLimit: 4000,
|
|
129
154
|
}
|
|
130
155
|
);
|
|
131
156
|
const rows = res1.getResRows();
|
|
132
|
-
const map =
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
const value = rowObj[valueKey];
|
|
136
|
-
|
|
137
|
-
if (typeof value !== 'undefined') {
|
|
138
|
-
const valueStr = "" +value;
|
|
139
|
-
if (isObjectMode) {
|
|
140
|
-
map.set(valueStr, rowObj);
|
|
141
|
-
} else {
|
|
142
|
-
const label = rowObj[labelKey];
|
|
143
|
-
if (label){
|
|
144
|
-
map.set(valueStr, label);
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
}
|
|
157
|
+
const map = toMapObject(rows, fieldsArr);
|
|
158
|
+
return map;
|
|
159
|
+
}
|
|
148
160
|
|
|
161
|
+
/**
|
|
162
|
+
*
|
|
163
|
+
* @param code
|
|
164
|
+
* code形如:GET_BY_CRUD_METHOD~~~GetActiveLineEnum~~~id,*
|
|
165
|
+
* code形如:GET_BY_CRUD_METHOD~~~GetActiveLineEnum~~~id,name
|
|
166
|
+
*/
|
|
167
|
+
private async queryInfoByLinkToCustomByCrudMethod(code: string): Promise<Map<string, any>> {
|
|
168
|
+
const arr = code
|
|
169
|
+
.split('~~~')
|
|
170
|
+
.map(s => s.trim())
|
|
171
|
+
.filter(Boolean);
|
|
172
|
+
if (arr.length !== 3) {
|
|
173
|
+
throw new BizException('linkToCustom枚举值查询字符串,必须符合固定格式。', Exceptions.CFG_ERROR);
|
|
174
|
+
}
|
|
175
|
+
const [prefix, methodCode, fields] = arr;
|
|
176
|
+
|
|
177
|
+
const fieldsArr = fields
|
|
178
|
+
.split(',')
|
|
179
|
+
.map(s => s.trim())
|
|
180
|
+
.filter(Boolean);
|
|
149
181
|
|
|
182
|
+
if (fieldsArr.length < 2) {
|
|
183
|
+
throw new BizException(`linkToCustom枚举值查询字符串,fields字段必须符合固定格式。${prefix}`, Exceptions.CFG_ERROR);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
const methodInfo = (await this.curdProService.getCachedCfgByMethod(methodCode)) as any;
|
|
187
|
+
if (!methodInfo || methodInfo.status !== 1) {
|
|
188
|
+
throw new Error('接口不存在或已下线: ' + methodCode);
|
|
150
189
|
}
|
|
190
|
+
|
|
191
|
+
const cfgModel = methodInfo as IRequestCfgModel2;
|
|
192
|
+
const { dbType, dbName } = parseDatabaseName(cfgModel.sqlDatabase);
|
|
193
|
+
cfgModel.sqlDatabase = dbName;
|
|
194
|
+
cfgModel.sqlDbType = dbType;
|
|
195
|
+
|
|
196
|
+
const reqJson = {};
|
|
197
|
+
|
|
198
|
+
await GLOBAL_STATIC_CONFIG.getConfig().bizUpdateCfgModelForCrudMtd(reqJson, cfgModel, methodInfo, this.ctx);
|
|
199
|
+
|
|
200
|
+
const exeCtx = await this.curdProService.executeCrudByCfg(reqJson, cfgModel);
|
|
201
|
+
|
|
202
|
+
const rows = exeCtx.getResRows();
|
|
203
|
+
const map = toMapObject(rows, fieldsArr);
|
|
151
204
|
return map;
|
|
152
205
|
}
|
|
153
206
|
|
|
154
|
-
|
|
155
|
-
private async loadInfoByLinkToCustomMap(relations: ColumnRelation[]): Promise<Map<string,Map<string,any>>> {
|
|
207
|
+
private async loadInfoByLinkToCustomMap(relations: ColumnRelation[]): Promise<Map<string, Map<string, any>>> {
|
|
156
208
|
const bigMap = new Map<string, Map<string, any>>();
|
|
157
209
|
for (let i = 0; i < relations.length; i++) {
|
|
158
210
|
const relation = relations[i];
|
|
159
|
-
const code = relation.relatedCode ||
|
|
211
|
+
const code = relation.relatedCode || '';
|
|
160
212
|
const codeTrim = code.trim();
|
|
161
213
|
const map = await this.queryInfoByLinkToCustom(codeTrim);
|
|
162
214
|
bigMap.set(codeTrim, map);
|
|
163
215
|
}
|
|
164
216
|
return bigMap;
|
|
165
217
|
}
|
|
166
|
-
|
|
167
218
|
}
|
|
@@ -4,11 +4,12 @@ import { CurdProService } from './CurdProService';
|
|
|
4
4
|
import { ExecuteContext, IExecuteContextHandler } from '../../libs/crud-pro/models/ExecuteContext';
|
|
5
5
|
import { CrudMixUtils, RelatedType } from './CurdMixUtils';
|
|
6
6
|
import * as _ from 'lodash';
|
|
7
|
-
import {
|
|
7
|
+
import { SystemTables} from '../../models/SystemTables';
|
|
8
8
|
import { KeysOfSimpleSQL } from '../../libs/crud-pro/models/keys';
|
|
9
9
|
import { MultiKeyMap } from '../../libs/crud-pro/utils/MultiKeyMap';
|
|
10
10
|
import { ColumnRelation } from '../../libs/crud-pro/interfaces';
|
|
11
11
|
import { parseConfigContentToEnumInfo } from "../../libs/utils/parseConfig";
|
|
12
|
+
import { GLOBAL_STATIC_CONFIG } from '@/libs/global-config/global-config';
|
|
12
13
|
|
|
13
14
|
const dictMixUtils = new CrudMixUtils(RelatedType.sysCfgEnum);
|
|
14
15
|
|
|
@@ -25,6 +26,10 @@ export class CurdMixBySysConfigService implements IExecuteContextHandler {
|
|
|
25
26
|
protected curdProService: CurdProService;
|
|
26
27
|
|
|
27
28
|
async handleExecuteContextPrepare(executeContext: ExecuteContext) {
|
|
29
|
+
|
|
30
|
+
const { SystemDbName, SystemDbType } = GLOBAL_STATIC_CONFIG.getConfig();
|
|
31
|
+
|
|
32
|
+
|
|
28
33
|
const codes = dictMixUtils.pickColumnRelationCodes(executeContext);
|
|
29
34
|
if (!codes || codes.length === 0) {
|
|
30
35
|
return;
|
|
@@ -38,7 +43,7 @@ export class CurdMixBySysConfigService implements IExecuteContextHandler {
|
|
|
38
43
|
sqlTable: SystemTables.sys_configs,
|
|
39
44
|
sqlSimpleName: KeysOfSimpleSQL.SIMPLE_QUERY,
|
|
40
45
|
sqlDatabase: SystemDbName,
|
|
41
|
-
|
|
46
|
+
sqlDbType: SystemDbType,
|
|
42
47
|
}
|
|
43
48
|
);
|
|
44
49
|
const rows = res1.getResRows();
|
|
@@ -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 };
|