midway-fatcms 0.0.1-beta.20 → 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/dist/controller/base/BaseApiController.js +5 -0
- package/dist/controller/gateway/CrudStdGatewayController.d.ts +5 -5
- 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/DataDictManageApi.js +1 -1
- 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/SysConfigMangeApi.js +2 -2
- package/dist/controller/manage/UserAccountManageApi.js +2 -2
- package/dist/controller/manage/WorkbenchMangeApi.js +2 -2
- package/dist/libs/crud-pro/services/CrudProCachedCfgService.js +5 -4
- package/dist/libs/crud-pro/services/CrudProExecuteSqlService.js +4 -9
- package/dist/libs/crud-pro/services/CrudProTableMetaService.js +5 -4
- 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/service/asyncTask/AsyncTaskRunnerService.js +7 -1
- package/dist/service/crudstd/CrudStdService.d.ts +1 -1
- package/dist/service/crudstd/CrudStdService.js +14 -0
- package/package.json +1 -1
- package/src/controller/base/BaseApiController.ts +7 -0
- package/src/controller/manage/AnyApiMangeApi.ts +2 -2
- package/src/controller/manage/AppLogMangeApi.ts +2 -2
- package/src/controller/manage/AppMangeApi.ts +2 -2
- package/src/controller/manage/AppPageMangeApi.ts +2 -2
- package/src/controller/manage/AppSchemaHistoryApi.ts +2 -2
- package/src/controller/manage/CrudMethodsMangeApi.ts +2 -2
- package/src/controller/manage/DataDictManageApi.ts +1 -1
- package/src/controller/manage/DocLibManageApi.ts +2 -2
- package/src/controller/manage/DocManageApi.ts +2 -2
- package/src/controller/manage/FileManageApi.ts +1 -1
- package/src/controller/manage/LowCodeTplManageApi.ts +2 -2
- package/src/controller/manage/MenuManageApi.ts +2 -2
- package/src/controller/manage/ProxyApiMangeApi.ts +2 -2
- package/src/controller/manage/SysConfigMangeApi.ts +2 -2
- package/src/controller/manage/UserAccountManageApi.ts +2 -2
- package/src/controller/manage/WorkbenchMangeApi.ts +2 -2
- package/src/libs/crud-pro/services/CrudProCachedCfgService.ts +6 -4
- package/src/libs/crud-pro/services/CrudProExecuteSqlService.ts +9 -13
- package/src/libs/crud-pro/services/CrudProTableMetaService.ts +5 -4
- package/src/libs/crud-pro/utils/sqlConvert/convertMix.ts +26 -0
- package/src/service/asyncTask/AsyncTaskRunnerService.ts +8 -2
- package/src/service/crudstd/CrudStdService.ts +17 -0
|
@@ -17,6 +17,7 @@ const global_config_1 = require("../../libs/global-config/global-config");
|
|
|
17
17
|
const UserAccountService_1 = require("../../service/UserAccountService");
|
|
18
18
|
const CurdMixUtils_1 = require("../../service/curd/CurdMixUtils");
|
|
19
19
|
const BaseService_1 = require("../../service/base/BaseService");
|
|
20
|
+
const moment = require("moment");
|
|
20
21
|
let BaseApiController = class BaseApiController extends BaseService_1.BaseService {
|
|
21
22
|
getUserSessionInfo() {
|
|
22
23
|
if (!this.ctx.userSession) {
|
|
@@ -60,6 +61,10 @@ let BaseApiController = class BaseApiController extends BaseService_1.BaseServic
|
|
|
60
61
|
this.addAccountBasicInfoCfgModel(cfgModel);
|
|
61
62
|
//自动关联工作台基本信息
|
|
62
63
|
this.addWorkbenchBasicInfoCfgModel(cfgModel);
|
|
64
|
+
//sys系统表都是标准的,都有modified_at字段。
|
|
65
|
+
if (sqlSimpleName === keys_1.KeysOfSimpleSQL.SIMPLE_UPDATE && body.data) {
|
|
66
|
+
body.data['modified_at'] = moment(Date.now()).format('YYYY-MM-DD HH:mm:ss.SSS');
|
|
67
|
+
}
|
|
63
68
|
return await this.curdMixService.executeCrudByCfg(body, cfgModel);
|
|
64
69
|
}
|
|
65
70
|
get sysDBUtil() {
|
|
@@ -14,23 +14,23 @@ export declare class CrudStdGatewayController extends BaseApiController {
|
|
|
14
14
|
/**
|
|
15
15
|
* 列表查询: 分页查询
|
|
16
16
|
*/
|
|
17
|
-
getObjectList(): Promise<
|
|
17
|
+
getObjectList(): Promise<any>;
|
|
18
18
|
/**
|
|
19
19
|
* 单个查询
|
|
20
20
|
*/
|
|
21
|
-
getObjectOne(): Promise<
|
|
21
|
+
getObjectOne(): Promise<any>;
|
|
22
22
|
/**
|
|
23
23
|
* 单个删除
|
|
24
24
|
*/
|
|
25
|
-
deleteObject(): Promise<
|
|
25
|
+
deleteObject(): Promise<any>;
|
|
26
26
|
/**
|
|
27
27
|
* 单个创建
|
|
28
28
|
*/
|
|
29
|
-
createObject(): Promise<
|
|
29
|
+
createObject(): Promise<any>;
|
|
30
30
|
/**
|
|
31
31
|
* 单个更新
|
|
32
32
|
*/
|
|
33
|
-
updateObject(): Promise<
|
|
33
|
+
updateObject(): Promise<any>;
|
|
34
34
|
/**
|
|
35
35
|
* 执行操作
|
|
36
36
|
*/
|
|
@@ -46,14 +46,14 @@ let AnyApiMangeApi = class AnyApiMangeApi extends BaseApiController_1.BaseApiCon
|
|
|
46
46
|
fixBodyData(this.ctx.request.body);
|
|
47
47
|
return this.executeSysSimpleSQL(SystemTables_1.SystemTables.sys_anyapi, keys_1.KeysOfSimpleSQL.SIMPLE_UPDATE, {
|
|
48
48
|
validateCfg: {
|
|
49
|
-
'condition.id': [keys_1.KeysOfValidators.REQUIRED, keys_1.KeysOfValidators.
|
|
49
|
+
'condition.id': [keys_1.KeysOfValidators.REQUIRED, keys_1.KeysOfValidators.NUMERIC],
|
|
50
50
|
},
|
|
51
51
|
});
|
|
52
52
|
}
|
|
53
53
|
async deleteAnyApi() {
|
|
54
54
|
return this.executeSysSimpleSQL(SystemTables_1.SystemTables.sys_anyapi, keys_1.KeysOfSimpleSQL.SIMPLE_DELETE, {
|
|
55
55
|
validateCfg: {
|
|
56
|
-
'condition.id': [keys_1.KeysOfValidators.REQUIRED, keys_1.KeysOfValidators.
|
|
56
|
+
'condition.id': [keys_1.KeysOfValidators.REQUIRED, keys_1.KeysOfValidators.NUMERIC],
|
|
57
57
|
},
|
|
58
58
|
});
|
|
59
59
|
}
|
|
@@ -34,7 +34,7 @@ let AppLogMangeApi = class AppLogMangeApi extends BaseApiController_1.BaseApiCon
|
|
|
34
34
|
async updateAppLog() {
|
|
35
35
|
return this.executeSysSimpleSQL('sys_app_log', keys_1.KeysOfSimpleSQL.SIMPLE_UPDATE, {
|
|
36
36
|
validateCfg: {
|
|
37
|
-
'condition.id': [keys_1.KeysOfValidators.REQUIRED, keys_1.KeysOfValidators.
|
|
37
|
+
'condition.id': [keys_1.KeysOfValidators.REQUIRED, keys_1.KeysOfValidators.NUMERIC],
|
|
38
38
|
'condition.app_code': [keys_1.KeysOfValidators.REQUIRED, keys_1.KeysOfValidators.STRING],
|
|
39
39
|
},
|
|
40
40
|
});
|
|
@@ -42,7 +42,7 @@ let AppLogMangeApi = class AppLogMangeApi extends BaseApiController_1.BaseApiCon
|
|
|
42
42
|
async deleteAppLog() {
|
|
43
43
|
return this.executeSysSimpleSQL('sys_app_log', keys_1.KeysOfSimpleSQL.SIMPLE_DELETE, {
|
|
44
44
|
validateCfg: {
|
|
45
|
-
'condition.id': [keys_1.KeysOfValidators.REQUIRED, keys_1.KeysOfValidators.
|
|
45
|
+
'condition.id': [keys_1.KeysOfValidators.REQUIRED, keys_1.KeysOfValidators.NUMERIC],
|
|
46
46
|
'condition.app_code': [keys_1.KeysOfValidators.REQUIRED, keys_1.KeysOfValidators.STRING],
|
|
47
47
|
},
|
|
48
48
|
});
|
|
@@ -34,7 +34,7 @@ let AppMangeApi = class AppMangeApi extends BaseApiController_1.BaseApiControlle
|
|
|
34
34
|
async updateApp() {
|
|
35
35
|
return this.executeSysSimpleSQL('sys_app', keys_1.KeysOfSimpleSQL.SIMPLE_UPDATE, {
|
|
36
36
|
validateCfg: {
|
|
37
|
-
'condition.id': [keys_1.KeysOfValidators.REQUIRED, keys_1.KeysOfValidators.
|
|
37
|
+
'condition.id': [keys_1.KeysOfValidators.REQUIRED, keys_1.KeysOfValidators.NUMERIC],
|
|
38
38
|
'condition.app_code': [keys_1.KeysOfValidators.REQUIRED, keys_1.KeysOfValidators.STRING],
|
|
39
39
|
},
|
|
40
40
|
});
|
|
@@ -42,7 +42,7 @@ let AppMangeApi = class AppMangeApi extends BaseApiController_1.BaseApiControlle
|
|
|
42
42
|
async deleteApp() {
|
|
43
43
|
return this.executeSysSimpleSQL('sys_app', keys_1.KeysOfSimpleSQL.SIMPLE_DELETE, {
|
|
44
44
|
validateCfg: {
|
|
45
|
-
'condition.id': [keys_1.KeysOfValidators.REQUIRED, keys_1.KeysOfValidators.
|
|
45
|
+
'condition.id': [keys_1.KeysOfValidators.REQUIRED, keys_1.KeysOfValidators.NUMERIC],
|
|
46
46
|
'condition.app_code': [keys_1.KeysOfValidators.REQUIRED, keys_1.KeysOfValidators.STRING],
|
|
47
47
|
},
|
|
48
48
|
});
|
|
@@ -35,14 +35,14 @@ let AppPageMangeApi = class AppPageMangeApi extends BaseApiController_1.BaseApiC
|
|
|
35
35
|
async updateAppPage() {
|
|
36
36
|
return this.executeSysSimpleSQL('sys_app_page', keys_1.KeysOfSimpleSQL.SIMPLE_UPDATE, {
|
|
37
37
|
validateCfg: {
|
|
38
|
-
'condition.id': [keys_1.KeysOfValidators.REQUIRED, keys_1.KeysOfValidators.
|
|
38
|
+
'condition.id': [keys_1.KeysOfValidators.REQUIRED, keys_1.KeysOfValidators.NUMERIC],
|
|
39
39
|
},
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
42
|
async deleteAppPage() {
|
|
43
43
|
return this.executeSysSimpleSQL('sys_app_page', keys_1.KeysOfSimpleSQL.SIMPLE_DELETE, {
|
|
44
44
|
validateCfg: {
|
|
45
|
-
'condition.id': [keys_1.KeysOfValidators.REQUIRED, keys_1.KeysOfValidators.
|
|
45
|
+
'condition.id': [keys_1.KeysOfValidators.REQUIRED, keys_1.KeysOfValidators.NUMERIC],
|
|
46
46
|
},
|
|
47
47
|
});
|
|
48
48
|
}
|
|
@@ -31,14 +31,14 @@ let AppSchemaHistoryApi = class AppSchemaHistoryApi extends BaseApiController_1.
|
|
|
31
31
|
async updateAppSchemaHistory() {
|
|
32
32
|
return this.executeSysSimpleSQL(tableName, keys_1.KeysOfSimpleSQL.SIMPLE_UPDATE, {
|
|
33
33
|
validateCfg: {
|
|
34
|
-
'condition.id': [keys_1.KeysOfValidators.REQUIRED, keys_1.KeysOfValidators.
|
|
34
|
+
'condition.id': [keys_1.KeysOfValidators.REQUIRED, keys_1.KeysOfValidators.NUMERIC],
|
|
35
35
|
},
|
|
36
36
|
});
|
|
37
37
|
}
|
|
38
38
|
async deleteAppSchemaHistory() {
|
|
39
39
|
return this.executeSysSimpleSQL(tableName, keys_1.KeysOfSimpleSQL.SIMPLE_DELETE, {
|
|
40
40
|
validateCfg: {
|
|
41
|
-
'condition.id': [keys_1.KeysOfValidators.REQUIRED, keys_1.KeysOfValidators.
|
|
41
|
+
'condition.id': [keys_1.KeysOfValidators.REQUIRED, keys_1.KeysOfValidators.NUMERIC],
|
|
42
42
|
},
|
|
43
43
|
});
|
|
44
44
|
}
|
|
@@ -32,14 +32,14 @@ let CrudMethodsMangeApi = class CrudMethodsMangeApi extends BaseApiController_1.
|
|
|
32
32
|
async updateCrudMethod() {
|
|
33
33
|
return this.executeSysSimpleSQL('sys_crud_methods', keys_1.KeysOfSimpleSQL.SIMPLE_UPDATE, {
|
|
34
34
|
validateCfg: {
|
|
35
|
-
'condition.id': [keys_1.KeysOfValidators.REQUIRED, keys_1.KeysOfValidators.
|
|
35
|
+
'condition.id': [keys_1.KeysOfValidators.REQUIRED, keys_1.KeysOfValidators.NUMERIC],
|
|
36
36
|
},
|
|
37
37
|
});
|
|
38
38
|
}
|
|
39
39
|
async deleteCrudMethod() {
|
|
40
40
|
return this.executeSysSimpleSQL('sys_crud_methods', keys_1.KeysOfSimpleSQL.SIMPLE_DELETE, {
|
|
41
41
|
validateCfg: {
|
|
42
|
-
'condition.id': [keys_1.KeysOfValidators.REQUIRED, keys_1.KeysOfValidators.
|
|
42
|
+
'condition.id': [keys_1.KeysOfValidators.REQUIRED, keys_1.KeysOfValidators.NUMERIC],
|
|
43
43
|
},
|
|
44
44
|
});
|
|
45
45
|
}
|
|
@@ -32,7 +32,7 @@ let DataDictManageApi = class DataDictManageApi extends BaseApiController_1.Base
|
|
|
32
32
|
async updateDataDict() {
|
|
33
33
|
return this.executeSysSimpleSQL('sys_data_dict', keys_1.KeysOfSimpleSQL.SIMPLE_UPDATE, {
|
|
34
34
|
validateCfg: {
|
|
35
|
-
'condition.id': [keys_1.KeysOfValidators.REQUIRED],
|
|
35
|
+
'condition.id': [keys_1.KeysOfValidators.REQUIRED, keys_1.KeysOfValidators.NUMERIC],
|
|
36
36
|
},
|
|
37
37
|
});
|
|
38
38
|
}
|
|
@@ -45,7 +45,7 @@ let DocLibManageApi = class DocLibManageApi extends BaseApiController_1.BaseApiC
|
|
|
45
45
|
async updateDocLib() {
|
|
46
46
|
return this.executeSysSimpleSQL(SystemTables_1.SystemTables.sys_doc_lib, keys_1.KeysOfSimpleSQL.SIMPLE_UPDATE, {
|
|
47
47
|
validateCfg: {
|
|
48
|
-
'condition.id': [keys_1.KeysOfValidators.REQUIRED, keys_1.KeysOfValidators.
|
|
48
|
+
'condition.id': [keys_1.KeysOfValidators.REQUIRED, keys_1.KeysOfValidators.NUMERIC],
|
|
49
49
|
'data.title': [keys_1.KeysOfValidators.REQUIRED, keys_1.KeysOfValidators.STRING],
|
|
50
50
|
},
|
|
51
51
|
updateCfg: {
|
|
@@ -56,7 +56,7 @@ let DocLibManageApi = class DocLibManageApi extends BaseApiController_1.BaseApiC
|
|
|
56
56
|
async deleteDocLib() {
|
|
57
57
|
return this.executeSysSimpleSQL(SystemTables_1.SystemTables.sys_doc_lib, keys_1.KeysOfSimpleSQL.SIMPLE_DELETE, {
|
|
58
58
|
validateCfg: {
|
|
59
|
-
'condition.id': [keys_1.KeysOfValidators.REQUIRED, keys_1.KeysOfValidators.
|
|
59
|
+
'condition.id': [keys_1.KeysOfValidators.REQUIRED, keys_1.KeysOfValidators.NUMERIC],
|
|
60
60
|
},
|
|
61
61
|
updateCfg: {
|
|
62
62
|
'condition.workbench_code': { contextAsString: bizmodels_1.CTX_WORKBENCH_CODE },
|
|
@@ -71,7 +71,7 @@ let DocManageApi = class DocManageApi extends BaseApiController_1.BaseApiControl
|
|
|
71
71
|
const updateCfg = isPublish ? publishUpdateCfg : {};
|
|
72
72
|
return this.executeSysSimpleSQL('sys_doc', keys_1.KeysOfSimpleSQL.SIMPLE_UPDATE, {
|
|
73
73
|
validateCfg: {
|
|
74
|
-
'condition.id': [keys_1.KeysOfValidators.REQUIRED, keys_1.KeysOfValidators.
|
|
74
|
+
'condition.id': [keys_1.KeysOfValidators.REQUIRED, keys_1.KeysOfValidators.NUMERIC],
|
|
75
75
|
},
|
|
76
76
|
updateCfg: {
|
|
77
77
|
...updateCfg,
|
|
@@ -82,7 +82,7 @@ let DocManageApi = class DocManageApi extends BaseApiController_1.BaseApiControl
|
|
|
82
82
|
async deleteDoc() {
|
|
83
83
|
return this.executeSysSimpleSQL('sys_doc', keys_1.KeysOfSimpleSQL.SIMPLE_DELETE, {
|
|
84
84
|
validateCfg: {
|
|
85
|
-
'condition.id': [keys_1.KeysOfValidators.REQUIRED, keys_1.KeysOfValidators.
|
|
85
|
+
'condition.id': [keys_1.KeysOfValidators.REQUIRED, keys_1.KeysOfValidators.NUMERIC],
|
|
86
86
|
},
|
|
87
87
|
updateCfg: {
|
|
88
88
|
'condition.workbench_code': { contextAsString: bizmodels_1.CTX_WORKBENCH_CODE },
|
|
@@ -30,7 +30,7 @@ let FileMangeApi = class FileMangeApi extends BaseApiController_1.BaseApiControl
|
|
|
30
30
|
async updateFile() {
|
|
31
31
|
return this.executeSysSimpleSQL(SystemTables_1.SystemTables.sys_file, keys_1.KeysOfSimpleSQL.SIMPLE_UPDATE, {
|
|
32
32
|
validateCfg: {
|
|
33
|
-
'condition.id': [keys_1.KeysOfValidators.REQUIRED, keys_1.KeysOfValidators.
|
|
33
|
+
'condition.id': [keys_1.KeysOfValidators.REQUIRED, keys_1.KeysOfValidators.NUMERIC],
|
|
34
34
|
},
|
|
35
35
|
});
|
|
36
36
|
}
|
|
@@ -34,14 +34,14 @@ let LowCodeTplManageApi = class LowCodeTplManageApi extends BaseApiController_1.
|
|
|
34
34
|
async updateLowCodeTpl() {
|
|
35
35
|
return this.executeSysSimpleSQL(tableName, keys_1.KeysOfSimpleSQL.SIMPLE_UPDATE, {
|
|
36
36
|
validateCfg: {
|
|
37
|
-
'condition.id': [keys_1.KeysOfValidators.REQUIRED, keys_1.KeysOfValidators.
|
|
37
|
+
'condition.id': [keys_1.KeysOfValidators.REQUIRED, keys_1.KeysOfValidators.NUMERIC],
|
|
38
38
|
},
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
41
|
async deleteLowCodeTpl() {
|
|
42
42
|
return this.executeSysSimpleSQL(tableName, keys_1.KeysOfSimpleSQL.SIMPLE_DELETE, {
|
|
43
43
|
validateCfg: {
|
|
44
|
-
'condition.id': [keys_1.KeysOfValidators.REQUIRED, keys_1.KeysOfValidators.
|
|
44
|
+
'condition.id': [keys_1.KeysOfValidators.REQUIRED, keys_1.KeysOfValidators.NUMERIC],
|
|
45
45
|
},
|
|
46
46
|
});
|
|
47
47
|
}
|
|
@@ -39,7 +39,7 @@ let MenuManageApi = class MenuManageApi extends BaseApiController_1.BaseApiContr
|
|
|
39
39
|
async updateMenu() {
|
|
40
40
|
return this.executeSysSimpleSQL(SystemTables_1.SystemTables.sys_menus, keys_1.KeysOfSimpleSQL.SIMPLE_UPDATE, {
|
|
41
41
|
validateCfg: {
|
|
42
|
-
'condition.id': [keys_1.KeysOfValidators.REQUIRED, keys_1.KeysOfValidators.
|
|
42
|
+
'condition.id': [keys_1.KeysOfValidators.REQUIRED, keys_1.KeysOfValidators.NUMERIC],
|
|
43
43
|
},
|
|
44
44
|
updateCfg: {},
|
|
45
45
|
});
|
|
@@ -47,7 +47,7 @@ let MenuManageApi = class MenuManageApi extends BaseApiController_1.BaseApiContr
|
|
|
47
47
|
async deleteMenu() {
|
|
48
48
|
return this.executeSysSimpleSQL(SystemTables_1.SystemTables.sys_menus, keys_1.KeysOfSimpleSQL.SIMPLE_DELETE, {
|
|
49
49
|
validateCfg: {
|
|
50
|
-
'condition.id': [keys_1.KeysOfValidators.REQUIRED, keys_1.KeysOfValidators.
|
|
50
|
+
'condition.id': [keys_1.KeysOfValidators.REQUIRED, keys_1.KeysOfValidators.NUMERIC],
|
|
51
51
|
},
|
|
52
52
|
updateCfg: {},
|
|
53
53
|
});
|
|
@@ -35,14 +35,14 @@ let ProxyApiMangeApi = class ProxyApiMangeApi extends BaseApiController_1.BaseAp
|
|
|
35
35
|
async updateProxyApi() {
|
|
36
36
|
return this.executeSysSimpleSQL(SystemTables_1.SystemTables.sys_proxyapi, keys_1.KeysOfSimpleSQL.SIMPLE_UPDATE, {
|
|
37
37
|
validateCfg: {
|
|
38
|
-
'condition.id': [keys_1.KeysOfValidators.REQUIRED, keys_1.KeysOfValidators.
|
|
38
|
+
'condition.id': [keys_1.KeysOfValidators.REQUIRED, keys_1.KeysOfValidators.NUMERIC],
|
|
39
39
|
},
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
42
|
async deleteProxyApi() {
|
|
43
43
|
return this.executeSysSimpleSQL(SystemTables_1.SystemTables.sys_proxyapi, keys_1.KeysOfSimpleSQL.SIMPLE_DELETE, {
|
|
44
44
|
validateCfg: {
|
|
45
|
-
'condition.id': [keys_1.KeysOfValidators.REQUIRED, keys_1.KeysOfValidators.
|
|
45
|
+
'condition.id': [keys_1.KeysOfValidators.REQUIRED, keys_1.KeysOfValidators.NUMERIC],
|
|
46
46
|
},
|
|
47
47
|
});
|
|
48
48
|
}
|
|
@@ -68,7 +68,7 @@ let SysConfigMangeApi = class SysConfigMangeApi extends BaseApiController_1.Base
|
|
|
68
68
|
return this.executeSysSimpleSQL('sys_configs', keys_1.KeysOfSimpleSQL.SIMPLE_UPDATE, {
|
|
69
69
|
validateCfg: {
|
|
70
70
|
'data.workbench_code': [keys_1.KeysOfValidators.REQUIRED, keys_1.KeysOfValidators.STRING, 'length:1,64'],
|
|
71
|
-
'condition.id': [keys_1.KeysOfValidators.REQUIRED, keys_1.KeysOfValidators.
|
|
71
|
+
'condition.id': [keys_1.KeysOfValidators.REQUIRED, keys_1.KeysOfValidators.NUMERIC],
|
|
72
72
|
},
|
|
73
73
|
updateCfg: {
|
|
74
74
|
'condition.workbench_code': { contextAsString: bizmodels_1.CTX_WORKBENCH_CODE },
|
|
@@ -78,7 +78,7 @@ let SysConfigMangeApi = class SysConfigMangeApi extends BaseApiController_1.Base
|
|
|
78
78
|
async deleteSysConfig() {
|
|
79
79
|
return this.executeSysSimpleSQL('sys_configs', keys_1.KeysOfSimpleSQL.SIMPLE_DELETE, {
|
|
80
80
|
validateCfg: {
|
|
81
|
-
'condition.id': [keys_1.KeysOfValidators.REQUIRED, keys_1.KeysOfValidators.
|
|
81
|
+
'condition.id': [keys_1.KeysOfValidators.REQUIRED, keys_1.KeysOfValidators.NUMERIC],
|
|
82
82
|
},
|
|
83
83
|
updateCfg: {
|
|
84
84
|
'condition.workbench_code': { contextAsString: bizmodels_1.CTX_WORKBENCH_CODE },
|
|
@@ -43,7 +43,7 @@ let UserAccountManageApi = class UserAccountManageApi extends BaseApiController_
|
|
|
43
43
|
async updateUserAccount() {
|
|
44
44
|
return this.executeSysSimpleSQL(SystemTables_1.SystemTables.sys_user_account, keys_1.KeysOfSimpleSQL.SIMPLE_UPDATE, {
|
|
45
45
|
validateCfg: {
|
|
46
|
-
'condition.id': [keys_1.KeysOfValidators.REQUIRED, keys_1.KeysOfValidators.
|
|
46
|
+
'condition.id': [keys_1.KeysOfValidators.REQUIRED, keys_1.KeysOfValidators.NUMERIC],
|
|
47
47
|
'data.login_name': LOGIN_NAME_VALIDATE,
|
|
48
48
|
'data.nick_name': [keys_1.KeysOfValidators.STRING, 'length:3,20', checkAccountCreateBlacklist],
|
|
49
49
|
},
|
|
@@ -70,7 +70,7 @@ let UserAccountManageApi = class UserAccountManageApi extends BaseApiController_
|
|
|
70
70
|
async deleteUserAccount() {
|
|
71
71
|
return this.executeSysSimpleSQL(SystemTables_1.SystemTables.sys_user_account, keys_1.KeysOfSimpleSQL.SIMPLE_DELETE, {
|
|
72
72
|
validateCfg: {
|
|
73
|
-
'condition.id': [keys_1.KeysOfValidators.REQUIRED, keys_1.KeysOfValidators.
|
|
73
|
+
'condition.id': [keys_1.KeysOfValidators.REQUIRED, keys_1.KeysOfValidators.NUMERIC],
|
|
74
74
|
},
|
|
75
75
|
});
|
|
76
76
|
}
|
|
@@ -43,7 +43,7 @@ let WorkbenchMangeApi = class WorkbenchMangeApi extends BaseApiController_1.Base
|
|
|
43
43
|
this.workbenchService.clearCache();
|
|
44
44
|
return this.executeSysSimpleSQL(SystemTables_1.SystemTables.sys_workbench, keys_1.KeysOfSimpleSQL.SIMPLE_UPDATE, {
|
|
45
45
|
validateCfg: {
|
|
46
|
-
'condition.id': [keys_1.KeysOfValidators.REQUIRED, keys_1.KeysOfValidators.
|
|
46
|
+
'condition.id': [keys_1.KeysOfValidators.REQUIRED, keys_1.KeysOfValidators.NUMERIC],
|
|
47
47
|
'condition.workbench_code': [keys_1.KeysOfValidators.REQUIRED, keys_1.KeysOfValidators.STRING],
|
|
48
48
|
},
|
|
49
49
|
});
|
|
@@ -53,7 +53,7 @@ let WorkbenchMangeApi = class WorkbenchMangeApi extends BaseApiController_1.Base
|
|
|
53
53
|
this.workbenchService.clearCache();
|
|
54
54
|
return this.executeSysSimpleSQL(SystemTables_1.SystemTables.sys_workbench, keys_1.KeysOfSimpleSQL.SIMPLE_DELETE, {
|
|
55
55
|
validateCfg: {
|
|
56
|
-
'condition.id': [keys_1.KeysOfValidators.REQUIRED, keys_1.KeysOfValidators.
|
|
56
|
+
'condition.id': [keys_1.KeysOfValidators.REQUIRED, keys_1.KeysOfValidators.NUMERIC],
|
|
57
57
|
'condition.workbench_code': [keys_1.KeysOfValidators.REQUIRED, keys_1.KeysOfValidators.STRING],
|
|
58
58
|
},
|
|
59
59
|
});
|
|
@@ -4,6 +4,7 @@ exports.CrudProCachedCfgService = void 0;
|
|
|
4
4
|
const humps_1 = require("humps");
|
|
5
5
|
const CrudProServiceBase_1 = require("./CrudProServiceBase");
|
|
6
6
|
const MixinUtils_1 = require("../utils/MixinUtils");
|
|
7
|
+
const convertMix_1 = require("../utils/sqlConvert/convertMix");
|
|
7
8
|
const MemoryRefreshCache_1 = require("../utils/MemoryRefreshCache");
|
|
8
9
|
const methodCache = new MemoryRefreshCache_1.default();
|
|
9
10
|
function parseMethodInfo(methodInfo) {
|
|
@@ -47,8 +48,8 @@ class CrudProCachedCfgService extends CrudProServiceBase_1.CrudProServiceBase {
|
|
|
47
48
|
sqlDatabase: sysDatabaseName,
|
|
48
49
|
sqlDbType: sysDatabaseDbType,
|
|
49
50
|
};
|
|
50
|
-
const
|
|
51
|
-
const rows2 =
|
|
51
|
+
const queryRes = await this.executeUnsafeQuery(baseInfo, sql, [method]);
|
|
52
|
+
const rows2 = (0, convertMix_1.pickAndConvertRowsByMix)(queryRes, sysDatabaseDbType);
|
|
52
53
|
if (rows2.length > 0) {
|
|
53
54
|
return parseMethodInfo(rows2[0]);
|
|
54
55
|
}
|
|
@@ -62,8 +63,8 @@ class CrudProCachedCfgService extends CrudProServiceBase_1.CrudProServiceBase {
|
|
|
62
63
|
sqlDatabase: sysDatabaseName,
|
|
63
64
|
sqlDbType: sysDatabaseDbType,
|
|
64
65
|
};
|
|
65
|
-
const
|
|
66
|
-
const rows2 =
|
|
66
|
+
const queryRes = await this.executeUnsafeQuery(baseInfo, sql);
|
|
67
|
+
const rows2 = (0, convertMix_1.pickAndConvertRowsByMix)(queryRes, sysDatabaseDbType);
|
|
67
68
|
return rows2.map(row => {
|
|
68
69
|
return parseMethodInfo(row);
|
|
69
70
|
});
|
|
@@ -5,7 +5,7 @@ const _ = require("lodash");
|
|
|
5
5
|
const CrudProServiceBase_1 = require("./CrudProServiceBase");
|
|
6
6
|
const keys_1 = require("../models/keys");
|
|
7
7
|
const exceptions_1 = require("../exceptions");
|
|
8
|
-
const
|
|
8
|
+
const convertMix_1 = require("../utils/sqlConvert/convertMix");
|
|
9
9
|
const convertPgSql_1 = require("../utils/sqlConvert/convertPgSql");
|
|
10
10
|
const convertMsSql_1 = require("../utils/sqlConvert/convertMsSql");
|
|
11
11
|
const ModelUtils_1 = require("../utils/ModelUtils");
|
|
@@ -30,7 +30,6 @@ class CrudProExecuteSqlService extends CrudProServiceBase_1.CrudProServiceBase {
|
|
|
30
30
|
const exeCtx = this.getExecuteContext();
|
|
31
31
|
const connection = await this.getTxConnectionBySqlCfg(sqlCfgModel);
|
|
32
32
|
const executeSqlArgs = this.handleExecuteSqlArgsByResModel(exeCtx, sqlCfgModel.executeSqlArgs || []);
|
|
33
|
-
let sqlRes;
|
|
34
33
|
let queryRes;
|
|
35
34
|
if (sqlCfgModel.sqlDbType === keys_1.SqlDbType.postgres) {
|
|
36
35
|
// import { PoolClient } from 'pg';
|
|
@@ -41,21 +40,17 @@ class CrudProExecuteSqlService extends CrudProServiceBase_1.CrudProServiceBase {
|
|
|
41
40
|
text: pgSql,
|
|
42
41
|
values: executeSqlArgs || [],
|
|
43
42
|
});
|
|
44
|
-
sqlRes = (0, convertPgType_1.pickAndConvertPgRows)(queryRes);
|
|
45
43
|
}
|
|
46
|
-
else if (sqlCfgModel.sqlDbType === keys_1.SqlDbType.sqlserver) {
|
|
44
|
+
else if (sqlCfgModel.sqlDbType === keys_1.SqlDbType.sqlserver) { // SQLServer
|
|
47
45
|
const mssql = (0, convertMsSql_1.replaceQuestionMarksForMssql)(sqlCfgModel.executeSql);
|
|
48
46
|
this.logger.info('executeSqlCfgModel_sqlserver', mssql, executeSqlArgs, sqlCfgModel.resPicker);
|
|
49
|
-
// SQLServer
|
|
50
47
|
queryRes = await connection.query(mssql, executeSqlArgs);
|
|
51
|
-
sqlRes = _.get(queryRes, 'recordsets[0]') || [];
|
|
52
48
|
}
|
|
53
|
-
else {
|
|
49
|
+
else { // MYSQL
|
|
54
50
|
this.logger.info('executeSqlCfgModel_mysql', sqlCfgModel.executeSql, executeSqlArgs, sqlCfgModel.resPicker);
|
|
55
|
-
// MYSQL
|
|
56
51
|
queryRes = await connection.query(sqlCfgModel.executeSql, executeSqlArgs);
|
|
57
|
-
sqlRes = queryRes[0];
|
|
58
52
|
}
|
|
53
|
+
const sqlRes = (0, convertMix_1.pickAndConvertRowsByMix)(queryRes, sqlCfgModel.sqlDbType);
|
|
59
54
|
const resObject = this.toQueryResByResPicker(sqlRes, queryRes, sqlCfgModel);
|
|
60
55
|
exeCtx.setResModelItem(sqlCfgModel.resName, resObject);
|
|
61
56
|
}
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.CrudProTableMetaService = void 0;
|
|
4
4
|
const CrudProServiceBase_1 = require("./CrudProServiceBase");
|
|
5
5
|
const keys_1 = require("../models/keys");
|
|
6
|
-
const
|
|
6
|
+
const convertMix_1 = require("../utils/sqlConvert/convertMix");
|
|
7
7
|
class CrudProTableMetaCache {
|
|
8
8
|
constructor() {
|
|
9
9
|
this.cacheMap = {};
|
|
@@ -50,7 +50,8 @@ class CrudProTableMetaService extends CrudProServiceBase_1.CrudProServiceBase {
|
|
|
50
50
|
}
|
|
51
51
|
async loadTableColumnInfo(baseInfo) {
|
|
52
52
|
if (baseInfo.sqlDbType === keys_1.SqlDbType.mysql) {
|
|
53
|
-
const
|
|
53
|
+
const queryRes = await this.executeUnsafeQuery(baseInfo, 'describe ' + baseInfo.sqlTable);
|
|
54
|
+
const tableDescribe = (0, convertMix_1.pickAndConvertRowsByMix)(queryRes, baseInfo.sqlDbType);
|
|
54
55
|
const tableDescribe2 = JSON.parse(JSON.stringify(tableDescribe));
|
|
55
56
|
return tableDescribe2.map(fieldObj => {
|
|
56
57
|
return fieldObj['Field'];
|
|
@@ -66,8 +67,8 @@ class CrudProTableMetaService extends CrudProServiceBase_1.CrudProServiceBase {
|
|
|
66
67
|
ORDER BY ordinal_position;
|
|
67
68
|
`.trim();
|
|
68
69
|
const queryRes = await this.executeUnsafeQuery(baseInfo, columnArraySql);
|
|
69
|
-
const
|
|
70
|
-
return
|
|
70
|
+
const tableDescribe = (0, convertMix_1.pickAndConvertRowsByMix)(queryRes, baseInfo.sqlDbType);
|
|
71
|
+
return tableDescribe.map(fieldObj => {
|
|
71
72
|
return fieldObj['column_name'];
|
|
72
73
|
});
|
|
73
74
|
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.pickAndConvertRowsByMix = void 0;
|
|
4
|
+
const keys_1 = require("../../models/keys");
|
|
5
|
+
const convertPgType_1 = require("./convertPgType");
|
|
6
|
+
const _ = require("lodash");
|
|
7
|
+
function pickAndConvertRowsByMix(connectionQueryRes, sqlDbType) {
|
|
8
|
+
if (!connectionQueryRes) {
|
|
9
|
+
throw new Error('[pickAndConvertRowsByMix] error, connectionQueryRes is null ');
|
|
10
|
+
}
|
|
11
|
+
if (sqlDbType === keys_1.SqlDbType.postgres) {
|
|
12
|
+
return (0, convertPgType_1.pickAndConvertPgRows)(connectionQueryRes);
|
|
13
|
+
}
|
|
14
|
+
if (sqlDbType === keys_1.SqlDbType.mysql) {
|
|
15
|
+
return connectionQueryRes[0];
|
|
16
|
+
}
|
|
17
|
+
if (sqlDbType === keys_1.SqlDbType.sqlserver) {
|
|
18
|
+
return _.get(connectionQueryRes, 'recordsets[0]') || [];
|
|
19
|
+
}
|
|
20
|
+
throw new Error('[pickAndConvertRowsByMix] error sqlDbType, sqlDbType = ' + sqlDbType);
|
|
21
|
+
}
|
|
22
|
+
exports.pickAndConvertRowsByMix = pickAndConvertRowsByMix;
|
|
@@ -20,7 +20,13 @@ const keys_1 = require("../../libs/crud-pro/models/keys");
|
|
|
20
20
|
const errorToString_1 = require("../../libs/utils/errorToString");
|
|
21
21
|
const schedule_1 = require("../../schedule");
|
|
22
22
|
const RedisKeys_1 = require("../../models/RedisKeys");
|
|
23
|
-
const END_STATUS_LIST = [
|
|
23
|
+
const END_STATUS_LIST = [
|
|
24
|
+
AsyncTaskModel_1.SysAsyncTaskStatus.PART_SUCCEEDED,
|
|
25
|
+
AsyncTaskModel_1.SysAsyncTaskStatus.SUCCEEDED,
|
|
26
|
+
AsyncTaskModel_1.SysAsyncTaskStatus.FAILED,
|
|
27
|
+
AsyncTaskModel_1.SysAsyncTaskStatus.CANCELLED,
|
|
28
|
+
AsyncTaskModel_1.SysAsyncTaskStatus.PAUSED,
|
|
29
|
+
];
|
|
24
30
|
class AsyncTaskRunner {
|
|
25
31
|
constructor() {
|
|
26
32
|
this.isBusy = false;
|
|
@@ -19,7 +19,7 @@ export declare class CrudStdService extends ApiBaseService {
|
|
|
19
19
|
/**
|
|
20
20
|
* 执行普通CRUD
|
|
21
21
|
*/
|
|
22
|
-
executeStdQuery(appCode: string, settingKey: string, params: IRequestModel, sqlSimpleName: KeysOfSimpleSQL): Promise<
|
|
22
|
+
executeStdQuery(appCode: string, settingKey: string, params: IRequestModel, sqlSimpleName: KeysOfSimpleSQL): Promise<any>;
|
|
23
23
|
/**
|
|
24
24
|
* 获取appInfo 并且拿到当前settingKey相关的信息
|
|
25
25
|
* @param appCode
|
|
@@ -37,6 +37,20 @@ let CrudStdService = class CrudStdService extends ApiBaseService_1.ApiBaseServic
|
|
|
37
37
|
if (!appInfo || appInfo.status !== 1) {
|
|
38
38
|
throw new devops_1.BizException('应用不存在或已下线:' + appCode);
|
|
39
39
|
}
|
|
40
|
+
// 查询列表功能
|
|
41
|
+
if (settingKey === exports.SPECIAL_SETTING_KEY.QUERY_LIST) {
|
|
42
|
+
// 正确启用了自定义查询功能
|
|
43
|
+
const customQueryApi = _.get(stdCrudCfgObj, 'othersSetting.values.customQueryApi');
|
|
44
|
+
if (typeof customQueryApi === 'string') {
|
|
45
|
+
const customQueryApiArr = customQueryApi.split('.');
|
|
46
|
+
const serviceName = customQueryApiArr[0] || "";
|
|
47
|
+
const serviceFunc = customQueryApiArr[1] || "";
|
|
48
|
+
if (serviceName.endsWith('Service')) {
|
|
49
|
+
const serviceObj = await this.ctx.requestContext.getAsync(serviceName);
|
|
50
|
+
return serviceObj[serviceFunc](params);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
40
54
|
const databaseName = stdCrudCfgObj.tableBaseInfo.databaseName;
|
|
41
55
|
const { dbType, dbName } = (0, DatabaseName_1.parseDatabaseName)(databaseName);
|
|
42
56
|
const cfgModel = {
|
package/package.json
CHANGED
|
@@ -7,6 +7,8 @@ import { GLOBAL_STATIC_CONFIG } from '@/libs/global-config/global-config';
|
|
|
7
7
|
import { UserAccountService } from '@/service/UserAccountService';
|
|
8
8
|
import { RelatedType } from '@/service/curd/CurdMixUtils';
|
|
9
9
|
import { BaseService } from '@/service/base/BaseService';
|
|
10
|
+
import * as moment from 'moment';
|
|
11
|
+
|
|
10
12
|
|
|
11
13
|
export interface IExecuteSimpleSqlParams {
|
|
12
14
|
updateCfg?: Record<string, IFuncCfgModel>;
|
|
@@ -75,6 +77,11 @@ export class BaseApiController extends BaseService {
|
|
|
75
77
|
//自动关联工作台基本信息
|
|
76
78
|
this.addWorkbenchBasicInfoCfgModel(cfgModel);
|
|
77
79
|
|
|
80
|
+
//sys系统表都是标准的,都有modified_at字段。
|
|
81
|
+
if(sqlSimpleName === KeysOfSimpleSQL.SIMPLE_UPDATE && body.data) {
|
|
82
|
+
body.data['modified_at'] = moment(Date.now()).format('YYYY-MM-DD HH:mm:ss.SSS');
|
|
83
|
+
}
|
|
84
|
+
|
|
78
85
|
return await this.curdMixService.executeCrudByCfg(body, cfgModel);
|
|
79
86
|
}
|
|
80
87
|
|
|
@@ -50,7 +50,7 @@ export class AnyApiMangeApi extends BaseApiController {
|
|
|
50
50
|
|
|
51
51
|
return this.executeSysSimpleSQL(SystemTables.sys_anyapi, KeysOfSimpleSQL.SIMPLE_UPDATE, {
|
|
52
52
|
validateCfg: {
|
|
53
|
-
'condition.id': [KeysOfValidators.REQUIRED, KeysOfValidators.
|
|
53
|
+
'condition.id': [KeysOfValidators.REQUIRED, KeysOfValidators.NUMERIC],
|
|
54
54
|
},
|
|
55
55
|
});
|
|
56
56
|
}
|
|
@@ -59,7 +59,7 @@ export class AnyApiMangeApi extends BaseApiController {
|
|
|
59
59
|
async deleteAnyApi() {
|
|
60
60
|
return this.executeSysSimpleSQL(SystemTables.sys_anyapi, KeysOfSimpleSQL.SIMPLE_DELETE, {
|
|
61
61
|
validateCfg: {
|
|
62
|
-
'condition.id': [KeysOfValidators.REQUIRED, KeysOfValidators.
|
|
62
|
+
'condition.id': [KeysOfValidators.REQUIRED, KeysOfValidators.NUMERIC],
|
|
63
63
|
},
|
|
64
64
|
});
|
|
65
65
|
}
|
|
@@ -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
|
});
|
|
@@ -35,7 +35,7 @@ export class AppMangeApi extends BaseApiController {
|
|
|
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
|
});
|
|
@@ -45,7 +45,7 @@ export class AppMangeApi extends BaseApiController {
|
|
|
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
|
});
|
|
@@ -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
|
}
|
|
@@ -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
|
}
|
|
@@ -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
|
}
|
|
@@ -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
|
}
|
|
@@ -46,7 +46,7 @@ export class DocLibManageApi extends BaseApiController {
|
|
|
46
46
|
async updateDocLib() {
|
|
47
47
|
return this.executeSysSimpleSQL(SystemTables.sys_doc_lib, KeysOfSimpleSQL.SIMPLE_UPDATE, {
|
|
48
48
|
validateCfg: {
|
|
49
|
-
'condition.id': [KeysOfValidators.REQUIRED, KeysOfValidators.
|
|
49
|
+
'condition.id': [KeysOfValidators.REQUIRED, KeysOfValidators.NUMERIC],
|
|
50
50
|
'data.title': [KeysOfValidators.REQUIRED, KeysOfValidators.STRING],
|
|
51
51
|
},
|
|
52
52
|
updateCfg: {
|
|
@@ -59,7 +59,7 @@ export class DocLibManageApi extends BaseApiController {
|
|
|
59
59
|
async deleteDocLib() {
|
|
60
60
|
return this.executeSysSimpleSQL(SystemTables.sys_doc_lib, KeysOfSimpleSQL.SIMPLE_DELETE, {
|
|
61
61
|
validateCfg: {
|
|
62
|
-
'condition.id': [KeysOfValidators.REQUIRED, KeysOfValidators.
|
|
62
|
+
'condition.id': [KeysOfValidators.REQUIRED, KeysOfValidators.NUMERIC],
|
|
63
63
|
},
|
|
64
64
|
updateCfg: {
|
|
65
65
|
'condition.workbench_code': { contextAsString: CTX_WORKBENCH_CODE },
|
|
@@ -76,7 +76,7 @@ export class DocManageApi extends BaseApiController {
|
|
|
76
76
|
const updateCfg = isPublish ? publishUpdateCfg : {};
|
|
77
77
|
return this.executeSysSimpleSQL('sys_doc', KeysOfSimpleSQL.SIMPLE_UPDATE, {
|
|
78
78
|
validateCfg: {
|
|
79
|
-
'condition.id': [KeysOfValidators.REQUIRED, KeysOfValidators.
|
|
79
|
+
'condition.id': [KeysOfValidators.REQUIRED, KeysOfValidators.NUMERIC],
|
|
80
80
|
},
|
|
81
81
|
updateCfg: {
|
|
82
82
|
...updateCfg,
|
|
@@ -89,7 +89,7 @@ export class DocManageApi extends BaseApiController {
|
|
|
89
89
|
async deleteDoc() {
|
|
90
90
|
return this.executeSysSimpleSQL('sys_doc', KeysOfSimpleSQL.SIMPLE_DELETE, {
|
|
91
91
|
validateCfg: {
|
|
92
|
-
'condition.id': [KeysOfValidators.REQUIRED, KeysOfValidators.
|
|
92
|
+
'condition.id': [KeysOfValidators.REQUIRED, KeysOfValidators.NUMERIC],
|
|
93
93
|
},
|
|
94
94
|
updateCfg: {
|
|
95
95
|
'condition.workbench_code': { contextAsString: CTX_WORKBENCH_CODE },
|
|
@@ -32,7 +32,7 @@ export class FileMangeApi extends BaseApiController {
|
|
|
32
32
|
async updateFile() {
|
|
33
33
|
return this.executeSysSimpleSQL(SystemTables.sys_file, KeysOfSimpleSQL.SIMPLE_UPDATE, {
|
|
34
34
|
validateCfg: {
|
|
35
|
-
'condition.id': [KeysOfValidators.REQUIRED, KeysOfValidators.
|
|
35
|
+
'condition.id': [KeysOfValidators.REQUIRED, KeysOfValidators.NUMERIC],
|
|
36
36
|
},
|
|
37
37
|
});
|
|
38
38
|
}
|
|
@@ -36,7 +36,7 @@ export class LowCodeTplManageApi extends BaseApiController {
|
|
|
36
36
|
async updateLowCodeTpl() {
|
|
37
37
|
return this.executeSysSimpleSQL(tableName, 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 LowCodeTplManageApi extends BaseApiController {
|
|
|
45
45
|
async deleteLowCodeTpl() {
|
|
46
46
|
return this.executeSysSimpleSQL(tableName, 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
|
}
|
|
@@ -40,7 +40,7 @@ export class MenuManageApi extends BaseApiController {
|
|
|
40
40
|
async updateMenu() {
|
|
41
41
|
return this.executeSysSimpleSQL(SystemTables.sys_menus, KeysOfSimpleSQL.SIMPLE_UPDATE, {
|
|
42
42
|
validateCfg: {
|
|
43
|
-
'condition.id': [KeysOfValidators.REQUIRED, KeysOfValidators.
|
|
43
|
+
'condition.id': [KeysOfValidators.REQUIRED, KeysOfValidators.NUMERIC],
|
|
44
44
|
},
|
|
45
45
|
updateCfg: {},
|
|
46
46
|
});
|
|
@@ -50,7 +50,7 @@ export class MenuManageApi extends BaseApiController {
|
|
|
50
50
|
async deleteMenu() {
|
|
51
51
|
return this.executeSysSimpleSQL(SystemTables.sys_menus, KeysOfSimpleSQL.SIMPLE_DELETE, {
|
|
52
52
|
validateCfg: {
|
|
53
|
-
'condition.id': [KeysOfValidators.REQUIRED, KeysOfValidators.
|
|
53
|
+
'condition.id': [KeysOfValidators.REQUIRED, KeysOfValidators.NUMERIC],
|
|
54
54
|
},
|
|
55
55
|
updateCfg: {},
|
|
56
56
|
});
|
|
@@ -36,7 +36,7 @@ export class ProxyApiMangeApi extends BaseApiController {
|
|
|
36
36
|
async updateProxyApi() {
|
|
37
37
|
return this.executeSysSimpleSQL(SystemTables.sys_proxyapi, 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 ProxyApiMangeApi extends BaseApiController {
|
|
|
45
45
|
async deleteProxyApi() {
|
|
46
46
|
return this.executeSysSimpleSQL(SystemTables.sys_proxyapi, 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
|
}
|
|
@@ -73,7 +73,7 @@ export class SysConfigMangeApi extends BaseApiController {
|
|
|
73
73
|
return this.executeSysSimpleSQL('sys_configs', KeysOfSimpleSQL.SIMPLE_UPDATE, {
|
|
74
74
|
validateCfg: {
|
|
75
75
|
'data.workbench_code': [KeysOfValidators.REQUIRED, KeysOfValidators.STRING, 'length:1,64'],
|
|
76
|
-
'condition.id': [KeysOfValidators.REQUIRED, KeysOfValidators.
|
|
76
|
+
'condition.id': [KeysOfValidators.REQUIRED, KeysOfValidators.NUMERIC],
|
|
77
77
|
},
|
|
78
78
|
updateCfg: {
|
|
79
79
|
'condition.workbench_code': { contextAsString: CTX_WORKBENCH_CODE },
|
|
@@ -85,7 +85,7 @@ export class SysConfigMangeApi extends BaseApiController {
|
|
|
85
85
|
async deleteSysConfig() {
|
|
86
86
|
return this.executeSysSimpleSQL('sys_configs', KeysOfSimpleSQL.SIMPLE_DELETE, {
|
|
87
87
|
validateCfg: {
|
|
88
|
-
'condition.id': [KeysOfValidators.REQUIRED, KeysOfValidators.
|
|
88
|
+
'condition.id': [KeysOfValidators.REQUIRED, KeysOfValidators.NUMERIC],
|
|
89
89
|
},
|
|
90
90
|
updateCfg: {
|
|
91
91
|
'condition.workbench_code': { contextAsString: CTX_WORKBENCH_CODE },
|
|
@@ -44,7 +44,7 @@ export class UserAccountManageApi extends BaseApiController {
|
|
|
44
44
|
async updateUserAccount() {
|
|
45
45
|
return this.executeSysSimpleSQL(SystemTables.sys_user_account, KeysOfSimpleSQL.SIMPLE_UPDATE, {
|
|
46
46
|
validateCfg: {
|
|
47
|
-
'condition.id': [KeysOfValidators.REQUIRED, KeysOfValidators.
|
|
47
|
+
'condition.id': [KeysOfValidators.REQUIRED, KeysOfValidators.NUMERIC],
|
|
48
48
|
'data.login_name': LOGIN_NAME_VALIDATE,
|
|
49
49
|
'data.nick_name': [KeysOfValidators.STRING, 'length:3,20', checkAccountCreateBlacklist],
|
|
50
50
|
},
|
|
@@ -77,7 +77,7 @@ export class UserAccountManageApi extends BaseApiController {
|
|
|
77
77
|
async deleteUserAccount() {
|
|
78
78
|
return this.executeSysSimpleSQL(SystemTables.sys_user_account, KeysOfSimpleSQL.SIMPLE_DELETE, {
|
|
79
79
|
validateCfg: {
|
|
80
|
-
'condition.id': [KeysOfValidators.REQUIRED, KeysOfValidators.
|
|
80
|
+
'condition.id': [KeysOfValidators.REQUIRED, KeysOfValidators.NUMERIC],
|
|
81
81
|
},
|
|
82
82
|
});
|
|
83
83
|
}
|
|
@@ -51,7 +51,7 @@ export class WorkbenchMangeApi extends BaseApiController {
|
|
|
51
51
|
|
|
52
52
|
return this.executeSysSimpleSQL(SystemTables.sys_workbench, KeysOfSimpleSQL.SIMPLE_UPDATE, {
|
|
53
53
|
validateCfg: {
|
|
54
|
-
'condition.id': [KeysOfValidators.REQUIRED, KeysOfValidators.
|
|
54
|
+
'condition.id': [KeysOfValidators.REQUIRED, KeysOfValidators.NUMERIC],
|
|
55
55
|
'condition.workbench_code': [KeysOfValidators.REQUIRED, KeysOfValidators.STRING],
|
|
56
56
|
},
|
|
57
57
|
});
|
|
@@ -64,7 +64,7 @@ export class WorkbenchMangeApi extends BaseApiController {
|
|
|
64
64
|
|
|
65
65
|
return this.executeSysSimpleSQL(SystemTables.sys_workbench, KeysOfSimpleSQL.SIMPLE_DELETE, {
|
|
66
66
|
validateCfg: {
|
|
67
|
-
'condition.id': [KeysOfValidators.REQUIRED, KeysOfValidators.
|
|
67
|
+
'condition.id': [KeysOfValidators.REQUIRED, KeysOfValidators.NUMERIC],
|
|
68
68
|
'condition.workbench_code': [KeysOfValidators.REQUIRED, KeysOfValidators.STRING],
|
|
69
69
|
},
|
|
70
70
|
});
|
|
@@ -3,8 +3,10 @@ import { CrudProServiceBase } from './CrudProServiceBase';
|
|
|
3
3
|
import { IRequestCfgModel } from '../interfaces';
|
|
4
4
|
import { MixinUtils } from '../utils/MixinUtils';
|
|
5
5
|
import { ICurdProServiceHub } from '../models/ServiceHub';
|
|
6
|
+
import { pickAndConvertRowsByMix } from '../utils/sqlConvert/convertMix';
|
|
6
7
|
import MemoryRefreshCache from '../utils/MemoryRefreshCache';
|
|
7
8
|
|
|
9
|
+
|
|
8
10
|
const methodCache = new MemoryRefreshCache();
|
|
9
11
|
|
|
10
12
|
function parseMethodInfo(methodInfo: any): any {
|
|
@@ -55,8 +57,8 @@ class CrudProCachedCfgService extends CrudProServiceBase {
|
|
|
55
57
|
sqlDbType: sysDatabaseDbType,
|
|
56
58
|
};
|
|
57
59
|
|
|
58
|
-
const
|
|
59
|
-
const rows2: any[] =
|
|
60
|
+
const queryRes = await this.executeUnsafeQuery(baseInfo, sql, [method]);
|
|
61
|
+
const rows2: any[] = pickAndConvertRowsByMix(queryRes, sysDatabaseDbType)
|
|
60
62
|
if (rows2.length > 0) {
|
|
61
63
|
return parseMethodInfo(rows2[0]);
|
|
62
64
|
}
|
|
@@ -71,8 +73,8 @@ class CrudProCachedCfgService extends CrudProServiceBase {
|
|
|
71
73
|
sqlDatabase: sysDatabaseName,
|
|
72
74
|
sqlDbType: sysDatabaseDbType,
|
|
73
75
|
};
|
|
74
|
-
const
|
|
75
|
-
const rows2: any[] =
|
|
76
|
+
const queryRes = await this.executeUnsafeQuery(baseInfo, sql);
|
|
77
|
+
const rows2: any[] = pickAndConvertRowsByMix(queryRes, sysDatabaseDbType)
|
|
76
78
|
return rows2.map(row => {
|
|
77
79
|
return parseMethodInfo(row);
|
|
78
80
|
});
|
|
@@ -4,7 +4,7 @@ import { CrudProServiceBase } from './CrudProServiceBase';
|
|
|
4
4
|
import { SqlCfgModel } from '../models/SqlCfgModel';
|
|
5
5
|
import { KeyOfCrudTypes, KeysOfCustomSQL, KeysOfSqlResPicker, SqlDbType } from '../models/keys';
|
|
6
6
|
import { CommonException, Exceptions } from '../exceptions';
|
|
7
|
-
import {
|
|
7
|
+
import { pickAndConvertRowsByMix } from '../utils/sqlConvert/convertMix';
|
|
8
8
|
import { replaceQuestionMarks } from '../utils/sqlConvert/convertPgSql';
|
|
9
9
|
import { replaceQuestionMarksForMssql } from '../utils/sqlConvert/convertMsSql';
|
|
10
10
|
import { ModelUtils } from '../utils/ModelUtils';
|
|
@@ -35,7 +35,6 @@ class CrudProExecuteSqlService extends CrudProServiceBase {
|
|
|
35
35
|
const connection = await this.getTxConnectionBySqlCfg(sqlCfgModel);
|
|
36
36
|
const executeSqlArgs = this.handleExecuteSqlArgsByResModel(exeCtx, sqlCfgModel.executeSqlArgs || []);
|
|
37
37
|
|
|
38
|
-
let sqlRes: any;
|
|
39
38
|
let queryRes: any;
|
|
40
39
|
|
|
41
40
|
if (sqlCfgModel.sqlDbType === SqlDbType.postgres) {
|
|
@@ -43,29 +42,26 @@ class CrudProExecuteSqlService extends CrudProServiceBase {
|
|
|
43
42
|
|
|
44
43
|
const pgClient: PoolClient = connection as any;
|
|
45
44
|
const pgSql = replaceQuestionMarks(sqlCfgModel.executeSql);
|
|
46
|
-
|
|
47
45
|
this.logger.info('executeSqlCfgModel_postgres', pgSql, executeSqlArgs, sqlCfgModel.resPicker);
|
|
48
|
-
|
|
49
46
|
queryRes = await pgClient.query({
|
|
50
47
|
text: pgSql,
|
|
51
48
|
values: executeSqlArgs || [],
|
|
52
49
|
});
|
|
53
|
-
sqlRes = pickAndConvertPgRows(queryRes);
|
|
54
|
-
} else if (sqlCfgModel.sqlDbType === SqlDbType.sqlserver) {
|
|
55
|
-
const mssql = replaceQuestionMarksForMssql(sqlCfgModel.executeSql);
|
|
56
50
|
|
|
51
|
+
} else if (sqlCfgModel.sqlDbType === SqlDbType.sqlserver) { // SQLServer
|
|
52
|
+
|
|
53
|
+
const mssql = replaceQuestionMarksForMssql(sqlCfgModel.executeSql);
|
|
57
54
|
this.logger.info('executeSqlCfgModel_sqlserver', mssql, executeSqlArgs, sqlCfgModel.resPicker);
|
|
58
|
-
// SQLServer
|
|
59
55
|
queryRes = await connection.query(mssql, executeSqlArgs);
|
|
60
|
-
sqlRes = _.get(queryRes, 'recordsets[0]') || [];
|
|
61
|
-
} else {
|
|
62
|
-
this.logger.info('executeSqlCfgModel_mysql', sqlCfgModel.executeSql, executeSqlArgs, sqlCfgModel.resPicker);
|
|
63
56
|
|
|
64
|
-
|
|
57
|
+
} else { // MYSQL
|
|
58
|
+
|
|
59
|
+
this.logger.info('executeSqlCfgModel_mysql', sqlCfgModel.executeSql, executeSqlArgs, sqlCfgModel.resPicker);
|
|
65
60
|
queryRes = await connection.query(sqlCfgModel.executeSql, executeSqlArgs);
|
|
66
|
-
|
|
61
|
+
|
|
67
62
|
}
|
|
68
63
|
|
|
64
|
+
const sqlRes = pickAndConvertRowsByMix(queryRes, sqlCfgModel.sqlDbType);
|
|
69
65
|
const resObject = this.toQueryResByResPicker(sqlRes, queryRes, sqlCfgModel);
|
|
70
66
|
exeCtx.setResModelItem(sqlCfgModel.resName, resObject);
|
|
71
67
|
}
|
|
@@ -2,7 +2,7 @@ import { CrudProServiceBase } from './CrudProServiceBase';
|
|
|
2
2
|
import { SqlCfgModel } from '../models/SqlCfgModel';
|
|
3
3
|
import { IExecuteUnsafeQueryCtx, ITableMeta } from '../interfaces';
|
|
4
4
|
import { SqlDbType } from '../models/keys';
|
|
5
|
-
import {
|
|
5
|
+
import { pickAndConvertRowsByMix } from '../utils/sqlConvert/convertMix';
|
|
6
6
|
|
|
7
7
|
class CrudProTableMetaCache {
|
|
8
8
|
private cacheMap: Record<string, ITableMeta> = {};
|
|
@@ -57,7 +57,8 @@ class CrudProTableMetaService extends CrudProServiceBase {
|
|
|
57
57
|
|
|
58
58
|
private async loadTableColumnInfo(baseInfo: IExecuteUnsafeQueryCtx): Promise<string[]> {
|
|
59
59
|
if (baseInfo.sqlDbType === SqlDbType.mysql) {
|
|
60
|
-
const
|
|
60
|
+
const queryRes = await this.executeUnsafeQuery(baseInfo, 'describe ' + baseInfo.sqlTable);
|
|
61
|
+
const tableDescribe = pickAndConvertRowsByMix(queryRes, baseInfo.sqlDbType);
|
|
61
62
|
const tableDescribe2 = JSON.parse(JSON.stringify(tableDescribe));
|
|
62
63
|
return tableDescribe2.map(fieldObj => {
|
|
63
64
|
return fieldObj['Field'];
|
|
@@ -72,8 +73,8 @@ class CrudProTableMetaService extends CrudProServiceBase {
|
|
|
72
73
|
ORDER BY ordinal_position;
|
|
73
74
|
`.trim();
|
|
74
75
|
const queryRes = await this.executeUnsafeQuery(baseInfo, columnArraySql);
|
|
75
|
-
const
|
|
76
|
-
return
|
|
76
|
+
const tableDescribe = pickAndConvertRowsByMix(queryRes, baseInfo.sqlDbType);
|
|
77
|
+
return tableDescribe.map(fieldObj => {
|
|
77
78
|
return fieldObj['column_name'];
|
|
78
79
|
});
|
|
79
80
|
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { SqlDbType } from "../../models/keys";
|
|
2
|
+
import { pickAndConvertPgRows } from "./convertPgType";
|
|
3
|
+
import * as _ from 'lodash'
|
|
4
|
+
|
|
5
|
+
function pickAndConvertRowsByMix(connectionQueryRes: any, sqlDbType: SqlDbType): any[] | any {
|
|
6
|
+
if (!connectionQueryRes) {
|
|
7
|
+
throw new Error('[pickAndConvertRowsByMix] error, connectionQueryRes is null ')
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
if (sqlDbType === SqlDbType.postgres) {
|
|
11
|
+
return pickAndConvertPgRows(connectionQueryRes);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
if (sqlDbType === SqlDbType.mysql) {
|
|
15
|
+
return connectionQueryRes[0];
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
if (sqlDbType === SqlDbType.sqlserver) {
|
|
19
|
+
return _.get(connectionQueryRes, 'recordsets[0]') || [];
|
|
20
|
+
}
|
|
21
|
+
throw new Error('[pickAndConvertRowsByMix] error sqlDbType, sqlDbType = ' + sqlDbType)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export {
|
|
25
|
+
pickAndConvertRowsByMix
|
|
26
|
+
}
|
|
@@ -11,7 +11,13 @@ import { errorToString } from '@/libs/utils/errorToString';
|
|
|
11
11
|
import { ANONYMOUS_CONTEXT } from '@/schedule';
|
|
12
12
|
import { RedisKeys } from '@/models/RedisKeys';
|
|
13
13
|
|
|
14
|
-
const END_STATUS_LIST = [
|
|
14
|
+
const END_STATUS_LIST = [
|
|
15
|
+
SysAsyncTaskStatus.PART_SUCCEEDED,
|
|
16
|
+
SysAsyncTaskStatus.SUCCEEDED,
|
|
17
|
+
SysAsyncTaskStatus.FAILED,
|
|
18
|
+
SysAsyncTaskStatus.CANCELLED,
|
|
19
|
+
SysAsyncTaskStatus.PAUSED,
|
|
20
|
+
];
|
|
15
21
|
|
|
16
22
|
class AsyncTaskRunner {
|
|
17
23
|
isBusy = false;
|
|
@@ -27,7 +33,7 @@ class AsyncTaskRunner {
|
|
|
27
33
|
for (let i = 0; i < taskList.length; i++) {
|
|
28
34
|
const taskElement = taskList[i];
|
|
29
35
|
taskElement.task_status = SysAsyncTaskStatus.RUNNING;
|
|
30
|
-
|
|
36
|
+
|
|
31
37
|
try {
|
|
32
38
|
// 任务状态的设置在自定义的执行器里面。
|
|
33
39
|
await this.executeTask(taskElement);
|
|
@@ -46,6 +46,23 @@ export class CrudStdService extends ApiBaseService {
|
|
|
46
46
|
throw new BizException('应用不存在或已下线:' + appCode);
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
+
|
|
50
|
+
// 查询列表功能
|
|
51
|
+
if(settingKey === SPECIAL_SETTING_KEY.QUERY_LIST) {
|
|
52
|
+
// 正确启用了自定义查询功能
|
|
53
|
+
const customQueryApi:string = _.get(stdCrudCfgObj, 'othersSetting.values.customQueryApi');
|
|
54
|
+
if(typeof customQueryApi === 'string') {
|
|
55
|
+
const customQueryApiArr = customQueryApi.split('.');
|
|
56
|
+
const serviceName = customQueryApiArr[0] || "";
|
|
57
|
+
const serviceFunc = customQueryApiArr[1] || "";
|
|
58
|
+
if(serviceName.endsWith('Service')){
|
|
59
|
+
const serviceObj = await this.ctx.requestContext.getAsync(serviceName);
|
|
60
|
+
return serviceObj[serviceFunc](params);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
|
|
49
66
|
const databaseName = stdCrudCfgObj.tableBaseInfo.databaseName;
|
|
50
67
|
|
|
51
68
|
const { dbType, dbName } = parseDatabaseName(databaseName);
|