midway-fatcms 0.0.1-beta.2 → 0.0.1-beta.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.json +12 -0
- package/.prettierrc.js +4 -0
- package/README.md +7 -0
- package/dist/config/config.default.js +52 -15
- package/dist/configuration.d.ts +1 -0
- package/dist/configuration.js +33 -8
- package/dist/controller/base/BaseApiController.d.ts +1 -1
- package/dist/controller/base/BaseApiController.js +14 -6
- package/dist/controller/gateway/AsyncTaskController.d.ts +14 -0
- package/dist/controller/gateway/AsyncTaskController.js +108 -0
- package/dist/controller/gateway/CrudMtdGatewayController.d.ts +3 -3
- package/dist/controller/gateway/CrudMtdGatewayController.js +9 -6
- package/dist/controller/gateway/CrudStdGatewayController.d.ts +5 -5
- package/dist/controller/gateway/DocGatewayController.js +14 -9
- package/dist/controller/gateway/PublicApiController.js +4 -6
- package/dist/controller/gateway/StaticController.d.ts +2 -0
- package/dist/controller/gateway/StaticController.js +59 -40
- package/dist/controller/helpers.controller.d.ts +1 -1
- package/dist/controller/home.controller.js +2 -2
- package/dist/controller/manage/AnyApiMangeApi.js +2 -2
- package/dist/controller/manage/AppLogMangeApi.js +2 -2
- package/dist/controller/manage/AppMangeApi.js +2 -2
- package/dist/controller/manage/AppPageMangeApi.js +2 -2
- package/dist/controller/manage/AppSchemaHistoryApi.js +2 -2
- package/dist/controller/manage/CrudMethodsMangeApi.js +2 -2
- package/dist/controller/manage/CrudStandardDesignApi.d.ts +1 -1
- package/dist/controller/manage/CrudStandardDesignApi.js +78 -75
- package/dist/controller/manage/DataDictManageApi.d.ts +1 -1
- package/dist/controller/manage/DataDictManageApi.js +1 -1
- package/dist/controller/manage/DeployManageApi.d.ts +1 -1
- package/dist/controller/manage/DeployManageApi.js +38 -34
- package/dist/controller/manage/DocLibManageApi.js +2 -2
- package/dist/controller/manage/DocManageApi.js +2 -2
- package/dist/controller/manage/FileManageApi.js +1 -1
- package/dist/controller/manage/LowCodeTplManageApi.js +2 -2
- package/dist/controller/manage/MenuManageApi.js +2 -2
- package/dist/controller/manage/ProxyApiMangeApi.js +2 -2
- package/dist/controller/manage/SuperAdminManageApi.d.ts +2 -2
- package/dist/controller/manage/SuperAdminManageApi.js +12 -8
- package/dist/controller/manage/SysConfigMangeApi.d.ts +1 -1
- package/dist/controller/manage/SysConfigMangeApi.js +8 -6
- package/dist/controller/manage/SystemInfoManageApi.d.ts +1 -1
- package/dist/controller/manage/SystemInfoManageApi.js +7 -1
- package/dist/controller/manage/UserAccountManageApi.d.ts +2 -2
- package/dist/controller/manage/UserAccountManageApi.js +7 -2
- package/dist/controller/manage/WorkbenchMangeApi.js +3 -3
- package/dist/controller/myinfo/AuthController.d.ts +0 -4
- package/dist/controller/myinfo/AuthController.js +1 -54
- package/dist/controller/render/AppRenderController.js +10 -4
- package/dist/controller/test.controller.d.ts +1 -1
- package/dist/controller/test.controller.js +5 -5
- package/dist/index.d.ts +34 -4
- package/dist/index.js +34 -4
- package/dist/libs/crud-pro/CrudPro.d.ts +1 -0
- package/dist/libs/crud-pro/CrudPro.js +5 -0
- package/dist/libs/crud-pro/defaultConfigs.js +2 -0
- package/dist/libs/crud-pro/interfaces.d.ts +7 -1
- package/dist/libs/crud-pro/models/ExecuteContext.d.ts +2 -1
- package/dist/libs/crud-pro/models/ExecuteContextFunc.d.ts +8 -1
- package/dist/libs/crud-pro/models/ExecuteContextFunc.js +8 -0
- package/dist/libs/crud-pro/models/RequestCfgModel.d.ts +1 -1
- package/dist/libs/crud-pro/models/ResModel.d.ts +16 -0
- package/dist/libs/crud-pro/models/ResModel.js +2 -0
- package/dist/libs/crud-pro/models/SqlCfgModel.d.ts +1 -1
- package/dist/libs/crud-pro/models/TransactionSqlServer.js +1 -1
- package/dist/libs/crud-pro/services/CrudProCachedCfgService.d.ts +1 -0
- package/dist/libs/crud-pro/services/CrudProCachedCfgService.js +27 -15
- package/dist/libs/crud-pro/services/CrudProExecuteSqlService.js +13 -17
- package/dist/libs/crud-pro/services/CrudProGenSqlCondition.d.ts +1 -1
- package/dist/libs/crud-pro/services/CrudProGenSqlCondition.js +10 -12
- package/dist/libs/crud-pro/services/CrudProGenSqlService.js +14 -23
- package/dist/libs/crud-pro/services/CrudProOriginToExecuteSql.js +7 -6
- package/dist/libs/crud-pro/services/CrudProServiceBase.d.ts +2 -6
- package/dist/libs/crud-pro/services/CrudProServiceBase.js +3 -2
- package/dist/libs/crud-pro/services/CrudProTableMetaService.d.ts +1 -0
- package/dist/libs/crud-pro/services/CrudProTableMetaService.js +32 -7
- package/dist/libs/crud-pro/utils/DatabaseName.js +24 -3
- package/dist/libs/crud-pro/utils/MixinUtils.js +1 -1
- package/dist/libs/crud-pro/utils/ValidateUtils.js +1 -1
- package/dist/libs/crud-pro/utils/sqlConvert/convertColumnName.js +2 -2
- package/dist/libs/crud-pro/utils/sqlConvert/convertMix.d.ts +3 -0
- package/dist/libs/crud-pro/utils/sqlConvert/convertMix.js +22 -0
- package/dist/libs/global-config/global-config.d.ts +45 -0
- package/dist/libs/global-config/global-config.js +33 -0
- package/dist/libs/utils/errorToString.d.ts +2 -0
- package/dist/libs/utils/errorToString.js +57 -0
- package/dist/libs/utils/fatcms-request.js +2 -2
- package/dist/middleware/forbidden.middleware.js +4 -20
- package/dist/middleware/global.middleware.js +8 -1
- package/dist/models/AsyncTaskModel.d.ts +69 -0
- package/dist/models/AsyncTaskModel.js +26 -0
- package/dist/models/RedisKeys.d.ts +8 -0
- package/dist/models/RedisKeys.js +11 -0
- package/dist/models/SystemTables.d.ts +1 -3
- package/dist/models/SystemTables.js +2 -4
- package/dist/schedule/anonymousContext.d.ts +13 -0
- package/dist/schedule/anonymousContext.js +59 -0
- package/dist/schedule/index.d.ts +4 -3
- package/dist/schedule/index.js +8 -67
- package/dist/schedule/runSchedule.d.ts +15 -0
- package/dist/schedule/runSchedule.js +68 -0
- package/dist/schedule/scheduleNames.d.ts +13 -0
- package/dist/schedule/scheduleNames.js +17 -0
- package/dist/service/AuthService.js +8 -5
- package/dist/service/EnumInfoService.js +7 -4
- package/dist/service/FileCenterService.js +13 -9
- package/dist/service/SysConfigService.js +4 -2
- package/dist/service/UserAccountService.js +10 -6
- package/dist/service/UserSessionService.js +2 -1
- package/dist/service/VisitStatService.d.ts +1 -1
- package/dist/service/VisitStatService.js +20 -27
- package/dist/service/WorkbenchService.js +4 -2
- package/dist/service/anyapi/AnyApiService.js +4 -2
- package/dist/service/asyncTask/AsyncTaskRunnerService.d.ts +37 -0
- package/dist/service/asyncTask/AsyncTaskRunnerService.js +232 -0
- package/dist/service/asyncTask/AsyncTaskService.d.ts +7 -0
- package/dist/service/asyncTask/AsyncTaskService.js +34 -0
- package/dist/service/crudstd/CrudStdService.d.ts +2 -1
- package/dist/service/crudstd/CrudStdService.js +48 -3
- package/dist/service/curd/CrudProQuick.d.ts +24 -0
- package/dist/service/curd/CrudProQuick.js +105 -0
- package/dist/service/curd/CurdMixByAccountService.js +12 -6
- package/dist/service/curd/CurdMixByDictService.js +4 -2
- package/dist/service/curd/CurdMixByLinkToCustomService.d.ts +10 -1
- package/dist/service/curd/CurdMixByLinkToCustomService.js +72 -24
- package/dist/service/curd/CurdMixBySysConfigService.js +4 -2
- package/dist/service/curd/CurdMixByWorkbenchService.js +4 -2
- package/dist/service/curd/CurdMixService.d.ts +1 -1
- package/dist/service/curd/CurdMixService.js +2 -2
- package/dist/service/curd/CurdMixUtils.d.ts +7 -0
- package/dist/service/curd/CurdMixUtils.js +65 -28
- package/dist/service/curd/CurdProService.d.ts +2 -10
- package/dist/service/curd/CurdProService.js +31 -146
- package/dist/service/curd/fixCfgModel.d.ts +3 -0
- package/dist/service/curd/fixCfgModel.js +107 -0
- package/dist/service/proxyapi/ProxyApiLoadService.js +7 -4
- package/dist/views/404_app.html +31 -0
- package/dist/views/404_workbench.html +34 -0
- package/dist/views/static/favicon.ico +0 -0
- package/package.json +9 -2
- package/src/config/config.default.ts +58 -27
- package/src/configuration.ts +42 -9
- package/src/controller/base/BaseApiController.ts +26 -19
- package/src/controller/gateway/AnyApiGatewayController.ts +1 -1
- package/src/controller/gateway/AsyncTaskController.ts +83 -0
- package/src/controller/gateway/CrudMtdGatewayController.ts +17 -13
- package/src/controller/gateway/CrudStdGatewayController.ts +4 -4
- package/src/controller/gateway/DocGatewayController.ts +25 -17
- package/src/controller/gateway/FileController.ts +8 -9
- package/src/controller/gateway/ProxyApiGatewayController.ts +4 -4
- package/src/controller/gateway/PublicApiController.ts +19 -22
- package/src/controller/gateway/StaticController.ts +234 -242
- package/src/controller/helpers.controller.ts +1 -1
- package/src/controller/home.controller.ts +8 -15
- package/src/controller/manage/AnyApiMangeApi.ts +11 -11
- package/src/controller/manage/AppLogMangeApi.ts +5 -5
- package/src/controller/manage/AppMangeApi.ts +7 -7
- package/src/controller/manage/AppPageMangeApi.ts +5 -5
- package/src/controller/manage/AppSchemaHistoryApi.ts +3 -3
- package/src/controller/manage/CrudMethodsMangeApi.ts +5 -5
- package/src/controller/manage/CrudStandardDesignApi.ts +106 -113
- package/src/controller/manage/DataDictManageApi.ts +5 -5
- package/src/controller/manage/DeployManageApi.ts +85 -89
- package/src/controller/manage/DocLibManageApi.ts +5 -5
- package/src/controller/manage/DocManageApi.ts +10 -10
- package/src/controller/manage/FileManageApi.ts +1 -1
- package/src/controller/manage/LowCodeTplManageApi.ts +2 -2
- package/src/controller/manage/MenuManageApi.ts +10 -15
- package/src/controller/manage/ProxyApiMangeApi.ts +2 -2
- package/src/controller/manage/SuperAdminManageApi.ts +14 -13
- package/src/controller/manage/SysConfigMangeApi.ts +11 -11
- package/src/controller/manage/SystemInfoManageApi.ts +11 -6
- package/src/controller/manage/UserAccountManageApi.ts +10 -4
- package/src/controller/manage/WorkbenchMangeApi.ts +8 -8
- package/src/controller/myinfo/AuthController.ts +6 -72
- package/src/controller/render/AppRenderController.ts +24 -21
- package/src/controller/test.controller.ts +18 -18
- package/src/index.ts +38 -4
- package/src/libs/crud-pro/CrudPro.ts +7 -0
- package/src/libs/crud-pro/defaultConfigs.ts +2 -0
- package/src/libs/crud-pro/interfaces.ts +10 -3
- package/src/libs/crud-pro/models/ExecuteContext.ts +3 -3
- package/src/libs/crud-pro/models/ExecuteContextFunc.ts +11 -1
- package/src/libs/crud-pro/models/RequestCfgModel.ts +1 -1
- package/src/libs/crud-pro/models/RequestModel.ts +1 -1
- package/src/libs/crud-pro/models/ResModel.ts +19 -0
- package/src/libs/crud-pro/models/SqlCfgModel.ts +2 -2
- package/src/libs/crud-pro/models/Transaction.ts +8 -9
- package/src/libs/crud-pro/models/TransactionPostgres.ts +1 -1
- package/src/libs/crud-pro/models/TransactionSqlServer.ts +8 -13
- package/src/libs/crud-pro/services/CrudProCachedCfgService.ts +32 -23
- package/src/libs/crud-pro/services/CrudProExecuteSqlService.ts +38 -54
- package/src/libs/crud-pro/services/CrudProGenSqlCondition.ts +26 -45
- package/src/libs/crud-pro/services/CrudProGenSqlService.ts +23 -40
- package/src/libs/crud-pro/services/CrudProOriginToExecuteSql.ts +25 -29
- package/src/libs/crud-pro/services/CrudProServiceBase.ts +5 -9
- package/src/libs/crud-pro/services/CrudProTableMetaService.ts +36 -9
- package/src/libs/crud-pro/utils/DatabaseName.ts +35 -15
- package/src/libs/crud-pro/utils/DateTimeUtils.ts +2 -2
- package/src/libs/crud-pro/utils/MixinUtils.ts +1 -1
- package/src/libs/crud-pro/utils/ValidateUtils.ts +1 -3
- package/src/libs/crud-pro/utils/pool/MySQLUtils.ts +1 -1
- package/src/libs/crud-pro/utils/pool/PostgresUtils.ts +3 -3
- package/src/libs/crud-pro/utils/pool/SqlServerUtils.ts +3 -3
- package/src/libs/crud-pro/utils/sqlConvert/convertColumnName.ts +2 -2
- package/src/libs/crud-pro/utils/sqlConvert/convertMix.ts +26 -0
- package/src/libs/global-config/global-config.ts +78 -0
- package/src/libs/utils/crypto-utils.ts +2 -4
- package/src/libs/utils/errorToString.ts +61 -0
- package/src/libs/utils/fatcms-request.ts +9 -21
- package/src/libs/utils/ordernum-utils.ts +2 -6
- package/src/libs/utils/parseConfig.ts +7 -15
- package/src/middleware/forbidden.middleware.ts +6 -25
- package/src/middleware/global.middleware.ts +18 -16
- package/src/models/AsyncTaskModel.ts +79 -0
- package/src/models/RedisKeys.ts +13 -0
- package/src/models/SystemTables.ts +1 -4
- package/src/models/bizmodels.ts +1 -2
- package/src/schedule/anonymousContext.ts +79 -0
- package/src/schedule/index.ts +11 -72
- package/src/schedule/runSchedule.ts +83 -0
- package/src/schedule/scheduleNames.ts +21 -0
- package/src/service/AuthService.ts +13 -8
- package/src/service/EnumInfoService.ts +8 -3
- package/src/service/FileCenterService.ts +12 -6
- package/src/service/SysConfigService.ts +10 -6
- package/src/service/UserAccountService.ts +14 -4
- package/src/service/UserSessionService.ts +5 -4
- package/src/service/VisitStatService.ts +57 -70
- package/src/service/WorkbenchService.ts +7 -2
- package/src/service/anyapi/AnyApiService.ts +11 -8
- package/src/service/asyncTask/AsyncTaskRunnerService.ts +255 -0
- package/src/service/asyncTask/AsyncTaskService.ts +21 -0
- package/src/service/base/BaseService.ts +2 -2
- package/src/service/crudstd/CrudStdService.ts +60 -5
- package/src/service/curd/CrudProQuick.ts +137 -0
- package/src/service/curd/CurdMixByAccountService.ts +14 -6
- package/src/service/curd/CurdMixByDictService.ts +8 -2
- package/src/service/curd/CurdMixByLinkToCustomService.ts +101 -50
- package/src/service/curd/CurdMixBySysConfigService.ts +7 -2
- package/src/service/curd/CurdMixByWorkbenchService.ts +6 -2
- package/src/service/curd/CurdMixService.ts +3 -3
- package/src/service/curd/CurdMixUtils.ts +82 -39
- package/src/service/curd/CurdProService.ts +45 -189
- package/src/service/curd/fixCfgModel.ts +139 -0
- package/src/service/proxyapi/ProxyApiLoadService.ts +12 -3
- package/src/views/404_app.html +31 -0
- package/src/views/404_workbench.html +34 -0
- package/src/views/static/favicon.ico +0 -0
- package/tsconfig.json +32 -0
- package/dist/controller/medstatistic/MedAdminController.d.ts +0 -35
- package/dist/controller/medstatistic/MedAdminController.js +0 -205
- package/dist/controller/medstatistic/MedClientController.d.ts +0 -28
- package/dist/controller/medstatistic/MedClientController.js +0 -188
- package/dist/controller/medstatistic/MedMessageService.d.ts +0 -19
- package/dist/controller/medstatistic/MedMessageService.js +0 -95
- package/dist/controller/medstatistic/MedScoreService.d.ts +0 -21
- package/dist/controller/medstatistic/MedScoreService.js +0 -107
- package/dist/controller/medstatistic/constants.d.ts +0 -32
- package/dist/controller/medstatistic/constants.js +0 -43
- package/src/controller/medstatistic/MedAdminController.ts +0 -221
- package/src/controller/medstatistic/MedClientController.ts +0 -188
- package/src/controller/medstatistic/MedMessageService.ts +0 -89
- package/src/controller/medstatistic/MedScoreService.ts +0 -108
- package/src/controller/medstatistic/constants.ts +0 -63
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Controller, Inject, Post } from '@midwayjs/core';
|
|
2
2
|
import { Context } from '@midwayjs/koa';
|
|
3
|
-
import { KeysOfSimpleSQL, KeysOfValidators } from '
|
|
3
|
+
import { KeysOfSimpleSQL, KeysOfValidators } from '@/libs/crud-pro/models/keys';
|
|
4
4
|
import { BaseApiController } from '../base/BaseApiController';
|
|
5
|
-
import { checkPermission } from '
|
|
6
|
-
import {SystemFuncCode} from
|
|
5
|
+
import { checkPermission } from '@/middleware/permission.middleware';
|
|
6
|
+
import { SystemFuncCode } from '@/models/SystemPerm';
|
|
7
7
|
|
|
8
8
|
@Controller('/ns/api/manage/appLog', { middleware: [checkPermission(SystemFuncCode.AppMangeRead)] })
|
|
9
9
|
export class AppLogMangeApi extends BaseApiController {
|
|
@@ -35,7 +35,7 @@ export class AppLogMangeApi extends BaseApiController {
|
|
|
35
35
|
async updateAppLog() {
|
|
36
36
|
return this.executeSysSimpleSQL('sys_app_log', KeysOfSimpleSQL.SIMPLE_UPDATE, {
|
|
37
37
|
validateCfg: {
|
|
38
|
-
'condition.id': [KeysOfValidators.REQUIRED, KeysOfValidators.
|
|
38
|
+
'condition.id': [KeysOfValidators.REQUIRED, KeysOfValidators.NUMERIC],
|
|
39
39
|
'condition.app_code': [KeysOfValidators.REQUIRED, KeysOfValidators.STRING],
|
|
40
40
|
},
|
|
41
41
|
});
|
|
@@ -45,7 +45,7 @@ export class AppLogMangeApi extends BaseApiController {
|
|
|
45
45
|
async deleteAppLog() {
|
|
46
46
|
return this.executeSysSimpleSQL('sys_app_log', KeysOfSimpleSQL.SIMPLE_DELETE, {
|
|
47
47
|
validateCfg: {
|
|
48
|
-
'condition.id': [KeysOfValidators.REQUIRED, KeysOfValidators.
|
|
48
|
+
'condition.id': [KeysOfValidators.REQUIRED, KeysOfValidators.NUMERIC],
|
|
49
49
|
'condition.app_code': [KeysOfValidators.REQUIRED, KeysOfValidators.STRING],
|
|
50
50
|
},
|
|
51
51
|
});
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Controller, Inject, Post } from '@midwayjs/core';
|
|
2
2
|
import { Context } from '@midwayjs/koa';
|
|
3
|
-
import { KeysOfSimpleSQL, KeysOfValidators } from '
|
|
3
|
+
import { KeysOfSimpleSQL, KeysOfValidators } from '@/libs/crud-pro/models/keys';
|
|
4
4
|
import { BaseApiController } from '../base/BaseApiController';
|
|
5
|
-
import { checkPermission } from '
|
|
6
|
-
import { SystemFuncCode } from '
|
|
5
|
+
import { checkPermission } from '@/middleware/permission.middleware';
|
|
6
|
+
import { SystemFuncCode } from '@/models/SystemPerm';
|
|
7
7
|
|
|
8
8
|
@Controller('/ns/api/manage/app', { middleware: [checkPermission(SystemFuncCode.AppMangeRead)] })
|
|
9
9
|
export class AppMangeApi extends BaseApiController {
|
|
@@ -31,21 +31,21 @@ export class AppMangeApi extends BaseApiController {
|
|
|
31
31
|
});
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
@Post('/updateApp',{ middleware: [checkPermission(SystemFuncCode.AppMangeWrite)] })
|
|
34
|
+
@Post('/updateApp', { middleware: [checkPermission(SystemFuncCode.AppMangeWrite)] })
|
|
35
35
|
async updateApp() {
|
|
36
36
|
return this.executeSysSimpleSQL('sys_app', KeysOfSimpleSQL.SIMPLE_UPDATE, {
|
|
37
37
|
validateCfg: {
|
|
38
|
-
'condition.id': [KeysOfValidators.REQUIRED, KeysOfValidators.
|
|
38
|
+
'condition.id': [KeysOfValidators.REQUIRED, KeysOfValidators.NUMERIC],
|
|
39
39
|
'condition.app_code': [KeysOfValidators.REQUIRED, KeysOfValidators.STRING],
|
|
40
40
|
},
|
|
41
41
|
});
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
@Post('/deleteApp',{ middleware: [checkPermission(SystemFuncCode.AppMangeWrite)] })
|
|
44
|
+
@Post('/deleteApp', { middleware: [checkPermission(SystemFuncCode.AppMangeWrite)] })
|
|
45
45
|
async deleteApp() {
|
|
46
46
|
return this.executeSysSimpleSQL('sys_app', KeysOfSimpleSQL.SIMPLE_DELETE, {
|
|
47
47
|
validateCfg: {
|
|
48
|
-
'condition.id': [KeysOfValidators.REQUIRED, KeysOfValidators.
|
|
48
|
+
'condition.id': [KeysOfValidators.REQUIRED, KeysOfValidators.NUMERIC],
|
|
49
49
|
'condition.app_code': [KeysOfValidators.REQUIRED, KeysOfValidators.STRING],
|
|
50
50
|
},
|
|
51
51
|
});
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Controller, Inject, Post } from '@midwayjs/core';
|
|
2
2
|
import { Context } from '@midwayjs/koa';
|
|
3
|
-
import { KeysOfSimpleSQL, KeysOfValidators } from '
|
|
3
|
+
import { KeysOfSimpleSQL, KeysOfValidators } from '@/libs/crud-pro/models/keys';
|
|
4
4
|
import { BaseApiController } from '../base/BaseApiController';
|
|
5
|
-
import { checkPermission } from '
|
|
6
|
-
import { SystemFuncCode } from '
|
|
5
|
+
import { checkPermission } from '@/middleware/permission.middleware';
|
|
6
|
+
import { SystemFuncCode } from '@/models/SystemPerm';
|
|
7
7
|
|
|
8
8
|
@Controller('/ns/api/manage/appPage', { middleware: [checkPermission(SystemFuncCode.AppPageMangeRead)] })
|
|
9
9
|
export class AppPageMangeApi extends BaseApiController {
|
|
@@ -36,7 +36,7 @@ export class AppPageMangeApi extends BaseApiController {
|
|
|
36
36
|
async updateAppPage() {
|
|
37
37
|
return this.executeSysSimpleSQL('sys_app_page', KeysOfSimpleSQL.SIMPLE_UPDATE, {
|
|
38
38
|
validateCfg: {
|
|
39
|
-
'condition.id': [KeysOfValidators.REQUIRED, KeysOfValidators.
|
|
39
|
+
'condition.id': [KeysOfValidators.REQUIRED, KeysOfValidators.NUMERIC],
|
|
40
40
|
},
|
|
41
41
|
});
|
|
42
42
|
}
|
|
@@ -45,7 +45,7 @@ export class AppPageMangeApi extends BaseApiController {
|
|
|
45
45
|
async deleteAppPage() {
|
|
46
46
|
return this.executeSysSimpleSQL('sys_app_page', KeysOfSimpleSQL.SIMPLE_DELETE, {
|
|
47
47
|
validateCfg: {
|
|
48
|
-
'condition.id': [KeysOfValidators.REQUIRED, KeysOfValidators.
|
|
48
|
+
'condition.id': [KeysOfValidators.REQUIRED, KeysOfValidators.NUMERIC],
|
|
49
49
|
},
|
|
50
50
|
});
|
|
51
51
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Controller, Inject, Post } from '@midwayjs/core';
|
|
2
2
|
import { Context } from '@midwayjs/koa';
|
|
3
|
-
import { KeysOfSimpleSQL, KeysOfValidators } from '
|
|
3
|
+
import { KeysOfSimpleSQL, KeysOfValidators } from '@/libs/crud-pro/models/keys';
|
|
4
4
|
import { BaseApiController } from '../base/BaseApiController';
|
|
5
5
|
|
|
6
6
|
const tableName = 'sys_app_schema_history';
|
|
@@ -33,7 +33,7 @@ export class AppSchemaHistoryApi extends BaseApiController {
|
|
|
33
33
|
async updateAppSchemaHistory() {
|
|
34
34
|
return this.executeSysSimpleSQL(tableName, KeysOfSimpleSQL.SIMPLE_UPDATE, {
|
|
35
35
|
validateCfg: {
|
|
36
|
-
'condition.id': [KeysOfValidators.REQUIRED, KeysOfValidators.
|
|
36
|
+
'condition.id': [KeysOfValidators.REQUIRED, KeysOfValidators.NUMERIC],
|
|
37
37
|
},
|
|
38
38
|
});
|
|
39
39
|
}
|
|
@@ -42,7 +42,7 @@ export class AppSchemaHistoryApi extends BaseApiController {
|
|
|
42
42
|
async deleteAppSchemaHistory() {
|
|
43
43
|
return this.executeSysSimpleSQL(tableName, KeysOfSimpleSQL.SIMPLE_DELETE, {
|
|
44
44
|
validateCfg: {
|
|
45
|
-
'condition.id': [KeysOfValidators.REQUIRED, KeysOfValidators.
|
|
45
|
+
'condition.id': [KeysOfValidators.REQUIRED, KeysOfValidators.NUMERIC],
|
|
46
46
|
},
|
|
47
47
|
});
|
|
48
48
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Controller, Inject, Post } from '@midwayjs/core';
|
|
2
2
|
import { Context } from '@midwayjs/koa';
|
|
3
|
-
import { KeysOfSimpleSQL, KeysOfValidators } from '
|
|
3
|
+
import { KeysOfSimpleSQL, KeysOfValidators } from '@/libs/crud-pro/models/keys';
|
|
4
4
|
import { BaseApiController } from '../base/BaseApiController';
|
|
5
|
-
import { checkPermission } from '
|
|
6
|
-
import { SystemFuncCode } from '
|
|
5
|
+
import { checkPermission } from '@/middleware/permission.middleware';
|
|
6
|
+
import { SystemFuncCode } from '@/models/SystemPerm';
|
|
7
7
|
|
|
8
8
|
@Controller('/ns/api/manage/crudMethod', { middleware: [checkPermission(SystemFuncCode.CrudMethodApiRead)] })
|
|
9
9
|
export class CrudMethodsMangeApi extends BaseApiController {
|
|
@@ -33,7 +33,7 @@ export class CrudMethodsMangeApi extends BaseApiController {
|
|
|
33
33
|
async updateCrudMethod() {
|
|
34
34
|
return this.executeSysSimpleSQL('sys_crud_methods', KeysOfSimpleSQL.SIMPLE_UPDATE, {
|
|
35
35
|
validateCfg: {
|
|
36
|
-
'condition.id': [KeysOfValidators.REQUIRED, KeysOfValidators.
|
|
36
|
+
'condition.id': [KeysOfValidators.REQUIRED, KeysOfValidators.NUMERIC],
|
|
37
37
|
},
|
|
38
38
|
});
|
|
39
39
|
}
|
|
@@ -42,7 +42,7 @@ export class CrudMethodsMangeApi extends BaseApiController {
|
|
|
42
42
|
async deleteCrudMethod() {
|
|
43
43
|
return this.executeSysSimpleSQL('sys_crud_methods', KeysOfSimpleSQL.SIMPLE_DELETE, {
|
|
44
44
|
validateCfg: {
|
|
45
|
-
'condition.id': [KeysOfValidators.REQUIRED, KeysOfValidators.
|
|
45
|
+
'condition.id': [KeysOfValidators.REQUIRED, KeysOfValidators.NUMERIC],
|
|
46
46
|
},
|
|
47
47
|
});
|
|
48
48
|
}
|
|
@@ -1,17 +1,13 @@
|
|
|
1
|
-
import * as _ from 'lodash';
|
|
2
1
|
import { Config, Controller, Post } from '@midwayjs/core';
|
|
3
2
|
import { BaseApiController } from '../base/BaseApiController';
|
|
4
|
-
import { parseCreateSqlToTitleMap } from '
|
|
5
|
-
import { checkPermission } from '
|
|
6
|
-
import { SystemFuncCode } from '
|
|
7
|
-
import {KeyOfCrudTypes, KeysOfSimpleSQL, SqlDbType} from '
|
|
8
|
-
import { SystemTables } from '
|
|
9
|
-
import {CommonException} from
|
|
10
|
-
import {parseDatabaseName, toDatabaseNameStr} from
|
|
11
|
-
import {CommonResult} from
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
3
|
+
import { parseCreateSqlToTitleMap } from '@/libs/utils/parseCreateSql';
|
|
4
|
+
import { checkPermission } from '@/middleware/permission.middleware';
|
|
5
|
+
import { SystemFuncCode } from '@/models/SystemPerm';
|
|
6
|
+
import { KeyOfCrudTypes, KeysOfSimpleSQL, SqlDbType } from '@/libs/crud-pro/models/keys';
|
|
7
|
+
import { SystemTables } from '@/models/SystemTables';
|
|
8
|
+
import { CommonException } from '@/libs/crud-pro/exceptions';
|
|
9
|
+
import { parseDatabaseName, toDatabaseNameStr } from '@/libs/crud-pro/utils/DatabaseName';
|
|
10
|
+
import { CommonResult } from '@/libs/utils/common-dto';
|
|
15
11
|
|
|
16
12
|
@Controller('/ns/api/manage/CrudStandardDesignApi', { middleware: [checkPermission(SystemFuncCode.CrudStandardDesignRead)] })
|
|
17
13
|
export class CrudStandardDesignApi extends BaseApiController {
|
|
@@ -30,19 +26,21 @@ export class CrudStandardDesignApi extends BaseApiController {
|
|
|
30
26
|
const postgresList = Object.keys(this.postgres2Config || {});
|
|
31
27
|
const sqlServerList = Object.keys(this.sqlserver2Config || {});
|
|
32
28
|
|
|
33
|
-
const toSelectList= (dbCfgNameList:string[], dbType: SqlDbType)=> {
|
|
34
|
-
return dbCfgNameList.map(
|
|
35
|
-
const dbName = item;
|
|
29
|
+
const toSelectList = (dbCfgNameList: string[], dbType: SqlDbType) => {
|
|
30
|
+
return dbCfgNameList.map(dbName => {
|
|
36
31
|
const value = toDatabaseNameStr(dbType, dbName);
|
|
37
|
-
return {value, label: value, dbName, dbType}
|
|
32
|
+
return { value, label: value, dbName, dbType };
|
|
38
33
|
});
|
|
39
|
-
}
|
|
34
|
+
};
|
|
40
35
|
|
|
41
36
|
const mysqlObjList = toSelectList(mysqlList, SqlDbType.mysql);
|
|
42
37
|
const postgresObjList = toSelectList(postgresList, SqlDbType.postgres);
|
|
43
38
|
const sqlserverObjList = toSelectList(sqlServerList, SqlDbType.sqlserver);
|
|
44
39
|
|
|
45
|
-
const databaseList = [...mysqlObjList, ...postgresObjList, ...sqlserverObjList]
|
|
40
|
+
const databaseList = [...mysqlObjList, ...postgresObjList, ...sqlserverObjList].filter((obj: any) => {
|
|
41
|
+
const value = '' + obj.value;
|
|
42
|
+
return !value.endsWith('_fatcms_inner_demo_config');
|
|
43
|
+
});
|
|
46
44
|
|
|
47
45
|
return {
|
|
48
46
|
success: true,
|
|
@@ -51,22 +49,22 @@ export class CrudStandardDesignApi extends BaseApiController {
|
|
|
51
49
|
}
|
|
52
50
|
|
|
53
51
|
@Post('/getTableList')
|
|
54
|
-
async getTableList():
|
|
52
|
+
async getTableList(): Promise<CommonResult> {
|
|
55
53
|
const { databaseName } = this.ctx.request.body as any;
|
|
56
54
|
const { dbType, dbName } = parseDatabaseName(databaseName);
|
|
57
55
|
|
|
58
56
|
if (dbType === SqlDbType.postgres) {
|
|
59
|
-
return this.getTableListOfPostgreSQL(dbName)
|
|
57
|
+
return this.getTableListOfPostgreSQL(dbName);
|
|
60
58
|
}
|
|
61
59
|
|
|
62
60
|
if (dbType === SqlDbType.sqlserver) {
|
|
63
|
-
return this.getTableListOfSqlserver(dbName)
|
|
61
|
+
return this.getTableListOfSqlserver(dbName);
|
|
64
62
|
}
|
|
65
63
|
|
|
66
64
|
const res = await this.curdMixService.executeSQL({
|
|
67
65
|
executeSql: 'SHOW TABLES',
|
|
68
66
|
sqlDatabase: dbName,
|
|
69
|
-
|
|
67
|
+
sqlDbType: SqlDbType.mysql,
|
|
70
68
|
crudType: KeyOfCrudTypes.SYS_QUERY,
|
|
71
69
|
});
|
|
72
70
|
|
|
@@ -79,8 +77,8 @@ export class CrudStandardDesignApi extends BaseApiController {
|
|
|
79
77
|
label: tableName,
|
|
80
78
|
dbName,
|
|
81
79
|
dbType,
|
|
82
|
-
tableName
|
|
83
|
-
}
|
|
80
|
+
tableName,
|
|
81
|
+
};
|
|
84
82
|
});
|
|
85
83
|
return CommonResult.successRes(tableNames);
|
|
86
84
|
}
|
|
@@ -91,23 +89,23 @@ export class CrudStandardDesignApi extends BaseApiController {
|
|
|
91
89
|
const { dbType, dbName } = parseDatabaseName(databaseName);
|
|
92
90
|
|
|
93
91
|
if (dbType === SqlDbType.postgres) {
|
|
94
|
-
return this.getTableFieldsOfPostgreSQL(dbName, tableName)
|
|
92
|
+
return this.getTableFieldsOfPostgreSQL(dbName, tableName);
|
|
95
93
|
}
|
|
96
94
|
|
|
97
95
|
if (dbType === SqlDbType.sqlserver) {
|
|
98
|
-
return this.getTableFieldsOfSqlServer(dbName, tableName)
|
|
96
|
+
return this.getTableFieldsOfSqlServer(dbName, tableName);
|
|
99
97
|
}
|
|
100
98
|
|
|
101
99
|
const tableDescribe = await this.curdMixService.executeSQL({
|
|
102
100
|
executeSql: 'describe ' + tableName,
|
|
103
101
|
sqlDatabase: dbName,
|
|
104
|
-
|
|
102
|
+
sqlDbType: SqlDbType.mysql,
|
|
105
103
|
crudType: KeyOfCrudTypes.SYS_QUERY,
|
|
106
104
|
});
|
|
107
105
|
const tableCreate = await this.curdMixService.executeSQL({
|
|
108
106
|
executeSql: 'show create table ' + tableName,
|
|
109
107
|
sqlDatabase: dbName,
|
|
110
|
-
|
|
108
|
+
sqlDbType: SqlDbType.mysql,
|
|
111
109
|
crudType: KeyOfCrudTypes.SYS_QUERY,
|
|
112
110
|
});
|
|
113
111
|
|
|
@@ -158,133 +156,131 @@ export class CrudStandardDesignApi extends BaseApiController {
|
|
|
158
156
|
private async getTableListOfSqlserver(dbName: string): Promise<CommonResult> {
|
|
159
157
|
const dbConfig = this.sqlserver2Config[dbName];
|
|
160
158
|
if (!dbConfig) {
|
|
161
|
-
throw new CommonException(
|
|
159
|
+
throw new CommonException('DB_NOT_FOUND', '数据库配置没有找到:' + dbName);
|
|
162
160
|
}
|
|
163
161
|
|
|
164
162
|
const dbType = SqlDbType.sqlserver;
|
|
165
163
|
|
|
166
|
-
const sql =
|
|
167
|
-
"SELECT name as tablename \n" +
|
|
168
|
-
"FROM sys.tables" +
|
|
169
|
-
"";
|
|
164
|
+
const sql = 'SELECT name as tablename FROM sys.tables';
|
|
170
165
|
const arr = await this.curdMixService.executeSQL({
|
|
171
166
|
executeSql: sql,
|
|
172
167
|
sqlDatabase: dbName,
|
|
173
|
-
|
|
168
|
+
sqlDbType: dbType,
|
|
174
169
|
crudType: KeyOfCrudTypes.SYS_QUERY,
|
|
175
170
|
executeSqlArgs: [],
|
|
176
171
|
});
|
|
177
172
|
|
|
178
|
-
|
|
179
173
|
const tableNames: string[] = arr.map(v => {
|
|
180
|
-
const tableName = v.tablename
|
|
174
|
+
const tableName = v.tablename;
|
|
181
175
|
return {
|
|
182
|
-
value: tableName
|
|
176
|
+
value: tableName, //[dbName, dbType, tableName].join(SPLIT_CONST),
|
|
183
177
|
label: tableName,
|
|
184
|
-
dbName,
|
|
185
|
-
|
|
186
|
-
|
|
178
|
+
dbName,
|
|
179
|
+
dbType,
|
|
180
|
+
tableName,
|
|
181
|
+
};
|
|
187
182
|
});
|
|
188
183
|
return CommonResult.successRes(tableNames);
|
|
189
|
-
|
|
190
184
|
}
|
|
191
185
|
|
|
192
|
-
|
|
193
186
|
private async getTableListOfPostgreSQL(dbName: string): Promise<CommonResult> {
|
|
194
|
-
|
|
195
187
|
const dbConfig = this.postgres2Config[dbName];
|
|
196
188
|
if (!dbConfig) {
|
|
197
|
-
throw new CommonException(
|
|
189
|
+
throw new CommonException('DB_NOT_FOUND', '数据库配置没有找到:' + dbName);
|
|
198
190
|
}
|
|
199
191
|
|
|
192
|
+
const dbType = SqlDbType.postgres;
|
|
193
|
+
const schemaname = 'public';
|
|
200
194
|
|
|
201
|
-
const schemaname =
|
|
195
|
+
const tableListSql = '' + 'SELECT tablename\n' + 'FROM pg_tables\n' + `WHERE schemaname = '${schemaname}' \n` + 'ORDER BY tablename;';
|
|
202
196
|
|
|
203
|
-
const
|
|
204
|
-
"SELECT tablename\n" +
|
|
205
|
-
"FROM pg_tables\n" +
|
|
206
|
-
`WHERE schemaname = '${schemaname}' \n` +
|
|
207
|
-
"ORDER BY tablename;"
|
|
197
|
+
const viewListSql = '' + 'SELECT viewname as tablename\n' + 'FROM pg_views\n' + `WHERE schemaname = '${schemaname}' \n` + 'ORDER BY viewname;';
|
|
208
198
|
|
|
209
|
-
const
|
|
199
|
+
const toSelectOptions = async (executeSql: string, tableType: string) => {
|
|
200
|
+
const arr = await this.curdMixService.executeSQL({
|
|
201
|
+
executeSql: executeSql,
|
|
202
|
+
sqlDatabase: dbName,
|
|
203
|
+
sqlDbType: dbType,
|
|
204
|
+
crudType: KeyOfCrudTypes.SYS_QUERY,
|
|
205
|
+
executeSqlArgs: [],
|
|
206
|
+
});
|
|
207
|
+
return arr.map(v => {
|
|
208
|
+
const tableName = v.tablename;
|
|
209
|
+
return {
|
|
210
|
+
value: tableName, //[dbName, dbType, tableName].join(SPLIT_CONST),
|
|
211
|
+
label: tableName,
|
|
212
|
+
dbName,
|
|
213
|
+
dbType,
|
|
214
|
+
tableName,
|
|
215
|
+
tableType,
|
|
216
|
+
};
|
|
217
|
+
});
|
|
218
|
+
};
|
|
210
219
|
|
|
211
|
-
const
|
|
212
|
-
|
|
213
|
-
sqlDatabase: dbName,
|
|
214
|
-
sqlDdType: dbType,
|
|
215
|
-
crudType: KeyOfCrudTypes.SYS_QUERY,
|
|
216
|
-
executeSqlArgs: [],
|
|
217
|
-
});
|
|
220
|
+
const tableNames: any[] = await toSelectOptions(tableListSql, 'table');
|
|
221
|
+
const viewNames: any[] = await toSelectOptions(viewListSql, 'view');
|
|
218
222
|
|
|
223
|
+
const tableNameMerge = [...tableNames, ...viewNames];
|
|
219
224
|
|
|
220
|
-
|
|
221
|
-
const tableName = v.tablename
|
|
222
|
-
return {
|
|
223
|
-
value: tableName , //[dbName, dbType, tableName].join(SPLIT_CONST),
|
|
224
|
-
label: tableName,
|
|
225
|
-
dbName, dbType,
|
|
226
|
-
tableName
|
|
227
|
-
}
|
|
228
|
-
});
|
|
229
|
-
return CommonResult.successRes(tableNames);
|
|
225
|
+
return CommonResult.successRes(tableNameMerge);
|
|
230
226
|
}
|
|
231
227
|
|
|
232
|
-
|
|
233
228
|
private async getTableFieldsOfSqlServer(dbName: string, tableName: string): Promise<CommonResult> {
|
|
234
229
|
const dbConfig = this.sqlserver2Config[dbName];
|
|
235
230
|
if (!dbConfig) {
|
|
236
|
-
throw new CommonException(
|
|
231
|
+
throw new CommonException('DB_NOT_FOUND', '数据库配置没有找到:' + dbName);
|
|
237
232
|
}
|
|
238
233
|
|
|
239
|
-
const columnArraySql =
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
234
|
+
const columnArraySql =
|
|
235
|
+
'' +
|
|
236
|
+
'SELECT\n' +
|
|
237
|
+
' c.name AS column_name,\n' +
|
|
238
|
+
' t.name AS data_type,\n' +
|
|
239
|
+
' c.max_length AS max_length,\n' +
|
|
240
|
+
' c.precision,\n' +
|
|
241
|
+
' c.scale,\n' +
|
|
242
|
+
' c.is_nullable,\n' +
|
|
243
|
+
' c.is_identity,\n' +
|
|
244
|
+
' dc.definition AS column_default, \n' +
|
|
245
|
+
' ep.value AS column_description \n' +
|
|
246
|
+
'FROM\n' +
|
|
247
|
+
' sys.columns c\n' +
|
|
248
|
+
' JOIN\n' +
|
|
249
|
+
' sys.types t ON c.user_type_id = t.user_type_id\n' +
|
|
250
|
+
' LEFT JOIN\n' +
|
|
251
|
+
' sys.default_constraints dc\n' +
|
|
252
|
+
' ON c.default_object_id = dc.object_id \n' +
|
|
253
|
+
' LEFT JOIN\n' +
|
|
254
|
+
' sys.extended_properties ep\n' +
|
|
255
|
+
' ON c.object_id = ep.major_id\n' +
|
|
256
|
+
' AND c.column_id = ep.minor_id\n' +
|
|
257
|
+
'WHERE\n' +
|
|
263
258
|
` c.object_id = OBJECT_ID('${tableName}') \n` +
|
|
264
|
-
|
|
265
|
-
|
|
259
|
+
' ORDER BY\n' +
|
|
260
|
+
' c.column_id;';
|
|
266
261
|
|
|
267
262
|
const dbType = SqlDbType.sqlserver;
|
|
268
263
|
|
|
269
264
|
const columnArray = await this.curdMixService.executeSQL({
|
|
270
265
|
executeSql: columnArraySql,
|
|
271
266
|
sqlDatabase: dbName,
|
|
272
|
-
|
|
267
|
+
sqlDbType: dbType,
|
|
273
268
|
crudType: KeyOfCrudTypes.SYS_QUERY,
|
|
274
269
|
executeSqlArgs: [],
|
|
275
270
|
});
|
|
276
271
|
|
|
277
272
|
const fields = columnArray.map(columnObj => {
|
|
278
|
-
const {column_name,is_nullable,column_default,data_type,is_identity,column_description, ...others } = columnObj;
|
|
273
|
+
const { column_name, is_nullable, column_default, data_type, is_identity, column_description, ...others } = columnObj;
|
|
274
|
+
|
|
279
275
|
return {
|
|
280
276
|
fieldIndex: column_name || '',
|
|
281
|
-
fieldTitle: column_description || column_name ||
|
|
277
|
+
fieldTitle: column_description || column_name || '',
|
|
282
278
|
isNullable: is_nullable,
|
|
283
|
-
defaultValue: column_default ||
|
|
279
|
+
defaultValue: column_default || '',
|
|
284
280
|
extra: others,
|
|
285
281
|
// key: column_name, // 索引
|
|
286
282
|
type: data_type,
|
|
287
|
-
is_identity: is_identity
|
|
283
|
+
is_identity: is_identity,
|
|
288
284
|
};
|
|
289
285
|
});
|
|
290
286
|
|
|
@@ -293,17 +289,15 @@ export class CrudStandardDesignApi extends BaseApiController {
|
|
|
293
289
|
tableName,
|
|
294
290
|
tableTitle: tableName,
|
|
295
291
|
});
|
|
296
|
-
|
|
297
|
-
|
|
298
292
|
}
|
|
299
293
|
|
|
300
294
|
private async getTableFieldsOfPostgreSQL(dbName: string, tableName: string) {
|
|
301
295
|
const dbConfig = this.postgres2Config[dbName];
|
|
302
296
|
if (!dbConfig) {
|
|
303
|
-
throw new CommonException(
|
|
297
|
+
throw new CommonException('DB_NOT_FOUND', '数据库配置没有找到:' + dbName);
|
|
304
298
|
}
|
|
305
299
|
|
|
306
|
-
const schemaname =
|
|
300
|
+
const schemaname = 'public';
|
|
307
301
|
|
|
308
302
|
const columnArraySql = `
|
|
309
303
|
|
|
@@ -313,31 +307,30 @@ export class CrudStandardDesignApi extends BaseApiController {
|
|
|
313
307
|
WHERE table_schema = $1 and table_name = $2
|
|
314
308
|
ORDER BY ordinal_position;
|
|
315
309
|
|
|
316
|
-
`.trim();
|
|
310
|
+
`.trim();
|
|
317
311
|
|
|
318
312
|
const dbType = SqlDbType.postgres;
|
|
319
313
|
|
|
320
314
|
const columnArray = await this.curdMixService.executeSQL({
|
|
321
315
|
executeSql: columnArraySql,
|
|
322
316
|
sqlDatabase: dbName,
|
|
323
|
-
|
|
317
|
+
sqlDbType: dbType,
|
|
324
318
|
crudType: KeyOfCrudTypes.SYS_QUERY,
|
|
325
|
-
executeSqlArgs: [
|
|
319
|
+
executeSqlArgs: [schemaname, tableName],
|
|
326
320
|
});
|
|
327
321
|
|
|
328
|
-
|
|
329
|
-
|
|
330
322
|
const fields = columnArray.map(columnObj => {
|
|
331
|
-
const {column_name,is_nullable,column_default,data_type,is_identity, ...others } = columnObj;
|
|
323
|
+
const { column_name, is_nullable, column_default, data_type, is_identity, ...others } = columnObj;
|
|
324
|
+
|
|
332
325
|
return {
|
|
333
326
|
fieldIndex: column_name || '',
|
|
334
327
|
fieldTitle: column_name || '',
|
|
335
328
|
isNullable: is_nullable,
|
|
336
|
-
defaultValue: column_default ||
|
|
329
|
+
defaultValue: column_default || '',
|
|
337
330
|
extra: others,
|
|
338
331
|
// key: column_name, // 索引
|
|
339
332
|
type: data_type,
|
|
340
|
-
is_identity: is_identity
|
|
333
|
+
is_identity: is_identity,
|
|
341
334
|
};
|
|
342
335
|
});
|
|
343
336
|
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { Inject, Controller, Post } from '@midwayjs/core';
|
|
2
2
|
import { Context } from '@midwayjs/koa';
|
|
3
|
-
import { KeysOfSimpleSQL, KeysOfValidators } from '
|
|
3
|
+
import { KeysOfSimpleSQL, KeysOfValidators } from '@/libs/crud-pro/models/keys';
|
|
4
4
|
import { BaseApiController } from '../base/BaseApiController';
|
|
5
|
-
import { checkPermission } from '
|
|
6
|
-
import { SystemFuncCode } from '
|
|
5
|
+
import { checkPermission } from '@/middleware/permission.middleware';
|
|
6
|
+
import { SystemFuncCode } from '@/models/SystemPerm';
|
|
7
7
|
|
|
8
8
|
@Controller('/ns/api/manage/dataDict', { middleware: [checkPermission(SystemFuncCode.DataDictMangeRead)] })
|
|
9
9
|
export class DataDictManageApi extends BaseApiController {
|
|
10
10
|
@Inject()
|
|
11
|
-
ctx: Context;
|
|
11
|
+
protected ctx: Context;
|
|
12
12
|
|
|
13
13
|
@Post('/getDataDictList')
|
|
14
14
|
async getDataDictList() {
|
|
@@ -33,7 +33,7 @@ export class DataDictManageApi extends BaseApiController {
|
|
|
33
33
|
async updateDataDict() {
|
|
34
34
|
return this.executeSysSimpleSQL('sys_data_dict', KeysOfSimpleSQL.SIMPLE_UPDATE, {
|
|
35
35
|
validateCfg: {
|
|
36
|
-
'condition.id': [KeysOfValidators.REQUIRED],
|
|
36
|
+
'condition.id': [KeysOfValidators.REQUIRED, KeysOfValidators.NUMERIC],
|
|
37
37
|
},
|
|
38
38
|
});
|
|
39
39
|
}
|