midway-fatcms 0.0.1-beta.55 → 0.0.1-beta.56
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 +14 -14
- package/.prettierrc.js +4 -4
- package/README.md +8 -8
- package/dist/config/config.default.d.ts +3 -3
- package/dist/config/config.default.js +160 -160
- package/dist/config/utils.d.ts +1 -1
- package/dist/config/utils.js +23 -23
- package/dist/configuration.d.ts +7 -7
- package/dist/configuration.js +113 -113
- package/dist/controller/base/BaseApiController.d.ts +37 -37
- package/dist/controller/base/BaseApiController.js +164 -164
- package/dist/controller/gateway/AnyApiGatewayController.d.ts +13 -13
- package/dist/controller/gateway/AnyApiGatewayController.js +55 -55
- package/dist/controller/gateway/AsyncTaskController.d.ts +20 -20
- package/dist/controller/gateway/AsyncTaskController.js +181 -181
- package/dist/controller/gateway/CrudMtdGatewayController.d.ts +21 -21
- package/dist/controller/gateway/CrudMtdGatewayController.js +122 -119
- package/dist/controller/gateway/CrudStdGatewayController.d.ts +38 -38
- package/dist/controller/gateway/CrudStdGatewayController.js +129 -129
- package/dist/controller/gateway/DocGatewayController.d.ts +27 -27
- package/dist/controller/gateway/DocGatewayController.js +179 -179
- package/dist/controller/gateway/FileController.d.ts +26 -26
- package/dist/controller/gateway/FileController.js +129 -129
- package/dist/controller/gateway/ProxyApiGatewayController.d.ts +18 -18
- package/dist/controller/gateway/ProxyApiGatewayController.js +78 -78
- package/dist/controller/gateway/PublicApiController.d.ts +27 -27
- package/dist/controller/gateway/PublicApiController.js +162 -162
- package/dist/controller/gateway/StaticController.d.ts +23 -23
- package/dist/controller/gateway/StaticController.js +286 -286
- package/dist/controller/helpers.controller.d.ts +39 -39
- package/dist/controller/helpers.controller.js +188 -188
- package/dist/controller/home.controller.d.ts +9 -9
- package/dist/controller/home.controller.js +72 -72
- package/dist/controller/manage/AnyApiMangeApi.d.ts +10 -10
- package/dist/controller/manage/AnyApiMangeApi.js +98 -98
- package/dist/controller/manage/AppLogMangeApi.d.ts +10 -10
- package/dist/controller/manage/AppLogMangeApi.js +88 -88
- package/dist/controller/manage/AppMangeApi.d.ts +10 -10
- package/dist/controller/manage/AppMangeApi.js +88 -88
- package/dist/controller/manage/AppPageMangeApi.d.ts +10 -10
- package/dist/controller/manage/AppPageMangeApi.js +87 -87
- package/dist/controller/manage/AppSchemaHistoryApi.d.ts +10 -10
- package/dist/controller/manage/AppSchemaHistoryApi.js +83 -83
- package/dist/controller/manage/CrudMethodsMangeApi.d.ts +10 -10
- package/dist/controller/manage/CrudMethodsMangeApi.js +84 -84
- package/dist/controller/manage/CrudStandardDesignApi.d.ts +46 -46
- package/dist/controller/manage/CrudStandardDesignApi.js +395 -395
- package/dist/controller/manage/DataDictManageApi.d.ts +15 -15
- package/dist/controller/manage/DataDictManageApi.js +133 -133
- package/dist/controller/manage/DeployManageApi.d.ts +19 -19
- package/dist/controller/manage/DeployManageApi.js +180 -180
- package/dist/controller/manage/DocLibManageApi.d.ts +10 -10
- package/dist/controller/manage/DocLibManageApi.js +104 -104
- package/dist/controller/manage/DocManageApi.d.ts +11 -11
- package/dist/controller/manage/DocManageApi.js +130 -130
- package/dist/controller/manage/FileManageApi.d.ts +13 -13
- package/dist/controller/manage/FileManageApi.js +77 -77
- package/dist/controller/manage/LowCodeTplManageApi.d.ts +13 -13
- package/dist/controller/manage/LowCodeTplManageApi.js +86 -86
- package/dist/controller/manage/MenuManageApi.d.ts +10 -10
- package/dist/controller/manage/MenuManageApi.js +93 -93
- package/dist/controller/manage/ProxyApiMangeApi.d.ts +10 -10
- package/dist/controller/manage/ProxyApiMangeApi.js +87 -87
- package/dist/controller/manage/SuperAdminManageApi.d.ts +24 -24
- package/dist/controller/manage/SuperAdminManageApi.js +153 -153
- package/dist/controller/manage/SysConfigMangeApi.d.ts +11 -11
- package/dist/controller/manage/SysConfigMangeApi.js +126 -126
- package/dist/controller/manage/SystemInfoManageApi.d.ts +12 -12
- package/dist/controller/manage/SystemInfoManageApi.js +72 -72
- package/dist/controller/manage/UserAccountManageApi.d.ts +14 -14
- package/dist/controller/manage/UserAccountManageApi.js +129 -129
- package/dist/controller/manage/WorkbenchMangeApi.d.ts +11 -11
- package/dist/controller/manage/WorkbenchMangeApi.js +103 -103
- package/dist/controller/myinfo/AuthController.d.ts +33 -33
- package/dist/controller/myinfo/AuthController.js +136 -136
- package/dist/controller/myinfo/MyInfoController.d.ts +13 -13
- package/dist/controller/myinfo/MyInfoController.js +51 -51
- package/dist/controller/render/AppRenderController.d.ts +11 -11
- package/dist/controller/render/AppRenderController.js +92 -92
- package/dist/controller/test.controller.d.ts +8 -8
- package/dist/controller/test.controller.js +51 -51
- package/dist/filter/default.filter.d.ts +7 -7
- package/dist/filter/default.filter.js +23 -23
- package/dist/filter/notfound.filter.d.ts +5 -5
- package/dist/filter/notfound.filter.js +20 -20
- package/dist/index.d.ts +103 -103
- package/dist/index.js +121 -121
- package/dist/interface.d.ts +27 -27
- package/dist/interface.js +3 -3
- package/dist/libs/crud-pro/CrudPro.d.ts +37 -37
- package/dist/libs/crud-pro/CrudPro.js +136 -136
- package/dist/libs/crud-pro/defaultConfigs.d.ts +4 -4
- package/dist/libs/crud-pro/defaultConfigs.js +15 -15
- package/dist/libs/crud-pro/exceptions.d.ts +104 -104
- package/dist/libs/crud-pro/exceptions.js +117 -117
- package/dist/libs/crud-pro/interfaces.d.ts +163 -163
- package/dist/libs/crud-pro/interfaces.js +12 -12
- package/dist/libs/crud-pro/models/ExecuteContext.d.ts +49 -49
- package/dist/libs/crud-pro/models/ExecuteContext.js +79 -79
- package/dist/libs/crud-pro/models/ExecuteContextFunc.d.ts +38 -38
- package/dist/libs/crud-pro/models/ExecuteContextFunc.js +72 -72
- package/dist/libs/crud-pro/models/FuncContext.d.ts +18 -18
- package/dist/libs/crud-pro/models/FuncContext.js +6 -6
- package/dist/libs/crud-pro/models/RequestCfgModel.d.ts +65 -65
- package/dist/libs/crud-pro/models/RequestCfgModel.js +81 -81
- package/dist/libs/crud-pro/models/RequestModel.d.ts +25 -25
- package/dist/libs/crud-pro/models/RequestModel.js +113 -113
- package/dist/libs/crud-pro/models/ResModel.d.ts +16 -16
- package/dist/libs/crud-pro/models/ResModel.js +2 -2
- package/dist/libs/crud-pro/models/ServiceHub.d.ts +20 -20
- package/dist/libs/crud-pro/models/ServiceHub.js +2 -2
- package/dist/libs/crud-pro/models/SqlCfgModel.d.ts +22 -22
- package/dist/libs/crud-pro/models/SqlCfgModel.js +40 -40
- package/dist/libs/crud-pro/models/SqlSegArg.d.ts +6 -6
- package/dist/libs/crud-pro/models/SqlSegArg.js +12 -12
- package/dist/libs/crud-pro/models/Transaction.d.ts +30 -30
- package/dist/libs/crud-pro/models/Transaction.js +74 -74
- package/dist/libs/crud-pro/models/TransactionMySQL.d.ts +28 -28
- package/dist/libs/crud-pro/models/TransactionMySQL.js +76 -76
- package/dist/libs/crud-pro/models/TransactionPostgres.d.ts +28 -28
- package/dist/libs/crud-pro/models/TransactionPostgres.js +85 -85
- package/dist/libs/crud-pro/models/TransactionSqlServer.d.ts +34 -34
- package/dist/libs/crud-pro/models/TransactionSqlServer.js +92 -92
- package/dist/libs/crud-pro/models/keys.d.ts +106 -106
- package/dist/libs/crud-pro/models/keys.js +149 -149
- package/dist/libs/crud-pro/services/CrudProCachedCfgService.d.ts +11 -11
- package/dist/libs/crud-pro/services/CrudProCachedCfgService.js +73 -73
- package/dist/libs/crud-pro/services/CrudProExecuteFuncService.d.ts +9 -9
- package/dist/libs/crud-pro/services/CrudProExecuteFuncService.js +112 -112
- package/dist/libs/crud-pro/services/CrudProExecuteSqlService.d.ts +17 -17
- package/dist/libs/crud-pro/services/CrudProExecuteSqlService.js +225 -225
- package/dist/libs/crud-pro/services/CrudProFieldUpdateService.d.ts +9 -9
- package/dist/libs/crud-pro/services/CrudProFieldUpdateService.js +51 -51
- package/dist/libs/crud-pro/services/CrudProFieldValidateService.d.ts +13 -13
- package/dist/libs/crud-pro/services/CrudProFieldValidateService.js +148 -148
- package/dist/libs/crud-pro/services/CrudProGenSqlCondition.d.ts +24 -24
- package/dist/libs/crud-pro/services/CrudProGenSqlCondition.js +340 -340
- package/dist/libs/crud-pro/services/CrudProGenSqlService.d.ts +25 -25
- package/dist/libs/crud-pro/services/CrudProGenSqlService.js +165 -165
- package/dist/libs/crud-pro/services/CrudProOriginToExecuteSql.d.ts +32 -32
- package/dist/libs/crud-pro/services/CrudProOriginToExecuteSql.js +334 -334
- package/dist/libs/crud-pro/services/CrudProServiceBase.d.ts +24 -24
- package/dist/libs/crud-pro/services/CrudProServiceBase.js +90 -90
- package/dist/libs/crud-pro/services/CrudProTableMetaService.d.ts +9 -9
- package/dist/libs/crud-pro/services/CrudProTableMetaService.js +72 -72
- package/dist/libs/crud-pro/services/CurdProServiceHub.d.ts +32 -32
- package/dist/libs/crud-pro/services/CurdProServiceHub.js +64 -64
- package/dist/libs/crud-pro/utils/CompareUtils.d.ts +9 -9
- package/dist/libs/crud-pro/utils/CompareUtils.js +25 -25
- package/dist/libs/crud-pro/utils/DatabaseName.d.ts +9 -9
- package/dist/libs/crud-pro/utils/DatabaseName.js +50 -50
- package/dist/libs/crud-pro/utils/DateTimeUtils.d.ts +7 -7
- package/dist/libs/crud-pro/utils/DateTimeUtils.js +21 -21
- package/dist/libs/crud-pro/utils/MemoryRefreshCache.d.ts +19 -19
- package/dist/libs/crud-pro/utils/MemoryRefreshCache.js +47 -47
- package/dist/libs/crud-pro/utils/MessageParseUtils.d.ts +5 -5
- package/dist/libs/crud-pro/utils/MessageParseUtils.js +33 -33
- package/dist/libs/crud-pro/utils/MixinUtils.d.ts +39 -39
- package/dist/libs/crud-pro/utils/MixinUtils.js +255 -255
- package/dist/libs/crud-pro/utils/ModelUtils.d.ts +11 -11
- package/dist/libs/crud-pro/utils/ModelUtils.js +49 -49
- package/dist/libs/crud-pro/utils/MultiKeyMap.d.ts +11 -11
- package/dist/libs/crud-pro/utils/MultiKeyMap.js +63 -63
- package/dist/libs/crud-pro/utils/SqlFuncUtils.d.ts +5 -5
- package/dist/libs/crud-pro/utils/SqlFuncUtils.js +29 -29
- package/dist/libs/crud-pro/utils/TypeUtils.d.ts +40 -40
- package/dist/libs/crud-pro/utils/TypeUtils.js +166 -166
- package/dist/libs/crud-pro/utils/ValidateUtils.d.ts +3 -3
- package/dist/libs/crud-pro/utils/ValidateUtils.js +165 -165
- package/dist/libs/crud-pro/utils/pool/MySQLUtils.d.ts +3 -3
- package/dist/libs/crud-pro/utils/pool/MySQLUtils.js +19 -19
- package/dist/libs/crud-pro/utils/pool/PostgresUtils.d.ts +3 -3
- package/dist/libs/crud-pro/utils/pool/PostgresUtils.js +20 -20
- package/dist/libs/crud-pro/utils/pool/SqlServerUtils.d.ts +3 -3
- package/dist/libs/crud-pro/utils/pool/SqlServerUtils.js +20 -20
- package/dist/libs/crud-pro/utils/sqlConvert/convertColumnName.d.ts +4 -4
- package/dist/libs/crud-pro/utils/sqlConvert/convertColumnName.js +21 -21
- package/dist/libs/crud-pro/utils/sqlConvert/convertMix.d.ts +3 -3
- package/dist/libs/crud-pro/utils/sqlConvert/convertMix.js +22 -22
- package/dist/libs/crud-pro/utils/sqlConvert/convertMsSql.d.ts +2 -2
- package/dist/libs/crud-pro/utils/sqlConvert/convertMsSql.js +11 -11
- package/dist/libs/crud-pro/utils/sqlConvert/convertPgSql.d.ts +2 -2
- package/dist/libs/crud-pro/utils/sqlConvert/convertPgSql.js +11 -11
- package/dist/libs/crud-pro/utils/sqlConvert/convertPgType.d.ts +2 -2
- package/dist/libs/crud-pro/utils/sqlConvert/convertPgType.js +128 -128
- package/dist/libs/global-config/global-config.d.ts +69 -60
- package/dist/libs/global-config/global-config.js +36 -35
- package/dist/libs/utils/base64.d.ts +9 -9
- package/dist/libs/utils/base64.js +42 -42
- package/dist/libs/utils/common-dto.d.ts +18 -18
- package/dist/libs/utils/common-dto.js +40 -40
- package/dist/libs/utils/crypto-utils.d.ts +3 -3
- package/dist/libs/utils/crypto-utils.js +46 -46
- package/dist/libs/utils/errorToString.d.ts +2 -2
- package/dist/libs/utils/errorToString.js +57 -57
- package/dist/libs/utils/fatcms-request.d.ts +30 -30
- package/dist/libs/utils/fatcms-request.js +104 -104
- package/dist/libs/utils/functions.d.ts +5 -5
- package/dist/libs/utils/functions.js +72 -72
- package/dist/libs/utils/ordernum-utils.d.ts +2 -2
- package/dist/libs/utils/ordernum-utils.js +13 -13
- package/dist/libs/utils/parseConfig.d.ts +7 -7
- package/dist/libs/utils/parseConfig.js +44 -44
- package/dist/libs/utils/parseCreateSql.d.ts +10 -10
- package/dist/libs/utils/parseCreateSql.js +87 -87
- package/dist/libs/utils/render-utils.d.ts +28 -28
- package/dist/libs/utils/render-utils.js +135 -135
- package/dist/middleware/forbidden.middleware.d.ts +10 -10
- package/dist/middleware/forbidden.middleware.js +54 -54
- package/dist/middleware/global.middleware.d.ts +10 -10
- package/dist/middleware/global.middleware.js +266 -266
- package/dist/middleware/permission.middleware.d.ts +18 -18
- package/dist/middleware/permission.middleware.js +74 -74
- package/dist/middleware/rediscache.middleware.d.ts +3 -3
- package/dist/middleware/rediscache.middleware.js +77 -77
- package/dist/middleware/redislock.middleware.d.ts +7 -7
- package/dist/middleware/redislock.middleware.js +72 -72
- package/dist/middleware/tx.middleware.d.ts +9 -9
- package/dist/middleware/tx.middleware.js +40 -40
- package/dist/models/AsyncTaskModel.d.ts +74 -74
- package/dist/models/AsyncTaskModel.js +31 -31
- package/dist/models/RedisKeys.d.ts +15 -15
- package/dist/models/RedisKeys.js +18 -18
- package/dist/models/SystemEntities.d.ts +105 -105
- package/dist/models/SystemEntities.js +9 -9
- package/dist/models/SystemPerm.d.ts +95 -95
- package/dist/models/SystemPerm.js +100 -100
- package/dist/models/SystemTables.d.ts +25 -25
- package/dist/models/SystemTables.js +28 -28
- package/dist/models/bizmodels.d.ts +99 -99
- package/dist/models/bizmodels.js +39 -39
- package/dist/models/contextLogger.d.ts +25 -25
- package/dist/models/contextLogger.js +112 -112
- package/dist/models/devops.d.ts +12 -12
- package/dist/models/devops.js +19 -19
- package/dist/models/userSession.d.ts +62 -62
- package/dist/models/userSession.js +165 -165
- package/dist/schedule/anonymousContext.d.ts +14 -14
- package/dist/schedule/anonymousContext.js +59 -59
- package/dist/schedule/index.d.ts +4 -4
- package/dist/schedule/index.js +10 -10
- package/dist/schedule/runSchedule.d.ts +12 -12
- package/dist/schedule/runSchedule.js +68 -68
- package/dist/schedule/scheduleNames.d.ts +13 -13
- package/dist/schedule/scheduleNames.js +17 -17
- package/dist/service/AuthService.d.ts +71 -71
- package/dist/service/AuthService.js +259 -259
- package/dist/service/EnumInfoService.d.ts +30 -30
- package/dist/service/EnumInfoService.js +127 -127
- package/dist/service/FileCenterService.d.ts +43 -43
- package/dist/service/FileCenterService.js +351 -351
- package/dist/service/SysConfigService.d.ts +7 -7
- package/dist/service/SysConfigService.js +47 -47
- package/dist/service/UserAccountService.d.ts +23 -23
- package/dist/service/UserAccountService.js +107 -107
- package/dist/service/UserSessionService.d.ts +38 -38
- package/dist/service/UserSessionService.js +157 -157
- package/dist/service/VisitStatService.d.ts +14 -14
- package/dist/service/VisitStatService.js +158 -158
- package/dist/service/WorkbenchService.d.ts +53 -53
- package/dist/service/WorkbenchService.js +211 -211
- package/dist/service/anyapi/AnyApiSandboxService.d.ts +15 -15
- package/dist/service/anyapi/AnyApiSandboxService.js +110 -110
- package/dist/service/anyapi/AnyApiService.d.ts +27 -27
- package/dist/service/anyapi/AnyApiService.js +181 -181
- package/dist/service/asyncTask/AsyncTaskRunnerService.d.ts +50 -50
- package/dist/service/asyncTask/AsyncTaskRunnerService.js +287 -287
- package/dist/service/asyncTask/AsyncTaskService.d.ts +7 -7
- package/dist/service/asyncTask/AsyncTaskService.js +34 -34
- package/dist/service/asyncTask/handler/ExcelInfoModel.d.ts +10 -10
- package/dist/service/asyncTask/handler/ExcelInfoModel.js +2 -2
- package/dist/service/asyncTask/handler/ExportExcelAsyncTaskHandler.d.ts +7 -7
- package/dist/service/asyncTask/handler/ExportExcelAsyncTaskHandler.js +216 -216
- package/dist/service/asyncTask/handler/ExportExcelByInnerHttpHandler.d.ts +36 -36
- package/dist/service/asyncTask/handler/ExportExcelByInnerHttpHandler.js +141 -141
- package/dist/service/asyncTask/handler/ExportExcelByStdCrudHandler.d.ts +46 -46
- package/dist/service/asyncTask/handler/ExportExcelByStdCrudHandler.js +135 -135
- package/dist/service/base/ApiBaseService.d.ts +15 -15
- package/dist/service/base/ApiBaseService.js +50 -50
- package/dist/service/base/ApiRateLimiter.d.ts +10 -10
- package/dist/service/base/ApiRateLimiter.js +51 -51
- package/dist/service/base/BaseService.d.ts +41 -41
- package/dist/service/base/BaseService.js +101 -101
- package/dist/service/base/RedisCacheService.d.ts +20 -20
- package/dist/service/base/RedisCacheService.js +57 -57
- package/dist/service/crudstd/CrudStdActionService.d.ts +17 -17
- package/dist/service/crudstd/CrudStdActionService.js +32 -32
- package/dist/service/crudstd/CrudStdConstant.d.ts +58 -58
- package/dist/service/crudstd/CrudStdConstant.js +64 -64
- package/dist/service/crudstd/CrudStdRelationService.d.ts +10 -10
- package/dist/service/crudstd/CrudStdRelationService.js +112 -112
- package/dist/service/crudstd/CrudStdService.d.ts +68 -68
- package/dist/service/crudstd/CrudStdService.js +347 -347
- package/dist/service/curd/CrudProQuick.d.ts +44 -44
- package/dist/service/curd/CrudProQuick.js +147 -147
- package/dist/service/curd/CurdMixByAccountService.d.ts +9 -9
- package/dist/service/curd/CurdMixByAccountService.js +92 -92
- package/dist/service/curd/CurdMixByDictService.d.ts +13 -13
- package/dist/service/curd/CurdMixByDictService.js +114 -114
- package/dist/service/curd/CurdMixByLinkToCustomService.d.ts +31 -31
- package/dist/service/curd/CurdMixByLinkToCustomService.js +203 -203
- package/dist/service/curd/CurdMixBySysConfigService.d.ts +9 -9
- package/dist/service/curd/CurdMixBySysConfigService.js +80 -80
- package/dist/service/curd/CurdMixByWorkbenchService.d.ts +10 -10
- package/dist/service/curd/CurdMixByWorkbenchService.js +78 -78
- package/dist/service/curd/CurdMixService.d.ts +28 -28
- package/dist/service/curd/CurdMixService.js +100 -100
- package/dist/service/curd/CurdMixUtils.d.ts +51 -51
- package/dist/service/curd/CurdMixUtils.js +277 -277
- package/dist/service/curd/CurdProService.d.ts +32 -32
- package/dist/service/curd/CurdProService.js +212 -212
- package/dist/service/curd/fixCfgModel.d.ts +3 -3
- package/dist/service/curd/fixCfgModel.js +104 -104
- package/dist/service/proxyapi/ProxyApiLoadService.d.ts +21 -21
- package/dist/service/proxyapi/ProxyApiLoadService.js +167 -167
- package/dist/service/proxyapi/ProxyApiService.d.ts +61 -61
- package/dist/service/proxyapi/ProxyApiService.js +294 -294
- package/dist/service/proxyapi/ProxyApiUtils.d.ts +15 -15
- package/dist/service/proxyapi/ProxyApiUtils.js +34 -34
- package/dist/service/proxyapi/RouteHandler.d.ts +5 -5
- package/dist/service/proxyapi/RouteHandler.js +9 -9
- package/dist/service/proxyapi/RouteTrie.d.ts +12 -12
- package/dist/service/proxyapi/RouteTrie.js +63 -63
- package/dist/service/proxyapi/WeightedRandom.d.ts +9 -9
- package/dist/service/proxyapi/WeightedRandom.js +31 -31
- package/dist/service/proxyapi/WeightedRoundRobin.d.ts +8 -8
- package/dist/service/proxyapi/WeightedRoundRobin.js +32 -32
- package/index.d.ts +10 -10
- package/package.json +87 -81
- package/src/config/config.default.ts +179 -0
- package/src/config/seed/aeskey.txt +1 -0
- package/src/config/utils.ts +22 -0
- package/src/configuration.ts +109 -0
- package/src/controller/base/BaseApiController.ts +170 -0
- package/src/controller/gateway/AnyApiGatewayController.ts +1 -0
- package/src/controller/gateway/AsyncTaskController.ts +157 -0
- package/src/controller/gateway/CrudMtdGatewayController.ts +116 -0
- package/src/controller/gateway/CrudStdGatewayController.ts +87 -0
- package/src/controller/gateway/DocGatewayController.ts +173 -0
- package/src/controller/gateway/FileController.ts +109 -0
- package/src/controller/gateway/ProxyApiGatewayController.ts +47 -0
- package/src/controller/gateway/PublicApiController.ts +140 -0
- package/src/controller/gateway/StaticController.ts +296 -0
- package/src/controller/helpers.controller.ts +161 -0
- package/src/controller/home.controller.ts +66 -0
- package/src/controller/manage/AnyApiMangeApi.ts +66 -0
- package/src/controller/manage/AppLogMangeApi.ts +53 -0
- package/src/controller/manage/AppMangeApi.ts +53 -0
- package/src/controller/manage/AppPageMangeApi.ts +52 -0
- package/src/controller/manage/AppSchemaHistoryApi.ts +49 -0
- package/src/controller/manage/CrudMethodsMangeApi.ts +49 -0
- package/src/controller/manage/CrudStandardDesignApi.ts +406 -0
- package/src/controller/manage/DataDictManageApi.ts +78 -0
- package/src/controller/manage/DeployManageApi.ts +175 -0
- package/src/controller/manage/DocLibManageApi.ts +69 -0
- package/src/controller/manage/DocManageApi.ts +99 -0
- package/src/controller/manage/FileManageApi.ts +45 -0
- package/src/controller/manage/LowCodeTplManageApi.ts +52 -0
- package/src/controller/manage/MenuManageApi.ts +58 -0
- package/src/controller/manage/ProxyApiMangeApi.ts +52 -0
- package/src/controller/manage/SuperAdminManageApi.ts +139 -0
- package/src/controller/manage/SysConfigMangeApi.ts +95 -0
- package/src/controller/manage/SystemInfoManageApi.ts +53 -0
- package/src/controller/manage/UserAccountManageApi.ts +94 -0
- package/src/controller/manage/WorkbenchMangeApi.ts +72 -0
- package/src/controller/myinfo/AuthController.ts +108 -0
- package/src/controller/myinfo/MyInfoController.ts +32 -0
- package/src/controller/render/AppRenderController.ts +81 -0
- package/src/controller/test.controller.ts +37 -0
- package/src/filter/default.filter.ts +13 -0
- package/src/filter/notfound.filter.ts +10 -0
- package/src/index.ts +107 -0
- package/src/interface.ts +31 -0
- package/src/libs/crud-pro/CrudPro.ts +165 -0
- package/src/libs/crud-pro/defaultConfigs.ts +15 -0
- package/src/libs/crud-pro/exceptions.ts +124 -0
- package/src/libs/crud-pro/interfaces.ts +190 -0
- package/src/libs/crud-pro/models/ExecuteContext.ts +120 -0
- package/src/libs/crud-pro/models/ExecuteContextFunc.ts +96 -0
- package/src/libs/crud-pro/models/FuncContext.ts +21 -0
- package/src/libs/crud-pro/models/RequestCfgModel.ts +141 -0
- package/src/libs/crud-pro/models/RequestModel.ts +141 -0
- package/src/libs/crud-pro/models/ResModel.ts +19 -0
- package/src/libs/crud-pro/models/ServiceHub.ts +32 -0
- package/src/libs/crud-pro/models/SqlCfgModel.ts +52 -0
- package/src/libs/crud-pro/models/SqlSegArg.ts +13 -0
- package/src/libs/crud-pro/models/Transaction.ts +83 -0
- package/src/libs/crud-pro/models/TransactionMySQL.ts +79 -0
- package/src/libs/crud-pro/models/TransactionPostgres.ts +91 -0
- package/src/libs/crud-pro/models/TransactionSqlServer.ts +102 -0
- package/src/libs/crud-pro/models/keys.ts +159 -0
- package/src/libs/crud-pro/services/CrudProCachedCfgService.ts +83 -0
- package/src/libs/crud-pro/services/CrudProExecuteFuncService.ts +128 -0
- package/src/libs/crud-pro/services/CrudProExecuteSqlService.ts +262 -0
- package/src/libs/crud-pro/services/CrudProFieldUpdateService.ts +60 -0
- package/src/libs/crud-pro/services/CrudProFieldValidateService.ts +180 -0
- package/src/libs/crud-pro/services/CrudProGenSqlCondition.ts +354 -0
- package/src/libs/crud-pro/services/CrudProGenSqlService.ts +185 -0
- package/src/libs/crud-pro/services/CrudProOriginToExecuteSql.ts +393 -0
- package/src/libs/crud-pro/services/CrudProServiceBase.ts +107 -0
- package/src/libs/crud-pro/services/CrudProTableMetaService.ts +86 -0
- package/src/libs/crud-pro/services/CurdProServiceHub.ts +92 -0
- package/src/libs/crud-pro/sql.txt +120 -0
- package/src/libs/crud-pro/utils/CompareUtils.ts +23 -0
- package/src/libs/crud-pro/utils/DatabaseName.ts +60 -0
- package/src/libs/crud-pro/utils/DateTimeUtils.ts +20 -0
- package/src/libs/crud-pro/utils/MemoryRefreshCache.ts +64 -0
- package/src/libs/crud-pro/utils/MessageParseUtils.ts +33 -0
- package/src/libs/crud-pro/utils/MixinUtils.ts +285 -0
- package/src/libs/crud-pro/utils/ModelUtils.ts +55 -0
- package/src/libs/crud-pro/utils/MultiKeyMap.ts +72 -0
- package/src/libs/crud-pro/utils/SqlFuncUtils.ts +29 -0
- package/src/libs/crud-pro/utils/TypeUtils.ts +188 -0
- package/src/libs/crud-pro/utils/ValidateUtils.ts +165 -0
- package/src/libs/crud-pro/utils/pool/MySQLUtils.ts +20 -0
- package/src/libs/crud-pro/utils/pool/PostgresUtils.ts +22 -0
- package/src/libs/crud-pro/utils/pool/SqlServerUtils.ts +22 -0
- package/src/libs/crud-pro/utils/sqlConvert/convertColumnName.ts +26 -0
- package/src/libs/crud-pro/utils/sqlConvert/convertMix.ts +26 -0
- package/src/libs/crud-pro/utils/sqlConvert/convertMsSql.ts +11 -0
- package/src/libs/crud-pro/utils/sqlConvert/convertPgSql.ts +11 -0
- package/src/libs/crud-pro/utils/sqlConvert/convertPgType.ts +129 -0
- package/src/libs/global-config/global-config.ts +109 -0
- package/src/libs/utils/base64.ts +47 -0
- package/src/libs/utils/common-dto.ts +52 -0
- package/src/libs/utils/crypto-utils.ts +50 -0
- package/src/libs/utils/errorToString.ts +61 -0
- package/src/libs/utils/fatcms-request.ts +103 -0
- package/src/libs/utils/functions.ts +78 -0
- package/src/libs/utils/ordernum-utils.ts +14 -0
- package/src/libs/utils/parseConfig.ts +54 -0
- package/src/libs/utils/parseCreateSql.ts +91 -0
- package/src/libs/utils/render-utils.ts +184 -0
- package/src/middleware/forbidden.middleware.ts +52 -0
- package/src/middleware/global.middleware.ts +293 -0
- package/src/middleware/permission.middleware.ts +80 -0
- package/src/middleware/rediscache.middleware.ts +91 -0
- package/src/middleware/redislock.middleware.ts +83 -0
- package/src/middleware/tx.middleware.ts +30 -0
- package/src/models/AsyncTaskModel.ts +85 -0
- package/src/models/RedisKeys.ts +16 -0
- package/src/models/SystemEntities.ts +125 -0
- package/src/models/SystemPerm.ts +105 -0
- package/src/models/SystemTables.ts +27 -0
- package/src/models/bizmodels.ts +123 -0
- package/src/models/contextLogger.ts +132 -0
- package/src/models/devops.ts +17 -0
- package/src/models/userSession.ts +217 -0
- package/src/schedule/anonymousContext.ts +73 -0
- package/src/schedule/index.ts +12 -0
- package/src/schedule/runSchedule.ts +82 -0
- package/src/schedule/scheduleNames.ts +21 -0
- package/src/service/AuthService.ts +284 -0
- package/src/service/EnumInfoService.ts +130 -0
- package/src/service/FileCenterService.ts +395 -0
- package/src/service/SysConfigService.ts +37 -0
- package/src/service/UserAccountService.ts +107 -0
- package/src/service/UserSessionService.ts +161 -0
- package/src/service/VisitStatService.ts +166 -0
- package/src/service/WorkbenchService.ts +220 -0
- package/src/service/anyapi/AnyApiSandboxService.ts +121 -0
- package/src/service/anyapi/AnyApiService.ts +186 -0
- package/src/service/asyncTask/AsyncTaskRunnerService.ts +325 -0
- package/src/service/asyncTask/AsyncTaskService.ts +21 -0
- package/src/service/asyncTask/handler/ExcelInfoModel.ts +11 -0
- package/src/service/asyncTask/handler/ExportExcelAsyncTaskHandler.ts +245 -0
- package/src/service/asyncTask/handler/ExportExcelByInnerHttpHandler.ts +159 -0
- package/src/service/asyncTask/handler/ExportExcelByStdCrudHandler.ts +159 -0
- package/src/service/base/ApiBaseService.ts +42 -0
- package/src/service/base/ApiRateLimiter.ts +59 -0
- package/src/service/base/BaseService.ts +100 -0
- package/src/service/base/RedisCacheService.ts +45 -0
- package/src/service/crudstd/CrudStdActionService.ts +27 -0
- package/src/service/crudstd/CrudStdConstant.ts +62 -0
- package/src/service/crudstd/CrudStdRelationService.ts +118 -0
- package/src/service/crudstd/CrudStdService.ts +420 -0
- package/src/service/curd/CrudProQuick.ts +172 -0
- package/src/service/curd/CurdMixByAccountService.ts +89 -0
- package/src/service/curd/CurdMixByDictService.ts +114 -0
- package/src/service/curd/CurdMixByLinkToCustomService.ts +219 -0
- package/src/service/curd/CurdMixBySysConfigService.ts +78 -0
- package/src/service/curd/CurdMixByWorkbenchService.ts +71 -0
- package/src/service/curd/CurdMixService.ts +97 -0
- package/src/service/curd/CurdMixUtils.ts +316 -0
- package/src/service/curd/CurdProService.ts +231 -0
- package/src/service/curd/fixCfgModel.ts +120 -0
- package/src/service/proxyapi/ProxyApiLoadService.ts +174 -0
- package/src/service/proxyapi/ProxyApiService.ts +298 -0
- package/src/service/proxyapi/ProxyApiUtils.ts +32 -0
- package/src/service/proxyapi/RouteHandler.ts +8 -0
- package/src/service/proxyapi/RouteTrie.ts +74 -0
- package/src/service/proxyapi/WeightedRandom.ts +37 -0
- package/src/service/proxyapi/WeightedRoundRobin.ts +44 -0
- 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 -32
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { KeysOfSimpleSQL, SqlDbType } from '@/libs/crud-pro/models/keys';
|
|
2
|
+
import { IRequestCfgModel, IRequestModel, ISqlCfgModel } from '@/libs/crud-pro/interfaces';
|
|
3
|
+
import { IRequestCfgModel2 } from '@/models/bizmodels';
|
|
4
|
+
import { CrudPro } from '@/libs/crud-pro/CrudPro';
|
|
5
|
+
import { ResModelAffected, ResModelStandard } from '@/libs/crud-pro/models/ResModel';
|
|
6
|
+
|
|
7
|
+
const DEFAULT_MAX_LIMIT = 10 * 10000;
|
|
8
|
+
|
|
9
|
+
export class CrudProQuick {
|
|
10
|
+
private readonly curdPro: CrudPro;
|
|
11
|
+
private readonly sqlDbType: SqlDbType;
|
|
12
|
+
private readonly sqlDatabase: string;
|
|
13
|
+
private readonly sqlTable?: string;
|
|
14
|
+
private baseCfgModel: IRequestCfgModel2 = {
|
|
15
|
+
maxLimit: DEFAULT_MAX_LIMIT,
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
constructor(curdPro: CrudPro, sqlDatabase: string, sqlDbType: SqlDbType, sqlTable?: string) {
|
|
19
|
+
this.sqlDatabase = sqlDatabase;
|
|
20
|
+
this.sqlDbType = sqlDbType;
|
|
21
|
+
this.curdPro = curdPro;
|
|
22
|
+
this.sqlTable = sqlTable; // 全局sqlTable为空时,单独调用时就必须传sqlTable参数。
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
public setBaseCfgModel(baseCfgModel: IRequestCfgModel2) {
|
|
26
|
+
Object.assign(this.baseCfgModel, baseCfgModel);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
private async executeCrudByCfg(reqJson: IRequestModel, cfgModel2: IRequestCfgModel2) {
|
|
30
|
+
const cfgModel = { ...this.baseCfgModel };
|
|
31
|
+
Object.assign(cfgModel, cfgModel2);
|
|
32
|
+
|
|
33
|
+
cfgModel.method = 'CrudProQuickAnonymous';
|
|
34
|
+
cfgModel.updateCfg = {};
|
|
35
|
+
cfgModel.sqlDatabase = this.sqlDatabase;
|
|
36
|
+
cfgModel.sqlDbType = this.sqlDbType;
|
|
37
|
+
|
|
38
|
+
if (!cfgModel.sqlTable) {
|
|
39
|
+
cfgModel.sqlTable = this.sqlTable;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
if (!cfgModel.sqlTable) {
|
|
43
|
+
throw new Error('[CrudProQuick] sqlTable not found');
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return await this.curdPro.executeCrudByCfg(reqJson, cfgModel);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* 随便获取一个。不推荐使用。建议使用getUniqueOne。
|
|
51
|
+
* @deprecated
|
|
52
|
+
* @param reqJson
|
|
53
|
+
* @param sqlTable
|
|
54
|
+
* @returns
|
|
55
|
+
*/
|
|
56
|
+
public async getOne(reqJson: IRequestModel, sqlTable?: string): Promise<any> {
|
|
57
|
+
const cfgModel: IRequestCfgModel = {
|
|
58
|
+
sqlTable,
|
|
59
|
+
sqlSimpleName: KeysOfSimpleSQL.SIMPLE_QUERY_ONE,
|
|
60
|
+
};
|
|
61
|
+
const res = await this.executeCrudByCfg(reqJson, cfgModel);
|
|
62
|
+
return res.getOneObj();
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* 期望获取唯一的一个对象,如果数据库中的数量不唯一,则报错。
|
|
68
|
+
* @param reqJson
|
|
69
|
+
* @param sqlTable
|
|
70
|
+
* @returns
|
|
71
|
+
*/
|
|
72
|
+
public async getUniqueOne(reqJson: IRequestModel, sqlTable?: string): Promise<any> {
|
|
73
|
+
const cfgModel: IRequestCfgModel = {
|
|
74
|
+
sqlTable,
|
|
75
|
+
sqlSimpleName: KeysOfSimpleSQL.SIMPLE_QUERY_PAGE,
|
|
76
|
+
};
|
|
77
|
+
reqJson.pageNo = 1;
|
|
78
|
+
reqJson.pageSize = 1;
|
|
79
|
+
const res = await this.executeCrudByCfg(reqJson, cfgModel);
|
|
80
|
+
const resModel = res.getResModel();
|
|
81
|
+
const total_count = resModel.total_count;
|
|
82
|
+
const rows = resModel.rows;
|
|
83
|
+
if(total_count === 0) {
|
|
84
|
+
return null;
|
|
85
|
+
}
|
|
86
|
+
if(total_count > 1) {
|
|
87
|
+
throw new Error(`[CrudProQuick][getUniqueOne] only one object is required, but got ${total_count}`)
|
|
88
|
+
}
|
|
89
|
+
return rows[0];
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* 获取数据列表
|
|
95
|
+
* @param reqJson
|
|
96
|
+
* @param sqlTable 数据库表名称
|
|
97
|
+
* @returns
|
|
98
|
+
*/
|
|
99
|
+
public async getList(reqJson: IRequestModel, sqlTable?: string): Promise<any[]> {
|
|
100
|
+
const cfgModel: IRequestCfgModel = {
|
|
101
|
+
sqlTable,
|
|
102
|
+
sqlSimpleName: KeysOfSimpleSQL.SIMPLE_QUERY,
|
|
103
|
+
};
|
|
104
|
+
const res = await this.executeCrudByCfg(reqJson, cfgModel);
|
|
105
|
+
return res.getResRows();
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
public async getListPage(reqJson: IRequestModel, sqlTable?: string): Promise<ResModelStandard> {
|
|
109
|
+
const cfgModel: IRequestCfgModel = {
|
|
110
|
+
sqlTable,
|
|
111
|
+
sqlSimpleName: KeysOfSimpleSQL.SIMPLE_QUERY_PAGE,
|
|
112
|
+
};
|
|
113
|
+
const res = await this.executeCrudByCfg(reqJson, cfgModel);
|
|
114
|
+
return res.getResModel(); // 因为它有2个返回值
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
public async getTotalCount(reqJson: IRequestModel, sqlTable?: string): Promise<number> {
|
|
118
|
+
const cfgModel: IRequestCfgModel = {
|
|
119
|
+
sqlTable,
|
|
120
|
+
sqlSimpleName: KeysOfSimpleSQL.SIMPLE_QUERY_COUNT,
|
|
121
|
+
};
|
|
122
|
+
const res = await this.executeCrudByCfg(reqJson, cfgModel);
|
|
123
|
+
return res.getResModel().total_count;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
public async insertObject(reqJson: IRequestModel, sqlTable?: string): Promise<ResModelAffected> {
|
|
127
|
+
const cfgModel: IRequestCfgModel = {
|
|
128
|
+
sqlTable,
|
|
129
|
+
sqlSimpleName: KeysOfSimpleSQL.SIMPLE_INSERT,
|
|
130
|
+
};
|
|
131
|
+
const res = await this.executeCrudByCfg(reqJson, cfgModel);
|
|
132
|
+
return res.getResModel().affected;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
public async updateObject(reqJson: IRequestModel, sqlTable?: string): Promise<ResModelAffected> {
|
|
136
|
+
const cfgModel: IRequestCfgModel = {
|
|
137
|
+
sqlTable,
|
|
138
|
+
sqlSimpleName: KeysOfSimpleSQL.SIMPLE_UPDATE,
|
|
139
|
+
};
|
|
140
|
+
const res = await this.executeCrudByCfg(reqJson, cfgModel);
|
|
141
|
+
return res.getResModel().affected;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
public async insertOrUpdate(reqJson: IRequestModel, sqlTable?: string): Promise<ResModelStandard> {
|
|
145
|
+
const cfgModel: IRequestCfgModel = {
|
|
146
|
+
sqlTable,
|
|
147
|
+
sqlSimpleName: KeysOfSimpleSQL.SIMPLE_INSERT_OR_UPDATE,
|
|
148
|
+
};
|
|
149
|
+
const res = await this.executeCrudByCfg(reqJson, cfgModel);
|
|
150
|
+
return res.getResModel(); // 因为它有三个返回值
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
public async deleteObject(reqJson: IRequestModel, sqlTable?: string): Promise<ResModelAffected> {
|
|
154
|
+
const cfgModel: IRequestCfgModel = {
|
|
155
|
+
sqlTable,
|
|
156
|
+
sqlSimpleName: KeysOfSimpleSQL.SIMPLE_DELETE,
|
|
157
|
+
};
|
|
158
|
+
const res = await this.executeCrudByCfg(reqJson, cfgModel);
|
|
159
|
+
return res.getResModel().affected;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
public async executeSQL(executeSql: string, args?: any[]): Promise<any> {
|
|
163
|
+
const sqlCfgModel: ISqlCfgModel = {
|
|
164
|
+
executeSql: executeSql,
|
|
165
|
+
executeSqlArgs: args,
|
|
166
|
+
sqlDatabase: this.sqlDatabase,
|
|
167
|
+
sqlDbType: this.sqlDbType,
|
|
168
|
+
maxLimit: this.baseCfgModel.maxLimit || DEFAULT_MAX_LIMIT,
|
|
169
|
+
};
|
|
170
|
+
return await this.curdPro.executeSQL(sqlCfgModel);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { Inject, Provide } from '@midwayjs/core';
|
|
2
|
+
import { Context } from '@midwayjs/koa';
|
|
3
|
+
import * as _ from 'lodash';
|
|
4
|
+
import { CurdProService } from './CurdProService';
|
|
5
|
+
import { HandleExecuteContextType, IExecuteContextHandler } from '@/libs/crud-pro/models/ExecuteContext';
|
|
6
|
+
import { CrudMixUtils, RelatedType } from './CurdMixUtils';
|
|
7
|
+
import { SystemTables } from '@/models/SystemTables';
|
|
8
|
+
import { KeysOfSimpleSQL } from '@/libs/crud-pro/models/keys';
|
|
9
|
+
import { ColumnRelation, IRequestCfgModel, IRequestModel } from '@/libs/crud-pro/interfaces';
|
|
10
|
+
import { MixinUtils } from '@/libs/crud-pro/utils/MixinUtils';
|
|
11
|
+
import { GLOBAL_STATIC_CONFIG } from '@/libs/global-config/global-config';
|
|
12
|
+
|
|
13
|
+
const dictMixUtils = new CrudMixUtils(RelatedType.accountBasic);
|
|
14
|
+
|
|
15
|
+
const TMP_CTX_KEY = _.uniqueId('CurdMixByAccountService');
|
|
16
|
+
|
|
17
|
+
@Provide()
|
|
18
|
+
export class CurdMixByAccountService implements IExecuteContextHandler {
|
|
19
|
+
@Inject()
|
|
20
|
+
protected ctx: Context;
|
|
21
|
+
|
|
22
|
+
@Inject()
|
|
23
|
+
protected curdProService: CurdProService;
|
|
24
|
+
|
|
25
|
+
async handleExecuteContextPrepare(executeContext: HandleExecuteContextType) {
|
|
26
|
+
const { SystemDbName, SystemDbType, toFatcmsUserAccountId } = GLOBAL_STATIC_CONFIG.getConfig();
|
|
27
|
+
|
|
28
|
+
const relations = dictMixUtils.pickColumnRelations(executeContext);
|
|
29
|
+
if (!relations || relations.length === 0) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const accountIds = new Set<string>();
|
|
34
|
+
dictMixUtils.forEachRowAndColumnsRelation(executeContext, (row: any, columnRelation: ColumnRelation) => {
|
|
35
|
+
const { sourceColumn } = columnRelation;
|
|
36
|
+
if (sourceColumn) {
|
|
37
|
+
const accountId = _.get(row, sourceColumn);
|
|
38
|
+
if (accountId) {
|
|
39
|
+
const fatcmsUserAccountId = toFatcmsUserAccountId(accountId);
|
|
40
|
+
accountIds.add(fatcmsUserAccountId);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
if (accountIds.size === 0) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const cfgModel: IRequestCfgModel = {
|
|
50
|
+
method: 'UserAccountService.queryAccountBasicInfoByIds',
|
|
51
|
+
sqlTable: SystemTables.sys_user_account,
|
|
52
|
+
sqlSimpleName: KeysOfSimpleSQL.SIMPLE_QUERY,
|
|
53
|
+
sqlDatabase: SystemDbName,
|
|
54
|
+
sqlDbType: SystemDbType,
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
const reqJson: IRequestModel = {
|
|
58
|
+
columns: ['nick_name', 'avatar', 'account_id'],
|
|
59
|
+
condition: {
|
|
60
|
+
account_id: {
|
|
61
|
+
$in: [...accountIds],
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
const res = await this.curdProService.executeCrudByCfg(reqJson, cfgModel);
|
|
67
|
+
const userInfos = res.getResRows();
|
|
68
|
+
executeContext[TMP_CTX_KEY] = MixinUtils.toNewMap(userInfos, (obj: any) => obj.account_id);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
async handleExecuteContext(executeContext: HandleExecuteContextType): Promise<void> {
|
|
72
|
+
const userInfoMap = executeContext[TMP_CTX_KEY] as Map<string, any>;
|
|
73
|
+
if (!userInfoMap || userInfoMap.size === 0) {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
dictMixUtils.forEachRowAndColumnsRelation(executeContext, (row: any, columnRelation: ColumnRelation) => {
|
|
78
|
+
const sourceColumn = columnRelation.sourceColumn;
|
|
79
|
+
const targetColumns = columnRelation.targetColumns;
|
|
80
|
+
if (!Array.isArray(targetColumns) || targetColumns.length === 0) {
|
|
81
|
+
columnRelation.targetColumns = [
|
|
82
|
+
{ from: 'nick_name', to: `${sourceColumn}_user.nick_name` },
|
|
83
|
+
{ from: 'avatar', to: `${sourceColumn}_user.avatar` },
|
|
84
|
+
];
|
|
85
|
+
}
|
|
86
|
+
dictMixUtils.copyUserInfoToRowNoRelatedCode(row, userInfoMap, columnRelation);
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import * as _ from 'lodash';
|
|
2
|
+
import { Inject, Provide } from '@midwayjs/core';
|
|
3
|
+
import { Context } from '@midwayjs/koa';
|
|
4
|
+
import { CurdProService } from './CurdProService';
|
|
5
|
+
import { HandleExecuteContextType, IExecuteContextHandler } from '@/libs/crud-pro/models/ExecuteContext';
|
|
6
|
+
import { CrudMixUtils, RelatedType } from './CurdMixUtils';
|
|
7
|
+
import { SystemTables } from '@/models/SystemTables';
|
|
8
|
+
import { KeysOfSimpleSQL } from '@/libs/crud-pro/models/keys';
|
|
9
|
+
import { MultiKeyMap } from '@/libs/crud-pro/utils/MultiKeyMap';
|
|
10
|
+
import { ColumnRelation } from '@/libs/crud-pro/interfaces';
|
|
11
|
+
import { RedisCacheService } from '../base/RedisCacheService';
|
|
12
|
+
import { GLOBAL_STATIC_CONFIG } from '@/libs/global-config/global-config';
|
|
13
|
+
import { RedisKeys } from '@/models/RedisKeys';
|
|
14
|
+
|
|
15
|
+
const TMP_CTX_KEY = _.uniqueId('CurdMixByDictService');
|
|
16
|
+
|
|
17
|
+
const dictMixUtils = new CrudMixUtils(RelatedType.dict);
|
|
18
|
+
|
|
19
|
+
@Provide()
|
|
20
|
+
export class CurdMixByDictService implements IExecuteContextHandler {
|
|
21
|
+
@Inject()
|
|
22
|
+
ctx: Context;
|
|
23
|
+
|
|
24
|
+
@Inject()
|
|
25
|
+
private curdProService: CurdProService;
|
|
26
|
+
|
|
27
|
+
@Inject()
|
|
28
|
+
protected redisCacheService: RedisCacheService;
|
|
29
|
+
|
|
30
|
+
private async getFromCache(code: string): Promise<any> {
|
|
31
|
+
const cacheKey = `${RedisKeys.CURD_MIX_BY_DICT_PREFIX}${code}`;
|
|
32
|
+
return this.redisCacheService.getJsonObject(cacheKey);
|
|
33
|
+
}
|
|
34
|
+
private async setToCache(code: string, value: any): Promise<any> {
|
|
35
|
+
const cacheKey = `${RedisKeys.CURD_MIX_BY_DICT_PREFIX}${code}`;
|
|
36
|
+
return this.redisCacheService.setJsonObject(cacheKey, value, 60 * 60);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
async handleExecuteContextPrepare(executeContext: HandleExecuteContextType): Promise<void> {
|
|
40
|
+
const codes = dictMixUtils.pickColumnRelationCodes(executeContext);
|
|
41
|
+
if (!codes || codes.length === 0) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
const rows = await this.getDictItemRows(codes);
|
|
45
|
+
executeContext[TMP_CTX_KEY] = new MultiKeyMap(rows, 'dict_code', 'value');
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
private async getDictItemRows(codes: string[]) {
|
|
49
|
+
const { SystemDbName, SystemDbType } = GLOBAL_STATIC_CONFIG.getConfig();
|
|
50
|
+
const noCacheCodes: string[] = [];
|
|
51
|
+
|
|
52
|
+
// 从缓存里面取
|
|
53
|
+
let cachedRows = [];
|
|
54
|
+
for (let i = 0; i < codes.length; i++) {
|
|
55
|
+
const code = codes[i];
|
|
56
|
+
const rows1: any[] = await this.getFromCache(code);
|
|
57
|
+
// const rows1 = [];
|
|
58
|
+
if (rows1 && rows1.length > 0) {
|
|
59
|
+
cachedRows = cachedRows.concat(rows1);
|
|
60
|
+
} else {
|
|
61
|
+
noCacheCodes.push(code);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// 从数据库里面取
|
|
66
|
+
let selectedRows = [];
|
|
67
|
+
if (noCacheCodes.length > 0) {
|
|
68
|
+
const res1 = await this.curdProService.executeCrudByCfg(
|
|
69
|
+
{
|
|
70
|
+
condition: { dict_code: { $in: noCacheCodes } },
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
sqlTable: SystemTables.sys_data_dict_item,
|
|
74
|
+
sqlSimpleName: KeysOfSimpleSQL.SIMPLE_QUERY,
|
|
75
|
+
sqlDatabase: SystemDbName,
|
|
76
|
+
sqlDbType: SystemDbType,
|
|
77
|
+
}
|
|
78
|
+
);
|
|
79
|
+
selectedRows = res1.getResRows();
|
|
80
|
+
|
|
81
|
+
//放到缓存里
|
|
82
|
+
for (let i = 0; i < noCacheCodes.length; i++) {
|
|
83
|
+
const noCacheCode = noCacheCodes[i];
|
|
84
|
+
const rows1 = selectedRows.filter(e => e.dict_code === noCacheCode);
|
|
85
|
+
await this.setToCache(noCacheCode, rows1);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
return cachedRows.concat(selectedRows);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
async handleExecuteContext(executeContext: HandleExecuteContextType): Promise<void> {
|
|
93
|
+
const multiKeyMap = executeContext[TMP_CTX_KEY] as MultiKeyMap;
|
|
94
|
+
if (!multiKeyMap || multiKeyMap.isEmpty()) {
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
dictMixUtils.forEachRowAndColumnsRelation(executeContext, (row: any, columnRelation: ColumnRelation) => {
|
|
99
|
+
const sourceColumn = columnRelation.sourceColumn;
|
|
100
|
+
const targetColumns = columnRelation.targetColumns;
|
|
101
|
+
|
|
102
|
+
if (!Array.isArray(targetColumns) || targetColumns.length === 0) {
|
|
103
|
+
columnRelation.targetColumns = [
|
|
104
|
+
{
|
|
105
|
+
from: '*',
|
|
106
|
+
to: `${sourceColumn}_info[$ARRAY_INDEX]`,
|
|
107
|
+
},
|
|
108
|
+
];
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
dictMixUtils.copyColumnRelationToRow(row, multiKeyMap, columnRelation);
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
}
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
import { Inject, Provide } from '@midwayjs/core';
|
|
2
|
+
import { Context } from '@midwayjs/koa';
|
|
3
|
+
import * as _ from 'lodash';
|
|
4
|
+
import { CurdProService } from './CurdProService';
|
|
5
|
+
import { HandleExecuteContextType, 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';
|
|
15
|
+
import { RedisKeys } from '@/models/RedisKeys';
|
|
16
|
+
|
|
17
|
+
const linkToCustomMixUtils = new CrudMixUtils(RelatedType.linkToCustom);
|
|
18
|
+
const TMP_CTX_KEY = _.uniqueId('CurdMixByLinkToCustomService');
|
|
19
|
+
|
|
20
|
+
function toMapObject(rows: any[], fieldsArr: string[]): Map<string, any> {
|
|
21
|
+
const valueKey = fieldsArr[0];
|
|
22
|
+
const labelKey = fieldsArr[1];
|
|
23
|
+
|
|
24
|
+
const isObjectMode = fieldsArr.length > 2 || labelKey === '*';
|
|
25
|
+
|
|
26
|
+
const map = new Map<string, any>();
|
|
27
|
+
for (let i = 0; i < rows.length; i++) {
|
|
28
|
+
const rowObj = rows[i];
|
|
29
|
+
const value = rowObj[valueKey];
|
|
30
|
+
|
|
31
|
+
if (typeof value !== 'undefined') {
|
|
32
|
+
const valueStr = '' + value;
|
|
33
|
+
if (isObjectMode) {
|
|
34
|
+
map.set(valueStr, rowObj);
|
|
35
|
+
} else {
|
|
36
|
+
const label = rowObj[labelKey];
|
|
37
|
+
if (label) {
|
|
38
|
+
map.set(valueStr, label);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return map;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
@Provide()
|
|
47
|
+
export class CurdMixByLinkToCustomService implements IExecuteContextHandler {
|
|
48
|
+
@Inject()
|
|
49
|
+
protected ctx: Context;
|
|
50
|
+
|
|
51
|
+
@Inject()
|
|
52
|
+
protected curdProService: CurdProService;
|
|
53
|
+
|
|
54
|
+
@Inject()
|
|
55
|
+
protected redisCacheService: RedisCacheService;
|
|
56
|
+
|
|
57
|
+
async handleExecuteContextPrepare(executeContext: HandleExecuteContextType) {
|
|
58
|
+
const relations = linkToCustomMixUtils.pickColumnRelations(executeContext);
|
|
59
|
+
|
|
60
|
+
if (!relations || relations.length === 0) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
executeContext[TMP_CTX_KEY] = await this.loadInfoByLinkToCustomMap(relations);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
async handleExecuteContext(executeContext: HandleExecuteContextType): Promise<void> {
|
|
67
|
+
const dataInfoMap = executeContext[TMP_CTX_KEY] as Map<string, Map<string, any>>;
|
|
68
|
+
if (!dataInfoMap || dataInfoMap.size === 0) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
linkToCustomMixUtils.forEachRowAndColumnsRelation(executeContext, (row: any, columnRelation: ColumnRelation) => {
|
|
72
|
+
const relatedCode = columnRelation.relatedCode;
|
|
73
|
+
const dataMap = dataInfoMap.get(relatedCode);
|
|
74
|
+
if (dataMap) {
|
|
75
|
+
const sourceColumn = columnRelation.sourceColumn;
|
|
76
|
+
const targetColumns = columnRelation.targetColumns;
|
|
77
|
+
if (!Array.isArray(targetColumns) || targetColumns.length === 0) {
|
|
78
|
+
columnRelation.targetColumns = [
|
|
79
|
+
{
|
|
80
|
+
from: '*',
|
|
81
|
+
to: `${sourceColumn}_info[$ARRAY_INDEX]`,
|
|
82
|
+
},
|
|
83
|
+
];
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// this.ctx.logger.info("CurdMixByLinkToCustomService ==> dataMap", dataMap)
|
|
87
|
+
|
|
88
|
+
linkToCustomMixUtils.copyColumnRelationToRowNoRelatedCode(row, dataMap, columnRelation);
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
public async queryInfoByLinkToCustom(code: string): Promise<Map<string, any>> {
|
|
94
|
+
const cacheKey = RedisKeys.LINK_TO_CUSTOM_PREFIX + code;
|
|
95
|
+
let values;
|
|
96
|
+
const expireSecond = 2 * 60; // 2分钟
|
|
97
|
+
const enumMap = await this.redisCacheService.getJsonObject(cacheKey);
|
|
98
|
+
if (!enumMap || Object.keys(enumMap).length === 0) {
|
|
99
|
+
values = await this.queryInfoByLinkToCustomImpl(code);
|
|
100
|
+
await this.redisCacheService.setJsonObject(cacheKey, values, expireSecond);
|
|
101
|
+
}
|
|
102
|
+
return values;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* code形如:mysql_________fatcms~~~sys_perm_role~~~role_code,role_name,xxx_name
|
|
107
|
+
* code形如:fatcms~~~sys_perm_role~~~role_code,role_name,xxx_name
|
|
108
|
+
* code形如:fatcms~~~sys_perm_role~~~id,*
|
|
109
|
+
* code形如:GET_BY_CRUD_METHOD~~~GetActiveLineEnum~~~id,*
|
|
110
|
+
* code形如:GET_BY_CRUD_METHOD~~~GetActiveLineEnum~~~id,name
|
|
111
|
+
* 【数据库】~~~【表名】~~~【value】,【label】,【style】
|
|
112
|
+
* @param code
|
|
113
|
+
* @private
|
|
114
|
+
*/
|
|
115
|
+
private async queryInfoByLinkToCustomImpl(code: string): Promise<Map<string, any>> {
|
|
116
|
+
if (code.startsWith('GET_BY_CRUD_METHOD')) {
|
|
117
|
+
return this.queryInfoByLinkToCustomByCrudMethod(code);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
const arr = code
|
|
121
|
+
.split('~~~')
|
|
122
|
+
.map(s => s.trim())
|
|
123
|
+
.filter(Boolean);
|
|
124
|
+
if (arr.length !== 3) {
|
|
125
|
+
throw new BizException('linkToCustom枚举值查询字符串,必须符合固定格式', Exceptions.CFG_ERROR);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
const [sqlDatabase, sqlTable, fields] = arr;
|
|
129
|
+
|
|
130
|
+
const { dbType, dbName } = parseDatabaseName(sqlDatabase);
|
|
131
|
+
|
|
132
|
+
const fieldsArr = fields
|
|
133
|
+
.split(',')
|
|
134
|
+
.map(s => s.trim())
|
|
135
|
+
.filter(Boolean);
|
|
136
|
+
|
|
137
|
+
if (fieldsArr.length < 2) {
|
|
138
|
+
throw new BizException('linkToCustom枚举值查询字符串,fields字段必须符合固定格式', Exceptions.CFG_ERROR);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
const labelKey = fieldsArr[1];
|
|
142
|
+
const res1 = await this.curdProService.executeCrudByCfg(
|
|
143
|
+
{
|
|
144
|
+
condition: {},
|
|
145
|
+
columns: labelKey === '*' ? null : fields,
|
|
146
|
+
limit: 4000,
|
|
147
|
+
offset: 0,
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
sqlTable,
|
|
151
|
+
sqlSimpleName: KeysOfSimpleSQL.SIMPLE_QUERY,
|
|
152
|
+
sqlDatabase: dbName,
|
|
153
|
+
sqlDbType: dbType,
|
|
154
|
+
maxLimit: 4000,
|
|
155
|
+
}
|
|
156
|
+
);
|
|
157
|
+
const rows = res1.getResRows();
|
|
158
|
+
const map = toMapObject(rows, fieldsArr);
|
|
159
|
+
return map;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
*
|
|
164
|
+
* @param code
|
|
165
|
+
* code形如:GET_BY_CRUD_METHOD~~~GetActiveLineEnum~~~id,*
|
|
166
|
+
* code形如:GET_BY_CRUD_METHOD~~~GetActiveLineEnum~~~id,name
|
|
167
|
+
*/
|
|
168
|
+
private async queryInfoByLinkToCustomByCrudMethod(code: string): Promise<Map<string, any>> {
|
|
169
|
+
const arr = code
|
|
170
|
+
.split('~~~')
|
|
171
|
+
.map(s => s.trim())
|
|
172
|
+
.filter(Boolean);
|
|
173
|
+
if (arr.length !== 3) {
|
|
174
|
+
throw new BizException('linkToCustom枚举值查询字符串,必须符合固定格式。', Exceptions.CFG_ERROR);
|
|
175
|
+
}
|
|
176
|
+
const [prefix, methodCode, fields] = arr;
|
|
177
|
+
|
|
178
|
+
const fieldsArr = fields
|
|
179
|
+
.split(',')
|
|
180
|
+
.map(s => s.trim())
|
|
181
|
+
.filter(Boolean);
|
|
182
|
+
|
|
183
|
+
if (fieldsArr.length < 2) {
|
|
184
|
+
throw new BizException(`linkToCustom枚举值查询字符串,fields字段必须符合固定格式。${prefix}`, Exceptions.CFG_ERROR);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
const methodInfo = (await this.curdProService.getCachedCfgByMethod(methodCode)) as any;
|
|
188
|
+
if (!methodInfo || methodInfo.status !== 1) {
|
|
189
|
+
throw new Error('接口不存在或已下线: ' + methodCode);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
const cfgModel = methodInfo as IRequestCfgModel2;
|
|
193
|
+
const { dbType, dbName } = parseDatabaseName(cfgModel.sqlDatabase);
|
|
194
|
+
cfgModel.sqlDatabase = dbName;
|
|
195
|
+
cfgModel.sqlDbType = dbType;
|
|
196
|
+
|
|
197
|
+
const reqJson = {};
|
|
198
|
+
|
|
199
|
+
await GLOBAL_STATIC_CONFIG.getConfig().bizUpdateCfgModelForCrudMtd(reqJson, cfgModel, methodInfo, this.ctx);
|
|
200
|
+
|
|
201
|
+
const exeCtx = await this.curdProService.executeCrudByCfg(reqJson, cfgModel);
|
|
202
|
+
|
|
203
|
+
const rows = exeCtx.getResRows();
|
|
204
|
+
const map = toMapObject(rows, fieldsArr);
|
|
205
|
+
return map;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
private async loadInfoByLinkToCustomMap(relations: ColumnRelation[]): Promise<Map<string, Map<string, any>>> {
|
|
209
|
+
const bigMap = new Map<string, Map<string, any>>();
|
|
210
|
+
for (let i = 0; i < relations.length; i++) {
|
|
211
|
+
const relation = relations[i];
|
|
212
|
+
const code = relation.relatedCode || '';
|
|
213
|
+
const codeTrim = code.trim();
|
|
214
|
+
const map = await this.queryInfoByLinkToCustom(codeTrim);
|
|
215
|
+
bigMap.set(codeTrim, map);
|
|
216
|
+
}
|
|
217
|
+
return bigMap;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { Inject, Provide } from '@midwayjs/core';
|
|
2
|
+
import { Context } from '@midwayjs/koa';
|
|
3
|
+
import { CurdProService } from './CurdProService';
|
|
4
|
+
import { HandleExecuteContextType, IExecuteContextHandler } from '@/libs/crud-pro/models/ExecuteContext';
|
|
5
|
+
import { CrudMixUtils, RelatedType } from './CurdMixUtils';
|
|
6
|
+
import * as _ from 'lodash';
|
|
7
|
+
import { SystemTables } from '@/models/SystemTables';
|
|
8
|
+
import { KeysOfSimpleSQL } from '@/libs/crud-pro/models/keys';
|
|
9
|
+
import { MultiKeyMap } from '@/libs/crud-pro/utils/MultiKeyMap';
|
|
10
|
+
import { ColumnRelation } from '@/libs/crud-pro/interfaces';
|
|
11
|
+
import { parseConfigContentToEnumInfo } from '@/libs/utils/parseConfig';
|
|
12
|
+
import { GLOBAL_STATIC_CONFIG } from '@/libs/global-config/global-config';
|
|
13
|
+
|
|
14
|
+
const dictMixUtils = new CrudMixUtils(RelatedType.sysCfgEnum);
|
|
15
|
+
|
|
16
|
+
const TMP_CTX_KEY = _.uniqueId('CurdMixBySysConfigService');
|
|
17
|
+
|
|
18
|
+
@Provide()
|
|
19
|
+
export class CurdMixBySysConfigService implements IExecuteContextHandler {
|
|
20
|
+
@Inject()
|
|
21
|
+
ctx: Context;
|
|
22
|
+
|
|
23
|
+
@Inject()
|
|
24
|
+
protected curdProService: CurdProService;
|
|
25
|
+
|
|
26
|
+
async handleExecuteContextPrepare(executeContext: HandleExecuteContextType) {
|
|
27
|
+
const { SystemDbName, SystemDbType } = GLOBAL_STATIC_CONFIG.getConfig();
|
|
28
|
+
|
|
29
|
+
const codes = dictMixUtils.pickColumnRelationCodes(executeContext);
|
|
30
|
+
if (!codes || codes.length === 0) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const res1 = await this.curdProService.executeCrudByCfg(
|
|
35
|
+
{
|
|
36
|
+
condition: { config_code: { $in: codes } },
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
sqlTable: SystemTables.sys_configs,
|
|
40
|
+
sqlSimpleName: KeysOfSimpleSQL.SIMPLE_QUERY,
|
|
41
|
+
sqlDatabase: SystemDbName,
|
|
42
|
+
sqlDbType: SystemDbType,
|
|
43
|
+
}
|
|
44
|
+
);
|
|
45
|
+
const rows = res1.getResRows();
|
|
46
|
+
const multiKeyMap = new MultiKeyMap();
|
|
47
|
+
|
|
48
|
+
if (Array.isArray(rows)) {
|
|
49
|
+
for (let i = 0; i < rows.length; i++) {
|
|
50
|
+
const row = rows[i];
|
|
51
|
+
const { config_code } = row;
|
|
52
|
+
const config_content_rows = parseConfigContentToEnumInfo(row); // 数组元素必须有value字段
|
|
53
|
+
multiKeyMap.addRowsValue1(config_content_rows, config_code, 'value');
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
executeContext[TMP_CTX_KEY] = multiKeyMap;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
async handleExecuteContext(executeContext: HandleExecuteContextType): Promise<void> {
|
|
61
|
+
const multiKeyMap = executeContext[TMP_CTX_KEY] as MultiKeyMap;
|
|
62
|
+
if (!multiKeyMap || multiKeyMap.isEmpty()) {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
dictMixUtils.forEachRowAndColumnsRelation(executeContext, (row: any, columnRelation: ColumnRelation) => {
|
|
67
|
+
const sourceColumn = columnRelation.sourceColumn;
|
|
68
|
+
const targetColumns = columnRelation.targetColumns;
|
|
69
|
+
if (!Array.isArray(targetColumns) || targetColumns.length === 0) {
|
|
70
|
+
columnRelation.targetColumns = [
|
|
71
|
+
{ from: 'label', to: `${sourceColumn}_info.label` },
|
|
72
|
+
{ from: 'style', to: `${sourceColumn}_info.style` },
|
|
73
|
+
];
|
|
74
|
+
}
|
|
75
|
+
dictMixUtils.copyColumnRelationToRow(row, multiKeyMap, columnRelation);
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
}
|