midway-fatcms 0.0.1-beta.63 → 0.0.1-beta.65
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 -122
- 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 +28 -28
- package/dist/controller/gateway/FileController.js +144 -144
- package/dist/controller/gateway/ProxyApiGatewayController.d.ts +18 -18
- package/dist/controller/gateway/ProxyApiGatewayController.js +78 -78
- package/dist/controller/gateway/PublicApiController.d.ts +31 -31
- package/dist/controller/gateway/PublicApiController.js +179 -179
- 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 +367 -367
- 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 +165 -165
- 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 +110 -110
- package/dist/libs/crud-pro/models/keys.js +154 -154
- 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 +125 -125
- 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 +355 -355
- 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 +54 -54
- 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 -69
- package/dist/libs/global-config/global-config.js +36 -36
- 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 +8 -7
- package/dist/libs/utils/parseConfig.js +47 -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 +133 -133
- 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 +104 -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 +263 -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 +121 -121
- package/dist/service/crudstd/CrudStdService.d.ts +70 -69
- package/dist/service/crudstd/CrudStdService.js +403 -392
- 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 +113 -113
- 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 +57 -57
- package/dist/service/curd/CurdMixUtils.js +331 -331
- 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 -87
- package/src/controller/manage/DocLibManageApi.ts +5 -5
- package/src/controller/manage/FileManageApi.ts +5 -5
- package/src/controller/manage/MenuManageApi.ts +4 -4
- package/src/libs/utils/parseConfig.ts +4 -0
- package/src/models/bizmodels.ts +8 -2
- package/src/service/AuthService.ts +6 -1
- package/src/service/EnumInfoService.ts +1 -1
- package/src/service/crudstd/CrudStdService.ts +15 -2
- package/src/service/proxyapi/WeightedRandom.ts +1 -1
- package/src/service/proxyapi/WeightedRoundRobin.ts +1 -1
- package/tsconfig.json +32 -32
|
@@ -1,392 +1,403 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.CrudStdService = exports.SPECIAL_SETTING_KEY = void 0;
|
|
13
|
-
/* eslint-disable prettier/prettier */
|
|
14
|
-
const _ = require("lodash");
|
|
15
|
-
const ejs = require("ejs");
|
|
16
|
-
const core_1 = require("@midwayjs/core");
|
|
17
|
-
const CurdMixService_1 = require("../curd/CurdMixService");
|
|
18
|
-
const keys_1 = require("../../libs/crud-pro/models/keys");
|
|
19
|
-
const functions_1 = require("../../libs/utils/functions");
|
|
20
|
-
const devops_1 = require("../../models/devops");
|
|
21
|
-
const SystemTables_1 = require("../../models/SystemTables");
|
|
22
|
-
const CrudStdActionService_1 = require("./CrudStdActionService");
|
|
23
|
-
const CrudStdRelationService_1 = require("./CrudStdRelationService");
|
|
24
|
-
const ApiBaseService_1 = require("../base/ApiBaseService");
|
|
25
|
-
const DatabaseName_1 = require("../../libs/crud-pro/utils/DatabaseName");
|
|
26
|
-
const global_config_1 = require("../../libs/global-config/global-config");
|
|
27
|
-
const MixinUtils_1 = require("../../libs/crud-pro/utils/MixinUtils");
|
|
28
|
-
exports.SPECIAL_SETTING_KEY = {
|
|
29
|
-
QUERY_LIST: 'QUERY_LIST',
|
|
30
|
-
QUERY_ONE: 'QUERY_ONE',
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
const
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
const
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
//
|
|
88
|
-
await this.
|
|
89
|
-
//
|
|
90
|
-
await this.
|
|
91
|
-
//
|
|
92
|
-
await this.
|
|
93
|
-
//
|
|
94
|
-
await this.
|
|
95
|
-
//
|
|
96
|
-
await
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
await this.
|
|
100
|
-
//
|
|
101
|
-
await
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
const
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
*
|
|
153
|
-
* @
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
const
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
const
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
appInfo.settingKeyActionCfg =
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
const
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
//
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
if (
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
//
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
]
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
(
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
(
|
|
391
|
-
], CrudStdService);
|
|
392
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.CrudStdService = exports.SPECIAL_SETTING_KEY = void 0;
|
|
13
|
+
/* eslint-disable prettier/prettier */
|
|
14
|
+
const _ = require("lodash");
|
|
15
|
+
const ejs = require("ejs");
|
|
16
|
+
const core_1 = require("@midwayjs/core");
|
|
17
|
+
const CurdMixService_1 = require("../curd/CurdMixService");
|
|
18
|
+
const keys_1 = require("../../libs/crud-pro/models/keys");
|
|
19
|
+
const functions_1 = require("../../libs/utils/functions");
|
|
20
|
+
const devops_1 = require("../../models/devops");
|
|
21
|
+
const SystemTables_1 = require("../../models/SystemTables");
|
|
22
|
+
const CrudStdActionService_1 = require("./CrudStdActionService");
|
|
23
|
+
const CrudStdRelationService_1 = require("./CrudStdRelationService");
|
|
24
|
+
const ApiBaseService_1 = require("../base/ApiBaseService");
|
|
25
|
+
const DatabaseName_1 = require("../../libs/crud-pro/utils/DatabaseName");
|
|
26
|
+
const global_config_1 = require("../../libs/global-config/global-config");
|
|
27
|
+
const MixinUtils_1 = require("../../libs/crud-pro/utils/MixinUtils");
|
|
28
|
+
exports.SPECIAL_SETTING_KEY = {
|
|
29
|
+
QUERY_LIST: 'QUERY_LIST',
|
|
30
|
+
QUERY_ONE: 'QUERY_ONE',
|
|
31
|
+
KANBAN_VIEW_STATUS_UPDATE: 'KANBAN_VIEW_STATUS_UPDATE', // 看板视图中更新状态
|
|
32
|
+
};
|
|
33
|
+
function isNotEmptyStr(str) {
|
|
34
|
+
return typeof str === 'string' && str.trim().length > 0;
|
|
35
|
+
}
|
|
36
|
+
function getExecuteTableNameBySettingKey(appInfo, stdAction, sqlSimpleName) {
|
|
37
|
+
const { settingKey } = stdAction || {};
|
|
38
|
+
const stdCrudCfgObj = appInfo.stdCrudCfgObj;
|
|
39
|
+
const actionsMap = appInfo.actionsMap || {};
|
|
40
|
+
// 操作按钮单独设置了mainTableName字段
|
|
41
|
+
const actionCfg = actionsMap[settingKey];
|
|
42
|
+
if (actionCfg) {
|
|
43
|
+
const mainTableName = _.get(actionCfg, 'component.props.mainTableName');
|
|
44
|
+
if (isNotEmptyStr(mainTableName)) {
|
|
45
|
+
return mainTableName.trim();
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
if (sqlSimpleName === keys_1.KeysOfSimpleSQL.SIMPLE_DELETE || sqlSimpleName === keys_1.KeysOfSimpleSQL.SIMPLE_INSERT || sqlSimpleName === keys_1.KeysOfSimpleSQL.SIMPLE_UPDATE) {
|
|
49
|
+
// 全局配置了mainTableName字段
|
|
50
|
+
const globalMainTableName = _.get(stdCrudCfgObj, 'othersSetting.values.globalMainTableName');
|
|
51
|
+
if (isNotEmptyStr(globalMainTableName)) {
|
|
52
|
+
return globalMainTableName.trim();
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
// 视图中配置的表。
|
|
56
|
+
return stdCrudCfgObj.tableBaseInfo.tableName;
|
|
57
|
+
}
|
|
58
|
+
let CrudStdService = class CrudStdService extends ApiBaseService_1.ApiBaseService {
|
|
59
|
+
/**
|
|
60
|
+
* 执行普通CRUD
|
|
61
|
+
*/
|
|
62
|
+
async executeStdQuery(stdAction, params, sqlSimpleName) {
|
|
63
|
+
var _a;
|
|
64
|
+
const appCode = stdAction.appCode;
|
|
65
|
+
const appInfo = await this.getParsedCrudStdAppForSettingKey(stdAction);
|
|
66
|
+
const stdCrudCfgObj = appInfo.stdCrudCfgObj;
|
|
67
|
+
if (!appInfo || appInfo.status !== 1) {
|
|
68
|
+
throw new devops_1.BizException('应用不存在或已下线:' + appCode);
|
|
69
|
+
}
|
|
70
|
+
const databaseName = stdCrudCfgObj.tableBaseInfo.databaseName;
|
|
71
|
+
const { dbType, dbName } = (0, DatabaseName_1.parseDatabaseName)(databaseName);
|
|
72
|
+
const cfgModel = {
|
|
73
|
+
sqlDatabase: dbName,
|
|
74
|
+
sqlDbType: dbType,
|
|
75
|
+
sqlTable: getExecuteTableNameBySettingKey(appInfo, stdAction, sqlSimpleName),
|
|
76
|
+
sqlSimpleName,
|
|
77
|
+
updateCfg: {}
|
|
78
|
+
};
|
|
79
|
+
// 接口返回最大值
|
|
80
|
+
const maxLimit = _.get(stdCrudCfgObj, 'othersSetting.values.maxLimit');
|
|
81
|
+
if (typeof maxLimit === 'number' && maxLimit > 0) {
|
|
82
|
+
cfgModel.maxLimit = maxLimit;
|
|
83
|
+
}
|
|
84
|
+
if (!((_a = appInfo.settingKeyActionCfg) === null || _a === void 0 ? void 0 : _a.hasOperationPerm)) {
|
|
85
|
+
throw new devops_1.BizException('没有权限');
|
|
86
|
+
}
|
|
87
|
+
// 软删除操作。
|
|
88
|
+
await this.fixCfgModelAndParamBySoftDelete(params, cfgModel, appInfo, sqlSimpleName);
|
|
89
|
+
// 根据用户配置,设置关联查询的数据信息。
|
|
90
|
+
await this.crudStdRelationService.addCfgModelColumnsRelation(cfgModel, appInfo);
|
|
91
|
+
// 根据FilterValue参数,设置updateCfg
|
|
92
|
+
await this.fixCfgModelByFilterValue(params, cfgModel, appInfo, { dbType, dbName });
|
|
93
|
+
// 根据用户配置的keepSubmitData字段修改提交的数据
|
|
94
|
+
await this.fixSubmitDataByKeepSubmitData(params, cfgModel, appInfo, { dbType, dbName });
|
|
95
|
+
// 根据表结构的数据类型,修正数据类型
|
|
96
|
+
await this.fixDataFieldTypeBySqlTableField(params, cfgModel, appInfo, { dbType, dbName });
|
|
97
|
+
// 业务系统自定义的修改:查询前的查询条件:cfgModel
|
|
98
|
+
await global_config_1.GLOBAL_STATIC_CONFIG.getConfig().bizUpdateCfgModelForCrudStd(params, cfgModel, appInfo, this.ctx);
|
|
99
|
+
const crudExeCtx = await this.curdMixService.executeCrudByCfg(params, cfgModel);
|
|
100
|
+
// 处理结果
|
|
101
|
+
await this.handleResult(stdAction, params, cfgModel, appInfo, crudExeCtx);
|
|
102
|
+
// 业务系统自定义的修改:查询后的返回值。
|
|
103
|
+
await global_config_1.GLOBAL_STATIC_CONFIG.getConfig().bizUpdateExecuteContextForCrudStd(params, cfgModel, appInfo, this.ctx, crudExeCtx);
|
|
104
|
+
return crudExeCtx;
|
|
105
|
+
}
|
|
106
|
+
async handleResult(stdAction, params, cfgModel, appInfo, crudExeCtx) {
|
|
107
|
+
await this.handleResultDataPermissionBySettingKey(stdAction, params, cfgModel, appInfo, crudExeCtx);
|
|
108
|
+
}
|
|
109
|
+
async handleResultDataPermissionBySettingKey(stdAction, params, cfgModel, appInfo, crudExeCtx) {
|
|
110
|
+
const { settingKey } = stdAction || {};
|
|
111
|
+
if (settingKey !== exports.SPECIAL_SETTING_KEY.QUERY_LIST && settingKey !== exports.SPECIAL_SETTING_KEY.QUERY_ONE) {
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
const rows = crudExeCtx.getResRows();
|
|
115
|
+
if (!Array.isArray(rows)) {
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
const actionColumns = _.get(appInfo, 'stdCrudCfgObj.actionColumns');
|
|
119
|
+
const checkDataPermissionObjBySettingKey = (record) => {
|
|
120
|
+
var _a, _b;
|
|
121
|
+
const permissionObj = {};
|
|
122
|
+
let count = 0;
|
|
123
|
+
const sessionInfo = ((_b = (_a = this.ctx) === null || _a === void 0 ? void 0 : _a.userSession) === null || _b === void 0 ? void 0 : _b.getSessionInfo()) || {};
|
|
124
|
+
for (let index = 0; index < actionColumns.length; index++) {
|
|
125
|
+
const column = actionColumns[index];
|
|
126
|
+
const rowAuthCfg = (0, functions_1.parseJsonObject)(column.rowAuthCfg);
|
|
127
|
+
if (rowAuthCfg && typeof rowAuthCfg.authByExpress === 'string') {
|
|
128
|
+
const authByExpress = rowAuthCfg.authByExpress.trim();
|
|
129
|
+
if (authByExpress) {
|
|
130
|
+
const authResult = ejs.render(authByExpress, { record, sessionInfo, params, _ });
|
|
131
|
+
permissionObj[column.settingKey] = authResult;
|
|
132
|
+
count++;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
if (count > 0) {
|
|
137
|
+
return permissionObj;
|
|
138
|
+
}
|
|
139
|
+
return null;
|
|
140
|
+
};
|
|
141
|
+
if (Array.isArray(actionColumns) && actionColumns.length > 0) {
|
|
142
|
+
for (let index = 0; index < rows.length; index++) {
|
|
143
|
+
const row = rows[index];
|
|
144
|
+
const dataPermissionObjBySettingKey = checkDataPermissionObjBySettingKey(row);
|
|
145
|
+
if (dataPermissionObjBySettingKey) {
|
|
146
|
+
row['__dataPermissionObjBySettingKey'] = dataPermissionObjBySettingKey;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* 获取appInfo 并且拿到当前settingKey相关的信息
|
|
153
|
+
* @param appCode
|
|
154
|
+
* @param settingKey
|
|
155
|
+
* @private
|
|
156
|
+
*/
|
|
157
|
+
async getParsedCrudStdAppForSettingKey(stdAction) {
|
|
158
|
+
const { appCode, settingKey, buttonSettingKey } = stdAction || {};
|
|
159
|
+
if (!appCode) {
|
|
160
|
+
throw new devops_1.BizException('缺少参数:curdStdAppCode');
|
|
161
|
+
}
|
|
162
|
+
const appInfo = await this.getParsedCrudStdAppInfo(appCode);
|
|
163
|
+
if (!appInfo) {
|
|
164
|
+
return null;
|
|
165
|
+
}
|
|
166
|
+
const actionsMap = appInfo.actionsMap;
|
|
167
|
+
const appSchema = appInfo.stdCrudCfgObj;
|
|
168
|
+
// 看板视图中更新状态
|
|
169
|
+
if (settingKey === exports.SPECIAL_SETTING_KEY.KANBAN_VIEW_STATUS_UPDATE) {
|
|
170
|
+
const kanbanAuthSettingValues = _.get(appSchema, 'kanbanAuthSetting.values');
|
|
171
|
+
const { update_auth_type, update_auth_config_by_func_code, update_auth_config_by_role_code } = (kanbanAuthSettingValues || {});
|
|
172
|
+
const authConfig = update_auth_type === 'byFuncCode' ? update_auth_config_by_func_code : update_auth_config_by_role_code;
|
|
173
|
+
const hasOperationPerm = this.ctx.userSession.isAuthPass(update_auth_type, authConfig);
|
|
174
|
+
appInfo.settingKeyActionCfg = { settingKey, hasOperationPerm };
|
|
175
|
+
}
|
|
176
|
+
// 列表查询或详情查询
|
|
177
|
+
else if (settingKey === exports.SPECIAL_SETTING_KEY.QUERY_LIST || settingKey === exports.SPECIAL_SETTING_KEY.QUERY_ONE) {
|
|
178
|
+
const authSettingValues = _.get(appSchema, 'authSetting.values');
|
|
179
|
+
const { auth_type, auth_config_by_func_code, auth_config_by_role_code } = authSettingValues || {};
|
|
180
|
+
const authConfig = auth_type === 'byFuncCode' ? auth_config_by_func_code : auth_config_by_role_code;
|
|
181
|
+
const hasOperationPerm = this.ctx.userSession.isAuthPass(auth_type, authConfig);
|
|
182
|
+
appInfo.settingKeyActionCfg = { settingKey, hasOperationPerm };
|
|
183
|
+
}
|
|
184
|
+
else {
|
|
185
|
+
const actionCfg = actionsMap[settingKey];
|
|
186
|
+
if (!actionCfg) {
|
|
187
|
+
throw new devops_1.BizException('没有找到相关配置:' + JSON.stringify({ appCode, settingKey }));
|
|
188
|
+
}
|
|
189
|
+
const componentNameCfg = _.get(actionCfg, 'component.componentName');
|
|
190
|
+
if (!componentNameCfg) {
|
|
191
|
+
throw new devops_1.BizException('没有配置动作组件:' + JSON.stringify({ appCode, settingKey }));
|
|
192
|
+
}
|
|
193
|
+
appInfo.settingKeyActionCfg = actionCfg;
|
|
194
|
+
}
|
|
195
|
+
if (buttonSettingKey) {
|
|
196
|
+
appInfo.buttonSettingKeyActionCfg = actionsMap[buttonSettingKey];
|
|
197
|
+
}
|
|
198
|
+
return appInfo;
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* 执行动作
|
|
202
|
+
* @param stdAction
|
|
203
|
+
* @param params
|
|
204
|
+
*/
|
|
205
|
+
async executeStdActionByReq(stdAction, params) {
|
|
206
|
+
const appInfo = await this.getParsedCrudStdAppForSettingKey(stdAction);
|
|
207
|
+
if (!appInfo || appInfo.status !== 1) {
|
|
208
|
+
throw new devops_1.BizException('应用不存在或已下线:' + stdAction.appCode);
|
|
209
|
+
}
|
|
210
|
+
const actionsMap = appInfo.actionsMap;
|
|
211
|
+
const actionCfg = appInfo.settingKeyActionCfg;
|
|
212
|
+
return this.crudStdActionService.handleStdActionByReq({ appInfo, params, actionsMap, actionCfg });
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* 查询APP信息
|
|
216
|
+
* @param appCode
|
|
217
|
+
* @private
|
|
218
|
+
*/
|
|
219
|
+
async getCrudStdAppInfo(appCode) {
|
|
220
|
+
const { SystemDbName, SystemDbType } = global_config_1.GLOBAL_STATIC_CONFIG.getConfig();
|
|
221
|
+
this.logInfo('getCrudStdAppInfo', appCode);
|
|
222
|
+
const ss = {
|
|
223
|
+
sqlTable: SystemTables_1.SystemTables.sys_app,
|
|
224
|
+
sqlSimpleName: keys_1.KeysOfSimpleSQL.SIMPLE_QUERY_ONE,
|
|
225
|
+
sqlDatabase: SystemDbName,
|
|
226
|
+
sqlDbType: SystemDbType,
|
|
227
|
+
};
|
|
228
|
+
return await this.curdMixService.executeCrudByCfg({ condition: { app_code: appCode } }, ss);
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* 查询APP信息
|
|
232
|
+
* @param appCode
|
|
233
|
+
* @private
|
|
234
|
+
*/
|
|
235
|
+
async getParsedCrudStdAppInfo(appCode) {
|
|
236
|
+
const cacheKey = 'getParsedCrudStdAppInfo:' + appCode;
|
|
237
|
+
let appInfo = this.getFromCtxCache(cacheKey);
|
|
238
|
+
if (!appInfo) {
|
|
239
|
+
appInfo = await this.getParsedCrudStdAppInfoPrivate(appCode);
|
|
240
|
+
this.setToCtxCache(cacheKey, appInfo);
|
|
241
|
+
}
|
|
242
|
+
return appInfo;
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* 查询APP信息
|
|
246
|
+
* @param appCode
|
|
247
|
+
* @private
|
|
248
|
+
*/
|
|
249
|
+
async getParsedCrudStdAppInfoPrivate(appCode) {
|
|
250
|
+
const a = await this.getCrudStdAppInfo(appCode);
|
|
251
|
+
const { row } = a.getResModel();
|
|
252
|
+
if (!row) {
|
|
253
|
+
return null;
|
|
254
|
+
}
|
|
255
|
+
const { app_schema, ...others } = row;
|
|
256
|
+
const stdCrudCfgObj = (0, functions_1.parseJsonObject)(app_schema);
|
|
257
|
+
const handleArrayCfg = (arrayCfg) => {
|
|
258
|
+
if (Array.isArray(arrayCfg)) {
|
|
259
|
+
for (let j = 0; j < arrayCfg.length; j++) {
|
|
260
|
+
const actionCfg = arrayCfg[j];
|
|
261
|
+
actionCfg.hasOperationPerm = this.hasOperationPerm(actionCfg);
|
|
262
|
+
if (actionCfg.settingKey) {
|
|
263
|
+
actionsMap[actionCfg.settingKey] = actionCfg;
|
|
264
|
+
}
|
|
265
|
+
const submitButtonCfg = _.get(actionCfg, 'component.props.submitButtonCfg');
|
|
266
|
+
handleArrayCfg(submitButtonCfg);
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
};
|
|
270
|
+
// 为了方便查找到action对象
|
|
271
|
+
const actionsMap = {};
|
|
272
|
+
const keys = Object.keys(stdCrudCfgObj);
|
|
273
|
+
for (let i = 0; i < keys.length; i++) {
|
|
274
|
+
const key = keys[i];
|
|
275
|
+
const arrayCfg = stdCrudCfgObj[key];
|
|
276
|
+
handleArrayCfg(arrayCfg);
|
|
277
|
+
}
|
|
278
|
+
return { ...others, stdCrudCfgObj, actionsMap };
|
|
279
|
+
}
|
|
280
|
+
hasOperationPerm(actionCfg) {
|
|
281
|
+
const permissionCode = _.get(actionCfg, 'permissionCode');
|
|
282
|
+
if (permissionCode) {
|
|
283
|
+
return this.ctx.userSession.isAuthPass(keys_1.KeysOfAuthType.byFuncCode, permissionCode);
|
|
284
|
+
}
|
|
285
|
+
return true; // 无需鉴权
|
|
286
|
+
}
|
|
287
|
+
async fixCfgModelAndParamBySoftDelete(params, cfgModel, appInfo, sqlSimpleName) {
|
|
288
|
+
var _a, _b;
|
|
289
|
+
const stdCrudCfgObj = appInfo.stdCrudCfgObj;
|
|
290
|
+
//删除策略
|
|
291
|
+
const deleteStrategy = _.get(stdCrudCfgObj, 'othersSetting.values.deleteStrategy');
|
|
292
|
+
if (deleteStrategy !== 'soft') {
|
|
293
|
+
return;
|
|
294
|
+
}
|
|
295
|
+
// 删除操作,如果是软删除修改为update语句。
|
|
296
|
+
// 标准软删除:deleted_at 字段为0代表未删除,有任意时间字段代表已删除。
|
|
297
|
+
if (keys_1.KeysOfSimpleSQL.SIMPLE_DELETE === sqlSimpleName) {
|
|
298
|
+
const userSession = (_b = (_a = this.ctx) === null || _a === void 0 ? void 0 : _a.userSession) === null || _b === void 0 ? void 0 : _b.getSessionInfo();
|
|
299
|
+
if (!params.data) {
|
|
300
|
+
params.data = {};
|
|
301
|
+
}
|
|
302
|
+
params.data.deleted_at = Date.now(); // 默认值为 0; 0代表未删除
|
|
303
|
+
params.data.deleted_by = (userSession === null || userSession === void 0 ? void 0 : userSession.accountId) || "";
|
|
304
|
+
// 执行update操作
|
|
305
|
+
cfgModel.sqlSimpleName = keys_1.KeysOfSimpleSQL.SIMPLE_UPDATE;
|
|
306
|
+
if (!params.condition || Object.keys(params.condition).length === 0) {
|
|
307
|
+
throw new Error('执行删除操作,必须指定删除条件');
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
// 查询操作。强制查询未删除的。
|
|
311
|
+
if (keys_1.KeysOfSimpleSQL.SIMPLE_QUERY_ONE === sqlSimpleName || keys_1.KeysOfSimpleSQL.SIMPLE_QUERY_PAGE === sqlSimpleName) {
|
|
312
|
+
if (!params.condition) {
|
|
313
|
+
params.condition = {};
|
|
314
|
+
}
|
|
315
|
+
params.condition.deleted_at = 0; // 未删除
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
async fixCfgModelByFilterValue(params, cfgModel, appInfo, arg3) {
|
|
319
|
+
const { filterValue } = params || {};
|
|
320
|
+
if (!filterValue && filterValue !== 0) {
|
|
321
|
+
return;
|
|
322
|
+
}
|
|
323
|
+
const filterList = _.get(appInfo, 'stdCrudCfgObj.filterList');
|
|
324
|
+
if (!Array.isArray(filterList) || filterList.length === 0) {
|
|
325
|
+
this.logWarn('filterValue存在,但是filterList没有设置');
|
|
326
|
+
return;
|
|
327
|
+
}
|
|
328
|
+
const filterItem = filterList.find(item => item.value === filterValue);
|
|
329
|
+
if (!filterItem) {
|
|
330
|
+
this.logWarn('filterValue存在,但是filterList中没有找到此配置项');
|
|
331
|
+
return;
|
|
332
|
+
}
|
|
333
|
+
const partialCondition = _.get(filterItem, 'partialCondition');
|
|
334
|
+
if (!partialCondition) {
|
|
335
|
+
this.logWarn('filterValue存在,但是filterList中的配置项没有设置partialCondition');
|
|
336
|
+
return;
|
|
337
|
+
}
|
|
338
|
+
const partialConditionObj = (0, functions_1.parseJsonObject)(partialCondition);
|
|
339
|
+
if (Object.keys(partialConditionObj).length > 0) {
|
|
340
|
+
// partialConditionObj 配置的是 condition.xxxx = xx的形式
|
|
341
|
+
_.merge(cfgModel.updateCfg, partialConditionObj);
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
async fixSubmitDataByKeepSubmitData(params, cfgModel, appInfo, arg3) {
|
|
345
|
+
if (cfgModel.sqlSimpleName === keys_1.KeysOfSimpleSQL.SIMPLE_INSERT || cfgModel.sqlSimpleName === keys_1.KeysOfSimpleSQL.SIMPLE_UPDATE) {
|
|
346
|
+
const submitData = params.data || {};
|
|
347
|
+
//1. 按钮中配置的keepSubmitData
|
|
348
|
+
const buttonActionCfg = appInfo.buttonSettingKeyActionCfg || {};
|
|
349
|
+
const keepSubmitDataByButtonStr = _.get(buttonActionCfg, 'keepSubmitData');
|
|
350
|
+
const keepSubmitDataByButton = (0, functions_1.parseJsonObject)(keepSubmitDataByButtonStr);
|
|
351
|
+
//2. 全局配置的keepSubmitData
|
|
352
|
+
const keepSubmitDataByGlobalStr = _.get(appInfo, 'stdCrudCfgObj.othersSetting.values.keepSubmitData');
|
|
353
|
+
const keepSubmitDataByGlobal = (0, functions_1.parseJsonObject)(keepSubmitDataByGlobalStr);
|
|
354
|
+
//3. 合并
|
|
355
|
+
_.merge(submitData, keepSubmitDataByButton);
|
|
356
|
+
_.merge(submitData, keepSubmitDataByGlobal);
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
async fixDataFieldTypeBySqlTableField(params, cfgModel, appInfo, arg3) {
|
|
360
|
+
const tableFields = _.get(appInfo, 'stdCrudCfgObj.tableFields');
|
|
361
|
+
const tableFieldMap = MixinUtils_1.MixinUtils.toMap(tableFields, (e) => {
|
|
362
|
+
return e.fieldIndex;
|
|
363
|
+
});
|
|
364
|
+
if (arg3.dbType === keys_1.SqlDbType.postgres) {
|
|
365
|
+
if (cfgModel.sqlSimpleName === keys_1.KeysOfSimpleSQL.SIMPLE_INSERT || cfgModel.sqlSimpleName === keys_1.KeysOfSimpleSQL.SIMPLE_UPDATE) {
|
|
366
|
+
const data = params.data || {};
|
|
367
|
+
const dataKeys = Object.keys(data);
|
|
368
|
+
for (let index = 0; index < dataKeys.length; index++) {
|
|
369
|
+
const dataKey = dataKeys[index];
|
|
370
|
+
const dataValue = data[dataKey];
|
|
371
|
+
const fieldInfo = tableFieldMap[dataKey];
|
|
372
|
+
const fieldType = ('' + _.get(fieldInfo, 'type')).toUpperCase();
|
|
373
|
+
if (fieldType === 'ARRAY') {
|
|
374
|
+
const dataValueArray = (0, functions_1.parseJsonObject)(dataValue);
|
|
375
|
+
if (Array.isArray(dataValueArray)) {
|
|
376
|
+
data[dataKey] = `{${dataValueArray.map(v => `"${v}"`).join(',')}}`;
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
};
|
|
384
|
+
__decorate([
|
|
385
|
+
(0, core_1.Inject)(),
|
|
386
|
+
__metadata("design:type", Object)
|
|
387
|
+
], CrudStdService.prototype, "ctx", void 0);
|
|
388
|
+
__decorate([
|
|
389
|
+
(0, core_1.Inject)(),
|
|
390
|
+
__metadata("design:type", CurdMixService_1.CurdMixService)
|
|
391
|
+
], CrudStdService.prototype, "curdMixService", void 0);
|
|
392
|
+
__decorate([
|
|
393
|
+
(0, core_1.Inject)(),
|
|
394
|
+
__metadata("design:type", CrudStdActionService_1.CrudStdActionService)
|
|
395
|
+
], CrudStdService.prototype, "crudStdActionService", void 0);
|
|
396
|
+
__decorate([
|
|
397
|
+
(0, core_1.Inject)(),
|
|
398
|
+
__metadata("design:type", CrudStdRelationService_1.CrudStdRelationService)
|
|
399
|
+
], CrudStdService.prototype, "crudStdRelationService", void 0);
|
|
400
|
+
CrudStdService = __decorate([
|
|
401
|
+
(0, core_1.Provide)()
|
|
402
|
+
], CrudStdService);
|
|
403
|
+
exports.CrudStdService = CrudStdService;
|