midway-fatcms 0.0.1-beta.22 → 0.0.1-beta.24
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 -12
- 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 +187 -185
- package/dist/config/seed/aeskey.txt +1 -1
- 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 -114
- package/dist/controller/base/BaseApiController.d.ts +37 -31
- package/dist/controller/base/BaseApiController.js +164 -146
- 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 -14
- package/dist/controller/gateway/AsyncTaskController.js +181 -108
- package/dist/controller/gateway/CrudMtdGatewayController.d.ts +21 -21
- package/dist/controller/gateway/CrudMtdGatewayController.js +119 -119
- package/dist/controller/gateway/CrudStdGatewayController.d.ts +38 -38
- package/dist/controller/gateway/CrudStdGatewayController.js +137 -137
- package/dist/controller/gateway/DocGatewayController.d.ts +27 -27
- package/dist/controller/gateway/DocGatewayController.js +179 -179
- package/dist/controller/gateway/FileController.d.ts +25 -25
- 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 +165 -165
- package/dist/controller/gateway/StaticController.d.ts +24 -23
- package/dist/controller/gateway/StaticController.js +288 -284
- 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 +71 -71
- 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 +38 -38
- package/dist/controller/manage/CrudStandardDesignApi.js +334 -334
- 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 +91 -91
- 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 +102 -101
- package/dist/index.js +120 -119
- 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 -43
- 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 +29 -29
- package/dist/libs/crud-pro/models/Transaction.js +67 -67
- 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 -223
- 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 +79 -79
- package/dist/libs/crud-pro/services/CrudProTableMetaService.d.ts +9 -9
- package/dist/libs/crud-pro/services/CrudProTableMetaService.js +78 -78
- 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/sql.txt +120 -120
- 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 +45 -45
- package/dist/libs/global-config/global-config.js +33 -33
- 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 -4
- package/dist/libs/utils/functions.js +68 -63
- 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 +5 -5
- package/dist/libs/utils/parseCreateSql.js +86 -86
- 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 +253 -253
- package/dist/middleware/permission.middleware.d.ts +18 -18
- package/dist/middleware/permission.middleware.js +74 -74
- package/dist/middleware/tx.middleware.d.ts +9 -9
- package/dist/middleware/tx.middleware.js +40 -40
- package/dist/models/AsyncTaskModel.d.ts +72 -69
- package/dist/models/AsyncTaskModel.js +29 -26
- package/dist/models/RedisKeys.d.ts +11 -8
- package/dist/models/RedisKeys.js +14 -11
- package/dist/models/SystemEntities.d.ts +98 -98
- package/dist/models/SystemEntities.js +2 -2
- 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 +96 -69
- package/dist/models/bizmodels.js +39 -34
- 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 +61 -61
- package/dist/models/userSession.js +165 -165
- package/dist/schedule/anonymousContext.d.ts +14 -13
- 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 -15
- 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 +70 -70
- package/dist/service/AuthService.js +251 -251
- package/dist/service/EnumInfoService.d.ts +30 -30
- package/dist/service/EnumInfoService.js +126 -126
- 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 +16 -16
- package/dist/service/UserSessionService.js +86 -86
- package/dist/service/VisitStatService.d.ts +14 -14
- package/dist/service/VisitStatService.js +158 -158
- package/dist/service/WorkbenchService.d.ts +20 -20
- package/dist/service/WorkbenchService.js +159 -155
- package/dist/service/anyapi/AnyApiSandboxService.d.ts +15 -15
- package/dist/service/anyapi/AnyApiSandboxService.js +122 -122
- package/dist/service/anyapi/AnyApiService.d.ts +27 -27
- package/dist/service/anyapi/AnyApiService.js +181 -181
- package/dist/service/asyncTask/AsyncTaskRunnerService.d.ts +37 -37
- package/dist/service/asyncTask/AsyncTaskRunnerService.js +242 -232
- 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 -0
- package/dist/service/asyncTask/handler/ExcelInfoModel.js +2 -0
- package/dist/service/asyncTask/handler/ExportExcelAsyncTaskHandler.d.ts +7 -0
- package/dist/service/asyncTask/handler/ExportExcelAsyncTaskHandler.js +197 -0
- package/dist/service/asyncTask/handler/ExportExcelByInnerHttpHandler.d.ts +36 -0
- package/dist/service/asyncTask/handler/ExportExcelByInnerHttpHandler.js +130 -0
- package/dist/service/asyncTask/handler/ExportExcelByStdCrudHandler.d.ts +46 -0
- package/dist/service/asyncTask/handler/ExportExcelByStdCrudHandler.js +121 -0
- 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 -29
- package/dist/service/base/BaseService.js +101 -79
- package/dist/service/base/RedisCacheService.d.ts +13 -13
- package/dist/service/base/RedisCacheService.js +50 -50
- 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 +85 -85
- package/dist/service/crudstd/CrudStdService.d.ts +63 -51
- package/dist/service/crudstd/CrudStdService.js +259 -227
- package/dist/service/curd/CrudProQuick.d.ts +24 -24
- package/dist/service/curd/CrudProQuick.js +109 -105
- package/dist/service/curd/CurdMixByAccountService.d.ts +9 -9
- package/dist/service/curd/CurdMixByAccountService.js +93 -93
- package/dist/service/curd/CurdMixByDictService.d.ts +13 -13
- package/dist/service/curd/CurdMixByDictService.js +114 -113
- package/dist/service/curd/CurdMixByLinkToCustomService.d.ts +31 -31
- package/dist/service/curd/CurdMixByLinkToCustomService.js +203 -202
- 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 +27 -17
- package/dist/service/curd/CurdMixService.js +100 -76
- package/dist/service/curd/CurdMixUtils.d.ts +51 -35
- package/dist/service/curd/CurdMixUtils.js +275 -238
- package/dist/service/curd/CurdProService.d.ts +32 -31
- package/dist/service/curd/CurdProService.js +210 -207
- package/dist/service/curd/fixCfgModel.d.ts +3 -3
- package/dist/service/curd/fixCfgModel.js +107 -107
- package/dist/service/proxyapi/ProxyApiLoadService.d.ts +21 -21
- package/dist/service/proxyapi/ProxyApiLoadService.js +167 -167
- package/dist/service/proxyapi/ProxyApiService.d.ts +60 -60
- package/dist/service/proxyapi/ProxyApiService.js +260 -260
- 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/dist/views/404_app.html +31 -31
- package/dist/views/404_workbench.html +34 -34
- package/index.d.ts +10 -10
- package/package.json +80 -78
- package/src/config/config.default.ts +207 -203
- package/src/config/seed/aeskey.txt +1 -1
- package/src/config/utils.ts +2 -3
- package/src/configuration.ts +5 -12
- package/src/controller/base/BaseApiController.ts +21 -3
- package/src/controller/gateway/AsyncTaskController.ts +76 -2
- package/src/controller/gateway/StaticController.ts +15 -12
- package/src/controller/manage/AnyApiMangeApi.ts +66 -66
- package/src/controller/manage/AppLogMangeApi.ts +53 -53
- package/src/controller/manage/AppMangeApi.ts +53 -53
- package/src/controller/manage/AppPageMangeApi.ts +52 -52
- package/src/controller/manage/AppSchemaHistoryApi.ts +49 -49
- package/src/controller/manage/CrudMethodsMangeApi.ts +49 -49
- package/src/controller/manage/DataDictManageApi.ts +78 -78
- package/src/controller/manage/DocLibManageApi.ts +69 -69
- package/src/controller/manage/DocManageApi.ts +99 -99
- package/src/controller/manage/FileManageApi.ts +45 -45
- package/src/controller/manage/LowCodeTplManageApi.ts +52 -52
- package/src/controller/manage/MenuManageApi.ts +58 -58
- package/src/controller/manage/ProxyApiMangeApi.ts +52 -52
- package/src/controller/manage/SysConfigMangeApi.ts +95 -95
- package/src/controller/manage/UserAccountManageApi.ts +94 -94
- package/src/controller/manage/WorkbenchMangeApi.ts +72 -72
- package/src/index.ts +106 -105
- package/src/interface.ts +31 -31
- package/src/libs/crud-pro/models/ExecuteContext.ts +13 -4
- package/src/libs/crud-pro/services/CrudProCachedCfgService.ts +2 -3
- package/src/libs/crud-pro/services/CrudProExecuteSqlService.ts +8 -9
- package/src/libs/crud-pro/services/CrudProTableMetaService.ts +86 -86
- package/src/libs/crud-pro/sql.txt +120 -120
- package/src/libs/crud-pro/utils/sqlConvert/convertColumnName.ts +26 -26
- package/src/libs/crud-pro/utils/sqlConvert/convertMix.ts +25 -25
- package/src/libs/crud-pro/utils/sqlConvert/convertMsSql.ts +11 -11
- package/src/libs/crud-pro/utils/sqlConvert/convertPgSql.ts +11 -11
- package/src/libs/crud-pro/utils/sqlConvert/convertPgType.ts +129 -129
- package/src/libs/utils/functions.ts +73 -67
- package/src/libs/utils/render-utils.ts +184 -184
- package/src/middleware/permission.middleware.ts +1 -2
- package/src/models/AsyncTaskModel.ts +82 -79
- package/src/models/RedisKeys.ts +10 -11
- package/src/models/SystemEntities.ts +115 -115
- package/src/models/SystemPerm.ts +105 -105
- package/src/models/SystemTables.ts +27 -27
- package/src/models/bizmodels.ts +120 -88
- package/src/models/contextLogger.ts +132 -132
- package/src/models/devops.ts +17 -17
- package/src/models/userSession.ts +216 -216
- package/src/schedule/anonymousContext.ts +17 -23
- package/src/schedule/index.ts +12 -12
- package/src/schedule/runSchedule.ts +82 -83
- package/src/schedule/scheduleNames.ts +21 -21
- package/src/service/AuthService.ts +275 -275
- package/src/service/EnumInfoService.ts +22 -27
- package/src/service/FileCenterService.ts +0 -5
- package/src/service/SysConfigService.ts +4 -5
- package/src/service/UserAccountService.ts +107 -110
- package/src/service/UserSessionService.ts +12 -16
- package/src/service/WorkbenchService.ts +15 -15
- package/src/service/anyapi/AnyApiSandboxService.ts +121 -121
- package/src/service/anyapi/AnyApiService.ts +187 -187
- package/src/service/asyncTask/AsyncTaskRunnerService.ts +19 -8
- package/src/service/asyncTask/handler/ExcelInfoModel.ts +11 -0
- package/src/service/asyncTask/handler/ExportExcelAsyncTaskHandler.ts +224 -0
- package/src/service/asyncTask/handler/ExportExcelByInnerHttpHandler.ts +147 -0
- package/src/service/asyncTask/handler/ExportExcelByStdCrudHandler.ts +138 -0
- package/src/service/base/ApiBaseService.ts +3 -3
- package/src/service/base/ApiRateLimiter.ts +59 -59
- package/src/service/base/BaseService.ts +100 -74
- package/src/service/base/RedisCacheService.ts +38 -38
- package/src/service/crudstd/CrudStdActionService.ts +27 -27
- package/src/service/crudstd/CrudStdConstant.ts +62 -62
- package/src/service/crudstd/CrudStdRelationService.ts +78 -78
- package/src/service/crudstd/CrudStdService.ts +283 -243
- package/src/service/curd/CrudProQuick.ts +11 -17
- package/src/service/curd/CurdMixByAccountService.ts +8 -9
- package/src/service/curd/CurdMixByDictService.ts +19 -24
- package/src/service/curd/CurdMixByLinkToCustomService.ts +10 -9
- package/src/service/curd/CurdMixBySysConfigService.ts +8 -13
- package/src/service/curd/CurdMixByWorkbenchService.ts +7 -8
- package/src/service/curd/CurdMixService.ts +37 -5
- package/src/service/curd/CurdMixUtils.ts +65 -45
- package/src/service/curd/CurdProService.ts +42 -48
- package/src/service/curd/fixCfgModel.ts +139 -139
- package/src/service/proxyapi/ProxyApiLoadService.ts +174 -174
- package/src/service/proxyapi/ProxyApiService.ts +262 -262
- package/src/service/proxyapi/ProxyApiUtils.ts +32 -32
- package/src/service/proxyapi/RouteHandler.ts +8 -8
- package/src/service/proxyapi/RouteTrie.ts +74 -74
- package/src/service/proxyapi/WeightedRandom.ts +37 -37
- package/src/service/proxyapi/WeightedRoundRobin.ts +44 -44
- package/src/views/404_app.html +31 -31
- package/src/views/404_workbench.html +34 -34
- package/tsconfig.json +32 -32
|
@@ -2,12 +2,12 @@ import { Inject, Provide } from '@midwayjs/core';
|
|
|
2
2
|
import { Context } from '@midwayjs/koa';
|
|
3
3
|
import * as _ from 'lodash';
|
|
4
4
|
import { CurdProService } from './CurdProService';
|
|
5
|
-
import {
|
|
5
|
+
import { HandleExecuteContextType, IExecuteContextHandler } from '@/libs/crud-pro/models/ExecuteContext';
|
|
6
6
|
import { CrudMixUtils, RelatedType } from './CurdMixUtils';
|
|
7
|
-
import { SystemTables } from '
|
|
8
|
-
import { KeysOfSimpleSQL } from '
|
|
9
|
-
import { ColumnRelation, IRequestCfgModel, IRequestModel } from '
|
|
10
|
-
import { MixinUtils } from '
|
|
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
11
|
import { GLOBAL_STATIC_CONFIG } from '@/libs/global-config/global-config';
|
|
12
12
|
|
|
13
13
|
const dictMixUtils = new CrudMixUtils(RelatedType.accountBasic);
|
|
@@ -17,12 +17,12 @@ const TMP_CTX_KEY = _.uniqueId('CurdMixByAccountService');
|
|
|
17
17
|
@Provide()
|
|
18
18
|
export class CurdMixByAccountService implements IExecuteContextHandler {
|
|
19
19
|
@Inject()
|
|
20
|
-
ctx: Context;
|
|
20
|
+
protected ctx: Context;
|
|
21
21
|
|
|
22
22
|
@Inject()
|
|
23
23
|
protected curdProService: CurdProService;
|
|
24
24
|
|
|
25
|
-
async handleExecuteContextPrepare(executeContext:
|
|
25
|
+
async handleExecuteContextPrepare(executeContext: HandleExecuteContextType) {
|
|
26
26
|
const { SystemDbName, SystemDbType, toFatcmsUserAccountId } = GLOBAL_STATIC_CONFIG.getConfig();
|
|
27
27
|
|
|
28
28
|
const relations = dictMixUtils.pickColumnRelations(executeContext);
|
|
@@ -41,7 +41,6 @@ export class CurdMixByAccountService implements IExecuteContextHandler {
|
|
|
41
41
|
row['__fatcmsUserAccountId__'] = fatcmsUserAccountId;
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
|
-
|
|
45
44
|
});
|
|
46
45
|
|
|
47
46
|
if (accountIds.size === 0) {
|
|
@@ -70,7 +69,7 @@ export class CurdMixByAccountService implements IExecuteContextHandler {
|
|
|
70
69
|
executeContext[TMP_CTX_KEY] = MixinUtils.toNewMap(userInfos, (obj: any) => obj.account_id);
|
|
71
70
|
}
|
|
72
71
|
|
|
73
|
-
async handleExecuteContext(executeContext:
|
|
72
|
+
async handleExecuteContext(executeContext: HandleExecuteContextType): Promise<void> {
|
|
74
73
|
const userInfoMap = executeContext[TMP_CTX_KEY] as Map<string, any>;
|
|
75
74
|
if (!userInfoMap || userInfoMap.size === 0) {
|
|
76
75
|
return;
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
+
import * as _ from 'lodash';
|
|
1
2
|
import { Inject, Provide } from '@midwayjs/core';
|
|
2
3
|
import { Context } from '@midwayjs/koa';
|
|
3
4
|
import { CurdProService } from './CurdProService';
|
|
4
|
-
import {
|
|
5
|
+
import { HandleExecuteContextType, IExecuteContextHandler } from '@/libs/crud-pro/models/ExecuteContext';
|
|
5
6
|
import { CrudMixUtils, RelatedType } from './CurdMixUtils';
|
|
6
|
-
import { SystemTables} from '
|
|
7
|
-
import { KeysOfSimpleSQL } from '
|
|
8
|
-
import { MultiKeyMap } from '
|
|
9
|
-
import { ColumnRelation } from '
|
|
10
|
-
import
|
|
11
|
-
import {RedisCacheService} from "../base/RedisCacheService";
|
|
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
12
|
import { GLOBAL_STATIC_CONFIG } from '@/libs/global-config/global-config';
|
|
13
|
+
import { RedisKeys } from '@/models/RedisKeys';
|
|
13
14
|
|
|
14
15
|
const TMP_CTX_KEY = _.uniqueId('CurdMixByDictService');
|
|
15
16
|
|
|
16
17
|
const dictMixUtils = new CrudMixUtils(RelatedType.dict);
|
|
17
18
|
|
|
18
|
-
|
|
19
19
|
@Provide()
|
|
20
20
|
export class CurdMixByDictService implements IExecuteContextHandler {
|
|
21
21
|
@Inject()
|
|
@@ -27,17 +27,16 @@ export class CurdMixByDictService implements IExecuteContextHandler {
|
|
|
27
27
|
@Inject()
|
|
28
28
|
protected redisCacheService: RedisCacheService;
|
|
29
29
|
|
|
30
|
-
private async getFromCache(code:string): Promise<any> {
|
|
31
|
-
const cacheKey =
|
|
32
|
-
return this.redisCacheService.getJsonObject(cacheKey)
|
|
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
33
|
}
|
|
34
|
-
private async setToCache(code:string, value: any): Promise<any> {
|
|
35
|
-
const cacheKey =
|
|
36
|
-
return this.redisCacheService.setJsonObject(cacheKey, value, 60 * 60
|
|
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
37
|
}
|
|
38
38
|
|
|
39
|
-
|
|
40
|
-
async handleExecuteContextPrepare(executeContext: ExecuteContext): Promise<void> {
|
|
39
|
+
async handleExecuteContextPrepare(executeContext: HandleExecuteContextType): Promise<void> {
|
|
41
40
|
const codes = dictMixUtils.pickColumnRelationCodes(executeContext);
|
|
42
41
|
if (!codes || codes.length === 0) {
|
|
43
42
|
return;
|
|
@@ -47,18 +46,14 @@ export class CurdMixByDictService implements IExecuteContextHandler {
|
|
|
47
46
|
}
|
|
48
47
|
|
|
49
48
|
private async getDictItemRows(codes: string[]) {
|
|
50
|
-
|
|
51
49
|
const { SystemDbName, SystemDbType } = GLOBAL_STATIC_CONFIG.getConfig();
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
50
|
const noCacheCodes: string[] = [];
|
|
56
51
|
|
|
57
52
|
// 从缓存里面取
|
|
58
53
|
let cachedRows = [];
|
|
59
54
|
for (let i = 0; i < codes.length; i++) {
|
|
60
55
|
const code = codes[i];
|
|
61
|
-
const rows1:any[] = await this.getFromCache(code);
|
|
56
|
+
const rows1: any[] = await this.getFromCache(code);
|
|
62
57
|
// const rows1 = [];
|
|
63
58
|
if (rows1 && rows1.length > 0) {
|
|
64
59
|
cachedRows = cachedRows.concat(rows1);
|
|
@@ -94,7 +89,7 @@ export class CurdMixByDictService implements IExecuteContextHandler {
|
|
|
94
89
|
return cachedRows.concat(selectedRows);
|
|
95
90
|
}
|
|
96
91
|
|
|
97
|
-
async handleExecuteContext(executeContext:
|
|
92
|
+
async handleExecuteContext(executeContext: HandleExecuteContextType): Promise<void> {
|
|
98
93
|
const multiKeyMap = executeContext[TMP_CTX_KEY] as MultiKeyMap;
|
|
99
94
|
if (!multiKeyMap || multiKeyMap.isEmpty()) {
|
|
100
95
|
return;
|
|
@@ -107,8 +102,8 @@ export class CurdMixByDictService implements IExecuteContextHandler {
|
|
|
107
102
|
if (!Array.isArray(targetColumns) || targetColumns.length === 0) {
|
|
108
103
|
columnRelation.targetColumns = [
|
|
109
104
|
{
|
|
110
|
-
|
|
111
|
-
|
|
105
|
+
from: '*',
|
|
106
|
+
to: `${sourceColumn}_info[$ARRAY_INDEX]`,
|
|
112
107
|
},
|
|
113
108
|
];
|
|
114
109
|
}
|
|
@@ -2,16 +2,17 @@ import { Inject, Provide } from '@midwayjs/core';
|
|
|
2
2
|
import { Context } from '@midwayjs/koa';
|
|
3
3
|
import * as _ from 'lodash';
|
|
4
4
|
import { CurdProService } from './CurdProService';
|
|
5
|
-
import {
|
|
5
|
+
import { HandleExecuteContextType, IExecuteContextHandler } from '@/libs/crud-pro/models/ExecuteContext';
|
|
6
6
|
import { CrudMixUtils, RelatedType } from './CurdMixUtils';
|
|
7
|
-
import { KeysOfSimpleSQL } from '
|
|
8
|
-
import { ColumnRelation } from '
|
|
9
|
-
import { BizException } from '
|
|
10
|
-
import { Exceptions } from '
|
|
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
11
|
import { RedisCacheService } from '../base/RedisCacheService';
|
|
12
|
-
import { parseDatabaseName } from '
|
|
12
|
+
import { parseDatabaseName } from '@/libs/crud-pro/utils/DatabaseName';
|
|
13
13
|
import { GLOBAL_STATIC_CONFIG } from '@/libs/global-config/global-config';
|
|
14
14
|
import { IRequestCfgModel2 } from '@/models/bizmodels';
|
|
15
|
+
import { RedisKeys } from '@/models/RedisKeys';
|
|
15
16
|
|
|
16
17
|
const linkToCustomMixUtils = new CrudMixUtils(RelatedType.linkToCustom);
|
|
17
18
|
const TMP_CTX_KEY = _.uniqueId('CurdMixByLinkToCustomService');
|
|
@@ -53,7 +54,7 @@ export class CurdMixByLinkToCustomService implements IExecuteContextHandler {
|
|
|
53
54
|
@Inject()
|
|
54
55
|
protected redisCacheService: RedisCacheService;
|
|
55
56
|
|
|
56
|
-
async handleExecuteContextPrepare(executeContext:
|
|
57
|
+
async handleExecuteContextPrepare(executeContext: HandleExecuteContextType) {
|
|
57
58
|
const relations = linkToCustomMixUtils.pickColumnRelations(executeContext);
|
|
58
59
|
|
|
59
60
|
if (!relations || relations.length === 0) {
|
|
@@ -62,7 +63,7 @@ export class CurdMixByLinkToCustomService implements IExecuteContextHandler {
|
|
|
62
63
|
executeContext[TMP_CTX_KEY] = await this.loadInfoByLinkToCustomMap(relations);
|
|
63
64
|
}
|
|
64
65
|
|
|
65
|
-
async handleExecuteContext(executeContext:
|
|
66
|
+
async handleExecuteContext(executeContext: HandleExecuteContextType): Promise<void> {
|
|
66
67
|
const dataInfoMap = executeContext[TMP_CTX_KEY] as Map<string, Map<string, any>>;
|
|
67
68
|
if (!dataInfoMap || dataInfoMap.size === 0) {
|
|
68
69
|
return;
|
|
@@ -90,7 +91,7 @@ export class CurdMixByLinkToCustomService implements IExecuteContextHandler {
|
|
|
90
91
|
}
|
|
91
92
|
|
|
92
93
|
public async queryInfoByLinkToCustom(code: string): Promise<Map<string, any>> {
|
|
93
|
-
const cacheKey =
|
|
94
|
+
const cacheKey = RedisKeys.LINK_TO_CUSTOM_PREFIX + code;
|
|
94
95
|
let values;
|
|
95
96
|
const expireSecond = 2 * 60; // 2分钟
|
|
96
97
|
const enumMap = await this.redisCacheService.getJsonObject(cacheKey);
|
|
@@ -1,22 +1,20 @@
|
|
|
1
1
|
import { Inject, Provide } from '@midwayjs/core';
|
|
2
2
|
import { Context } from '@midwayjs/koa';
|
|
3
3
|
import { CurdProService } from './CurdProService';
|
|
4
|
-
import {
|
|
4
|
+
import { HandleExecuteContextType, IExecuteContextHandler } from '@/libs/crud-pro/models/ExecuteContext';
|
|
5
5
|
import { CrudMixUtils, RelatedType } from './CurdMixUtils';
|
|
6
6
|
import * as _ from 'lodash';
|
|
7
|
-
import { SystemTables} from '
|
|
8
|
-
import { KeysOfSimpleSQL } from '
|
|
9
|
-
import { MultiKeyMap } from '
|
|
10
|
-
import { ColumnRelation } from '
|
|
11
|
-
import { parseConfigContentToEnumInfo } from
|
|
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
12
|
import { GLOBAL_STATIC_CONFIG } from '@/libs/global-config/global-config';
|
|
13
13
|
|
|
14
14
|
const dictMixUtils = new CrudMixUtils(RelatedType.sysCfgEnum);
|
|
15
15
|
|
|
16
16
|
const TMP_CTX_KEY = _.uniqueId('CurdMixBySysConfigService');
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
18
|
@Provide()
|
|
21
19
|
export class CurdMixBySysConfigService implements IExecuteContextHandler {
|
|
22
20
|
@Inject()
|
|
@@ -25,11 +23,9 @@ export class CurdMixBySysConfigService implements IExecuteContextHandler {
|
|
|
25
23
|
@Inject()
|
|
26
24
|
protected curdProService: CurdProService;
|
|
27
25
|
|
|
28
|
-
async handleExecuteContextPrepare(executeContext:
|
|
29
|
-
|
|
26
|
+
async handleExecuteContextPrepare(executeContext: HandleExecuteContextType) {
|
|
30
27
|
const { SystemDbName, SystemDbType } = GLOBAL_STATIC_CONFIG.getConfig();
|
|
31
28
|
|
|
32
|
-
|
|
33
29
|
const codes = dictMixUtils.pickColumnRelationCodes(executeContext);
|
|
34
30
|
if (!codes || codes.length === 0) {
|
|
35
31
|
return;
|
|
@@ -61,8 +57,7 @@ export class CurdMixBySysConfigService implements IExecuteContextHandler {
|
|
|
61
57
|
executeContext[TMP_CTX_KEY] = multiKeyMap;
|
|
62
58
|
}
|
|
63
59
|
|
|
64
|
-
|
|
65
|
-
async handleExecuteContext(executeContext: ExecuteContext): Promise<void> {
|
|
60
|
+
async handleExecuteContext(executeContext: HandleExecuteContextType): Promise<void> {
|
|
66
61
|
const multiKeyMap = executeContext[TMP_CTX_KEY] as MultiKeyMap;
|
|
67
62
|
if (!multiKeyMap || multiKeyMap.isEmpty()) {
|
|
68
63
|
return;
|
|
@@ -3,12 +3,12 @@ import { Context } from '@midwayjs/koa';
|
|
|
3
3
|
import * as _ from 'lodash';
|
|
4
4
|
import { LRUCache } from 'lru-cache';
|
|
5
5
|
import { CurdProService } from './CurdProService';
|
|
6
|
-
import {
|
|
6
|
+
import { HandleExecuteContextType, IExecuteContextHandler } from '@/libs/crud-pro/models/ExecuteContext';
|
|
7
7
|
import { CrudMixUtils, RelatedType } from './CurdMixUtils';
|
|
8
|
-
import { SystemTables } from '
|
|
9
|
-
import { KeysOfSimpleSQL } from '
|
|
10
|
-
import { ColumnRelation } from '
|
|
11
|
-
import { MixinUtils } from '
|
|
8
|
+
import { SystemTables } from '@/models/SystemTables';
|
|
9
|
+
import { KeysOfSimpleSQL } from '@/libs/crud-pro/models/keys';
|
|
10
|
+
import { ColumnRelation } from '@/libs/crud-pro/interfaces';
|
|
11
|
+
import { MixinUtils } from '@/libs/crud-pro/utils/MixinUtils';
|
|
12
12
|
import { GLOBAL_STATIC_CONFIG } from '@/libs/global-config/global-config';
|
|
13
13
|
|
|
14
14
|
const lruCache = new LRUCache<string, any>({
|
|
@@ -30,7 +30,6 @@ export class CurdMixByWorkbenchService implements IExecuteContextHandler {
|
|
|
30
30
|
protected curdProService: CurdProService;
|
|
31
31
|
|
|
32
32
|
private async loadWorkbenchListMap() {
|
|
33
|
-
|
|
34
33
|
const { SystemDbName, SystemDbType } = GLOBAL_STATIC_CONFIG.getConfig();
|
|
35
34
|
|
|
36
35
|
let workbenchListMap = lruCache.get('workbenchListMap');
|
|
@@ -52,7 +51,7 @@ export class CurdMixByWorkbenchService implements IExecuteContextHandler {
|
|
|
52
51
|
return workbenchListMap;
|
|
53
52
|
}
|
|
54
53
|
|
|
55
|
-
async handleExecuteContextPrepare(executeContext:
|
|
54
|
+
async handleExecuteContextPrepare(executeContext: HandleExecuteContextType) {
|
|
56
55
|
const relations = workbenchMixUtils.pickColumnRelations(executeContext);
|
|
57
56
|
if (!relations || relations.length === 0) {
|
|
58
57
|
return;
|
|
@@ -60,7 +59,7 @@ export class CurdMixByWorkbenchService implements IExecuteContextHandler {
|
|
|
60
59
|
executeContext[TMP_CTX_KEY] = await this.loadWorkbenchListMap();
|
|
61
60
|
}
|
|
62
61
|
|
|
63
|
-
async handleExecuteContext(executeContext:
|
|
62
|
+
async handleExecuteContext(executeContext: HandleExecuteContextType): Promise<void> {
|
|
64
63
|
const userInfoMap = executeContext[TMP_CTX_KEY] as Map<string, any>;
|
|
65
64
|
if (!userInfoMap || userInfoMap.size === 0) {
|
|
66
65
|
return;
|
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
import { Inject, Provide } from '@midwayjs/core';
|
|
2
2
|
import { CurdProService } from './CurdProService';
|
|
3
3
|
import { CurdMixByDictService } from './CurdMixByDictService';
|
|
4
|
-
import { IRequestCfgModel, IRequestModel, ISqlCfgModel } from '
|
|
4
|
+
import { ColumnRelation, IRequestCfgModel, IRequestModel, ISqlCfgModel } from '@/libs/crud-pro/interfaces';
|
|
5
5
|
import { CurdMixBySysConfigService } from './CurdMixBySysConfigService';
|
|
6
6
|
import { CurdMixByAccountService } from './CurdMixByAccountService';
|
|
7
7
|
import { RelatedType } from './CurdMixUtils';
|
|
8
8
|
import { CurdMixByWorkbenchService } from './CurdMixByWorkbenchService';
|
|
9
|
-
import { IRequestCfgModel2 } from '
|
|
10
|
-
import {CurdMixByLinkToCustomService} from
|
|
11
|
-
import {SqlDbType} from
|
|
9
|
+
import { IRequestCfgModel2 } from '@/models/bizmodels';
|
|
10
|
+
import { CurdMixByLinkToCustomService } from './CurdMixByLinkToCustomService';
|
|
11
|
+
import { SqlDbType } from '@/libs/crud-pro/models/keys';
|
|
12
|
+
import { IExecuteContextCustom } from '@/libs/crud-pro/models/ExecuteContext';
|
|
13
|
+
|
|
14
|
+
export interface ILinkColumnRelationParam {
|
|
15
|
+
columnsRelations: ColumnRelation[];
|
|
16
|
+
}
|
|
12
17
|
|
|
13
18
|
@Provide()
|
|
14
19
|
export class CurdMixService {
|
|
@@ -30,7 +35,6 @@ export class CurdMixService {
|
|
|
30
35
|
@Inject()
|
|
31
36
|
private curdMixByLinkToCustomService: CurdMixByLinkToCustomService;
|
|
32
37
|
|
|
33
|
-
|
|
34
38
|
private prepare() {
|
|
35
39
|
this.curdProService.setResponseCfgHandlers(RelatedType.dict, this.curdMixByDictService);
|
|
36
40
|
this.curdProService.setResponseCfgHandlers(RelatedType.sysCfgEnum, this.curdMixBySysConfigService);
|
|
@@ -62,4 +66,32 @@ export class CurdMixService {
|
|
|
62
66
|
public async getCachedCfgByMethod(method: string): Promise<IRequestCfgModel> {
|
|
63
67
|
return this.curdProService.getCachedCfgByMethod(method);
|
|
64
68
|
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* 根据配置的关联关系,直接关联数据
|
|
72
|
+
* @param rows
|
|
73
|
+
* @param param
|
|
74
|
+
* @returns
|
|
75
|
+
*/
|
|
76
|
+
public async linkColumnRelationDatas(rows: any[], param: ILinkColumnRelationParam) {
|
|
77
|
+
if (!Array.isArray(rows) || rows.length === 0) {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
this.prepare();
|
|
82
|
+
|
|
83
|
+
const exeCtx: IExecuteContextCustom = {
|
|
84
|
+
rows,
|
|
85
|
+
columnsRelation: param.columnsRelations,
|
|
86
|
+
isCustomContext: true,
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
const responseCfgHandlers = this.curdProService.getResponseCfgHandlers();
|
|
90
|
+
const handlers = Object.values(responseCfgHandlers);
|
|
91
|
+
for (let i = 0; i < handlers.length; i++) {
|
|
92
|
+
const handler = handlers[i];
|
|
93
|
+
await handler.handleExecuteContextPrepare(exeCtx);
|
|
94
|
+
await handler.handleExecuteContext(exeCtx);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
65
97
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ColumnRelation, CopyAttr } from '@/libs/crud-pro/interfaces';
|
|
2
|
-
import { ExecuteContext } from '@/libs/crud-pro/models/ExecuteContext';
|
|
2
|
+
import { ExecuteContext, HandleExecuteContextType, IExecuteContextCustom } from '@/libs/crud-pro/models/ExecuteContext';
|
|
3
3
|
import { KeyOfCrudTypes } from '@/libs/crud-pro/models/keys';
|
|
4
4
|
import { MixinUtils } from '@/libs/crud-pro/utils/MixinUtils';
|
|
5
5
|
import { SqlCfgModel } from '@/libs/crud-pro/models/SqlCfgModel';
|
|
@@ -30,8 +30,11 @@ function getColumnsRelationAll(sqlCfg: SqlCfgModel, cfgModel: RequestCfgModel):
|
|
|
30
30
|
return [];
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
const forEachColumnsRelation = (row: any, columnsRelation: ColumnRelation[], func: FuncRowColumnRelation) => {
|
|
34
|
+
for (let i = 0; i < columnsRelation.length; i++) {
|
|
35
|
+
func(row, columnsRelation[i]);
|
|
36
|
+
}
|
|
37
|
+
};
|
|
35
38
|
|
|
36
39
|
function copyBySingleSourceValue(row: any, sourceValue: any, targetColumns: CopyAttr[], getValue: any) {
|
|
37
40
|
// const codeObject = map.get(sourceValue);
|
|
@@ -43,28 +46,20 @@ function copyBySingleSourceValue(row: any, sourceValue: any, targetColumns: Copy
|
|
|
43
46
|
if (Array.isArray(targetColumns)) {
|
|
44
47
|
for (let i = 0; i < targetColumns.length; i++) {
|
|
45
48
|
const targetColumn = targetColumns[i];
|
|
46
|
-
const toStr = targetColumn.to.replace('[$ARRAY_INDEX]',
|
|
47
|
-
if (targetColumn.from ===
|
|
49
|
+
const toStr = targetColumn.to.replace('[$ARRAY_INDEX]', '');
|
|
50
|
+
if (targetColumn.from === '*') {
|
|
48
51
|
_.set(row, toStr, codeObject);
|
|
49
52
|
} else {
|
|
50
53
|
const dictAttrValue = _.get(codeObject, targetColumn.from);
|
|
51
|
-
if (typeof dictAttrValue !==
|
|
54
|
+
if (typeof dictAttrValue !== 'undefined' && dictAttrValue !== null) {
|
|
52
55
|
_.set(row, toStr, dictAttrValue);
|
|
53
56
|
}
|
|
54
57
|
}
|
|
55
58
|
}
|
|
56
59
|
}
|
|
57
|
-
|
|
58
60
|
}
|
|
59
61
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
62
|
function copyByArraySourceValueInner(row: any, codes: any[], targetColumns: CopyAttr[], getValue: any, resultObj: any) {
|
|
67
|
-
|
|
68
63
|
for (let codeIndex = 0; codeIndex < codes.length; codeIndex++) {
|
|
69
64
|
const code = codes[codeIndex];
|
|
70
65
|
// const codeObject = map.get(code);
|
|
@@ -75,7 +70,6 @@ function copyByArraySourceValueInner(row: any, codes: any[], targetColumns: Copy
|
|
|
75
70
|
const targetColumn = targetColumns[i];
|
|
76
71
|
|
|
77
72
|
if (targetColumn.from === '*') {
|
|
78
|
-
|
|
79
73
|
const toStr = targetColumn.to.replace('$ARRAY_INDEX', `${codeIndex}`);
|
|
80
74
|
_.set(row, toStr, codeObject);
|
|
81
75
|
|
|
@@ -95,22 +89,20 @@ function copyByArraySourceValueInner(row: any, codes: any[], targetColumns: Copy
|
|
|
95
89
|
}
|
|
96
90
|
|
|
97
91
|
function copyByArraySourceValue(row: any, sourceValue: any, targetColumns: CopyAttr[], getValue: any): boolean {
|
|
98
|
-
const resultObj = {isSetArray: false }
|
|
92
|
+
const resultObj = { isSetArray: false };
|
|
99
93
|
// 支持关联JSON数组。使用 字符串存储的类型
|
|
100
94
|
if (typeof sourceValue === 'string' && sourceValue.startsWith('[') && sourceValue.endsWith(']')) {
|
|
101
95
|
const codes = parseJsonObject(sourceValue);
|
|
102
96
|
if (Array.isArray(codes)) {
|
|
103
97
|
copyByArraySourceValueInner(row, codes, targetColumns, getValue, resultObj);
|
|
104
98
|
}
|
|
105
|
-
} else if(Array.isArray(sourceValue)) {
|
|
99
|
+
} else if (Array.isArray(sourceValue)) {
|
|
106
100
|
// 直接使用JSON或者postgres的数组存储的类型
|
|
107
101
|
copyByArraySourceValueInner(row, sourceValue, targetColumns, getValue, resultObj);
|
|
108
102
|
}
|
|
109
103
|
return resultObj.isSetArray;
|
|
110
104
|
}
|
|
111
105
|
|
|
112
|
-
|
|
113
|
-
|
|
114
106
|
class CrudMixUtils {
|
|
115
107
|
private readonly relatedType: RelatedType;
|
|
116
108
|
constructor(relatedType: RelatedType) {
|
|
@@ -123,8 +115,22 @@ class CrudMixUtils {
|
|
|
123
115
|
return ss.filter(s => s.relatedType === relatedType);
|
|
124
116
|
}
|
|
125
117
|
|
|
126
|
-
|
|
118
|
+
/**
|
|
119
|
+
* 从执行上下文,获取所有的关联关系
|
|
120
|
+
* @param exeCtxType
|
|
121
|
+
* @returns
|
|
122
|
+
*/
|
|
123
|
+
public pickColumnRelations(exeCtxType: HandleExecuteContextType): ColumnRelation[] {
|
|
124
|
+
// 自定义的关联关系
|
|
125
|
+
const customExeCtx = exeCtxType as IExecuteContextCustom;
|
|
126
|
+
if (customExeCtx.isCustomContext) {
|
|
127
|
+
const customExeCtx = exeCtxType as IExecuteContextCustom;
|
|
128
|
+
return customExeCtx.columnsRelation;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// 默认的执行上下文
|
|
127
132
|
const relationResult: ColumnRelation[] = [];
|
|
133
|
+
const exeCtx: ExecuteContext = exeCtxType as ExecuteContext;
|
|
128
134
|
const cfgModel = exeCtx.getCfgModel();
|
|
129
135
|
const sqlModels = exeCtx.getSqlCfgModels();
|
|
130
136
|
if (Array.isArray(sqlModels) && sqlModels.length > 0) {
|
|
@@ -142,12 +148,18 @@ class CrudMixUtils {
|
|
|
142
148
|
}
|
|
143
149
|
}
|
|
144
150
|
}
|
|
151
|
+
|
|
145
152
|
return _.uniqBy(relationResult, (obj: ColumnRelation) => {
|
|
146
153
|
return `${obj.relatedCode}_${obj.relatedType}_${obj.sourceColumn}_${JSON.stringify(obj.targetColumns)}`;
|
|
147
154
|
});
|
|
148
155
|
}
|
|
149
156
|
|
|
150
|
-
|
|
157
|
+
/**
|
|
158
|
+
* 从执行上下文,获取所有的关联关系的代码
|
|
159
|
+
* @param exeCtx
|
|
160
|
+
* @returns
|
|
161
|
+
*/
|
|
162
|
+
public pickColumnRelationCodes(exeCtx: HandleExecuteContextType): string[] {
|
|
151
163
|
const relationResult: ColumnRelation[] = this.pickColumnRelations(exeCtx);
|
|
152
164
|
const codes = relationResult.map(e => e.relatedCode);
|
|
153
165
|
if (!codes || codes.length === 0) {
|
|
@@ -156,17 +168,32 @@ class CrudMixUtils {
|
|
|
156
168
|
return [...new Set(codes)]; // 去重
|
|
157
169
|
}
|
|
158
170
|
|
|
159
|
-
|
|
171
|
+
/**
|
|
172
|
+
* 遍历每一行,每一个关联列
|
|
173
|
+
* @param exeCtxType
|
|
174
|
+
* @param func
|
|
175
|
+
* @returns
|
|
176
|
+
*/
|
|
177
|
+
public forEachRowAndColumnsRelation(exeCtxType: HandleExecuteContextType, func: FuncRowColumnRelation) {
|
|
178
|
+
// 自定义的关联关系
|
|
179
|
+
const customExeCtx = exeCtxType as IExecuteContextCustom;
|
|
180
|
+
if (customExeCtx.isCustomContext) {
|
|
181
|
+
const rows = customExeCtx.rows || [];
|
|
182
|
+
const columnsRelation = customExeCtx.columnsRelation;
|
|
183
|
+
for (let index = 0; index < rows.length; index++) {
|
|
184
|
+
const row = rows[index];
|
|
185
|
+
forEachColumnsRelation(row, columnsRelation, func);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
// 默认的执行上下文
|
|
192
|
+
const exeCtx: ExecuteContext = exeCtxType as ExecuteContext;
|
|
160
193
|
const sqlCfgList = exeCtx.getSqlCfgModels();
|
|
161
194
|
const resModel = exeCtx.getResModel();
|
|
162
195
|
const cfgModel = exeCtx.getCfgModel();
|
|
163
196
|
|
|
164
|
-
const forEachColumnsRelation = (row: any, columnsRelation: ColumnRelation[]) => {
|
|
165
|
-
for (let i = 0; i < columnsRelation.length; i++) {
|
|
166
|
-
func(row, columnsRelation[i]);
|
|
167
|
-
}
|
|
168
|
-
};
|
|
169
|
-
|
|
170
197
|
for (let i = 0; i < sqlCfgList.length; i++) {
|
|
171
198
|
const sqlCfg = sqlCfgList[i];
|
|
172
199
|
|
|
@@ -179,18 +206,17 @@ class CrudMixUtils {
|
|
|
179
206
|
if (Array.isArray(resValue) && isNotEmpty(resValue)) {
|
|
180
207
|
// 多行查询时
|
|
181
208
|
for (const row of resValue) {
|
|
182
|
-
forEachColumnsRelation(row, columnsRelation);
|
|
209
|
+
forEachColumnsRelation(row, columnsRelation, func);
|
|
183
210
|
}
|
|
184
211
|
} else if (typeof resValue === 'object' && isNotEmpty(resValue)) {
|
|
185
212
|
// 单行查询时
|
|
186
|
-
forEachColumnsRelation(resValue, columnsRelation);
|
|
213
|
+
forEachColumnsRelation(resValue, columnsRelation, func);
|
|
187
214
|
}
|
|
188
215
|
}
|
|
189
216
|
}
|
|
190
217
|
}
|
|
191
218
|
}
|
|
192
219
|
|
|
193
|
-
|
|
194
220
|
public copyColumnRelationToRow(row: any, multiKeyMap: MultiKeyMap, columnRelation: ColumnRelation) {
|
|
195
221
|
const { relatedCode, sourceColumn, targetColumns } = columnRelation;
|
|
196
222
|
|
|
@@ -205,18 +231,14 @@ class CrudMixUtils {
|
|
|
205
231
|
|
|
206
232
|
const getValue = (code: string) => {
|
|
207
233
|
return multiKeyMap.getValue(relatedCode, code);
|
|
208
|
-
}
|
|
234
|
+
};
|
|
209
235
|
|
|
210
236
|
const isSetArray = copyByArraySourceValue(row, sourceValue, targetColumns, getValue);
|
|
211
237
|
if (!isSetArray) {
|
|
212
238
|
copyBySingleSourceValue(row, sourceValue, targetColumns, getValue);
|
|
213
239
|
}
|
|
214
|
-
|
|
215
240
|
}
|
|
216
241
|
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
242
|
/**
|
|
221
243
|
* 无relatedCode模式
|
|
222
244
|
* @param row
|
|
@@ -238,26 +260,24 @@ class CrudMixUtils {
|
|
|
238
260
|
if (!map) {
|
|
239
261
|
return null;
|
|
240
262
|
}
|
|
241
|
-
if (typeof map.get ===
|
|
263
|
+
if (typeof map.get === 'function') {
|
|
242
264
|
return map.get(`${code}`);
|
|
243
265
|
}
|
|
244
266
|
return map[code];
|
|
245
|
-
}
|
|
267
|
+
};
|
|
246
268
|
|
|
247
269
|
const isSetArray = copyByArraySourceValue(row, sourceValue, targetColumns, getValue);
|
|
248
270
|
if (!isSetArray) {
|
|
249
271
|
copyBySingleSourceValue(row, sourceValue, targetColumns, getValue);
|
|
250
272
|
}
|
|
251
|
-
|
|
252
273
|
}
|
|
253
274
|
|
|
254
|
-
|
|
255
275
|
/**
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
276
|
+
* 专门COPY用户信息到row上面。无relatedCode模式
|
|
277
|
+
* @param row
|
|
278
|
+
* @param map
|
|
279
|
+
* @param columnRelation
|
|
280
|
+
*/
|
|
261
281
|
public copyUserInfoToRowNoRelatedCode(row: any, map: Map<string, any>, columnRelation: ColumnRelation) {
|
|
262
282
|
const { targetColumns } = columnRelation;
|
|
263
283
|
if (!targetColumns) {
|