midway-fatcms 0.0.1-beta.7 → 0.0.1-beta.8
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/gateway/CrudMtdGatewayController.js +3 -0
- package/dist/libs/global-config/global-config.d.ts +10 -2
- package/dist/libs/global-config/global-config.js +7 -4
- package/dist/service/crudstd/CrudStdService.js +1 -1
- package/package.json +1 -1
- package/src/controller/gateway/CrudMtdGatewayController.ts +5 -1
- package/src/libs/global-config/global-config.ts +41 -36
- package/src/service/anyapi/AnyApiService.ts +0 -2
- package/src/service/crudstd/CrudStdService.ts +1 -1
|
@@ -22,6 +22,7 @@ const ApiBaseService_1 = require("../../service/base/ApiBaseService");
|
|
|
22
22
|
const CurdProService_1 = require("../../service/curd/CurdProService");
|
|
23
23
|
const CurdMixService_1 = require("../../service/curd/CurdMixService");
|
|
24
24
|
const DatabaseName_1 = require("../../libs/crud-pro/utils/DatabaseName");
|
|
25
|
+
const global_config_1 = require("../../libs/global-config/global-config");
|
|
25
26
|
const QUERY_AS_LIST = ['condition', 'data'];
|
|
26
27
|
function pickAsQuery(query_as_pick, query) {
|
|
27
28
|
if (query_as_pick && typeof query_as_pick === 'string') {
|
|
@@ -84,6 +85,8 @@ let CrudMtdGatewayController = class CrudMtdGatewayController extends ApiBaseSer
|
|
|
84
85
|
const { dbType, dbName } = (0, DatabaseName_1.parseDatabaseName)(cfgModel.sqlDatabase);
|
|
85
86
|
cfgModel.sqlDatabase = dbName;
|
|
86
87
|
cfgModel.sqlDdType = dbType;
|
|
88
|
+
// 业务系统自定义的修改cfgModel
|
|
89
|
+
await global_config_1.GLOBAL_STATIC_CONFIG.getConfig().bizUpdateCfgModelForCrudMtd(cfgModel, methodInfo, this.ctx);
|
|
87
90
|
return this.curdMixService.executeCrudByCfg(reqJson, cfgModel);
|
|
88
91
|
}
|
|
89
92
|
};
|
|
@@ -1,11 +1,19 @@
|
|
|
1
|
-
import { SqlDbType } from
|
|
1
|
+
import { SqlDbType } from '../crud-pro/models/keys';
|
|
2
2
|
interface IGlobalStaticConfig {
|
|
3
3
|
/**
|
|
4
4
|
* CrudStd: 业务系统自定义的修改cfgModel
|
|
5
5
|
* @param cfgModel
|
|
6
6
|
* @param appInfo
|
|
7
|
+
* @param ctx
|
|
7
8
|
*/
|
|
8
|
-
|
|
9
|
+
bizUpdateCfgModelForCrudStd(cfgModel: any, appInfo: any, ctx: any): Promise<any>;
|
|
10
|
+
/**
|
|
11
|
+
* CrudMtd: 业务系统自定义的修改cfgModel
|
|
12
|
+
* @param cfgModel
|
|
13
|
+
* @param methodInfo
|
|
14
|
+
* @param ctx
|
|
15
|
+
*/
|
|
16
|
+
bizUpdateCfgModelForCrudMtd(cfgModel: any, methodInfo: any, ctx: any): Promise<any>;
|
|
9
17
|
SystemDbName: string;
|
|
10
18
|
SystemDbType: SqlDbType;
|
|
11
19
|
}
|
|
@@ -2,13 +2,16 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.GLOBAL_STATIC_CONFIG = void 0;
|
|
4
4
|
const keys_1 = require("../crud-pro/models/keys");
|
|
5
|
-
|
|
5
|
+
const noop = () => {
|
|
6
|
+
return Promise.resolve();
|
|
7
|
+
};
|
|
6
8
|
class GlobalStaticConfig {
|
|
7
9
|
constructor() {
|
|
8
10
|
this.configObject = {
|
|
9
|
-
|
|
11
|
+
bizUpdateCfgModelForCrudStd: noop,
|
|
12
|
+
bizUpdateCfgModelForCrudMtd: noop,
|
|
10
13
|
SystemDbName: 'fatcms',
|
|
11
|
-
SystemDbType: keys_1.SqlDbType.mysql
|
|
14
|
+
SystemDbType: keys_1.SqlDbType.mysql,
|
|
12
15
|
};
|
|
13
16
|
}
|
|
14
17
|
getConfig() {
|
|
@@ -16,7 +19,7 @@ class GlobalStaticConfig {
|
|
|
16
19
|
}
|
|
17
20
|
setConfig(configObject) {
|
|
18
21
|
if (!configObject || typeof configObject !== 'object') {
|
|
19
|
-
throw new Error(
|
|
22
|
+
throw new Error('参数configObject不能为空');
|
|
20
23
|
}
|
|
21
24
|
Object.assign(this.configObject, configObject);
|
|
22
25
|
}
|
|
@@ -55,7 +55,7 @@ let CrudStdService = class CrudStdService extends ApiBaseService_1.ApiBaseServic
|
|
|
55
55
|
// 根据用户配置,设置关联查询的数据信息。
|
|
56
56
|
await this.crudStdRelationService.addCfgModelColumnsRelation(cfgModel, appInfo);
|
|
57
57
|
// 业务系统自定义的修改cfgModel
|
|
58
|
-
await global_config_1.GLOBAL_STATIC_CONFIG.getConfig().
|
|
58
|
+
await global_config_1.GLOBAL_STATIC_CONFIG.getConfig().bizUpdateCfgModelForCrudStd(cfgModel, appInfo, this.ctx);
|
|
59
59
|
return await this.curdMixService.executeCrudByCfg(params, cfgModel);
|
|
60
60
|
}
|
|
61
61
|
/**
|
package/package.json
CHANGED
|
@@ -8,7 +8,8 @@ import { API_BASE_TYPE, ApiBaseService } from '../../service/base/ApiBaseService
|
|
|
8
8
|
import { CurdProService } from '../../service/curd/CurdProService';
|
|
9
9
|
import { CurdMixService } from '../../service/curd/CurdMixService';
|
|
10
10
|
import { IRequestCfgModel2 } from '../../models/bizmodels';
|
|
11
|
-
import {parseDatabaseName} from "../../libs/crud-pro/utils/DatabaseName";
|
|
11
|
+
import { parseDatabaseName } from "../../libs/crud-pro/utils/DatabaseName";
|
|
12
|
+
import { GLOBAL_STATIC_CONFIG } from '@/libs/global-config/global-config';
|
|
12
13
|
|
|
13
14
|
const QUERY_AS_LIST = ['condition', 'data'];
|
|
14
15
|
|
|
@@ -102,6 +103,9 @@ export class CrudMtdGatewayController extends ApiBaseService {
|
|
|
102
103
|
cfgModel.sqlDatabase = dbName;
|
|
103
104
|
cfgModel.sqlDdType = dbType;
|
|
104
105
|
|
|
106
|
+
// 业务系统自定义的修改cfgModel
|
|
107
|
+
await GLOBAL_STATIC_CONFIG.getConfig().bizUpdateCfgModelForCrudMtd(cfgModel, methodInfo, this.ctx);
|
|
108
|
+
|
|
105
109
|
return this.curdMixService.executeCrudByCfg(reqJson, cfgModel);
|
|
106
110
|
}
|
|
107
111
|
}
|
|
@@ -1,47 +1,52 @@
|
|
|
1
|
-
import { SqlDbType } from
|
|
1
|
+
import { SqlDbType } from '../crud-pro/models/keys';
|
|
2
2
|
|
|
3
3
|
interface IGlobalStaticConfig {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
4
|
+
/**
|
|
5
|
+
* CrudStd: 业务系统自定义的修改cfgModel
|
|
6
|
+
* @param cfgModel
|
|
7
|
+
* @param appInfo
|
|
8
|
+
* @param ctx
|
|
9
|
+
*/
|
|
10
|
+
bizUpdateCfgModelForCrudStd(cfgModel: any, appInfo: any, ctx: any): Promise<any>;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* CrudMtd: 业务系统自定义的修改cfgModel
|
|
14
|
+
* @param cfgModel
|
|
15
|
+
* @param methodInfo
|
|
16
|
+
* @param ctx
|
|
17
|
+
*/
|
|
18
|
+
bizUpdateCfgModelForCrudMtd(cfgModel: any, methodInfo: any, ctx: any): Promise<any>;
|
|
19
|
+
|
|
20
|
+
SystemDbName: string;
|
|
21
|
+
SystemDbType: SqlDbType;
|
|
13
22
|
}
|
|
14
23
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
24
|
+
const noop = () => {
|
|
25
|
+
return Promise.resolve();
|
|
26
|
+
};
|
|
18
27
|
|
|
19
28
|
class GlobalStaticConfig {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
Object.assign(this.configObject, configObject)
|
|
29
|
+
private configObject: IGlobalStaticConfig;
|
|
30
|
+
constructor() {
|
|
31
|
+
this.configObject = {
|
|
32
|
+
bizUpdateCfgModelForCrudStd: noop,
|
|
33
|
+
bizUpdateCfgModelForCrudMtd: noop,
|
|
34
|
+
SystemDbName: 'fatcms',
|
|
35
|
+
SystemDbType: SqlDbType.mysql,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
public getConfig(): IGlobalStaticConfig {
|
|
39
|
+
return this.configObject as IGlobalStaticConfig;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
public setConfig(configObject: any) {
|
|
43
|
+
if (!configObject || typeof configObject !== 'object') {
|
|
44
|
+
throw new Error('参数configObject不能为空');
|
|
37
45
|
}
|
|
46
|
+
Object.assign(this.configObject, configObject);
|
|
47
|
+
}
|
|
38
48
|
}
|
|
39
49
|
|
|
40
|
-
|
|
41
50
|
const GLOBAL_STATIC_CONFIG = new GlobalStaticConfig();
|
|
42
51
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
export {
|
|
46
|
-
GLOBAL_STATIC_CONFIG
|
|
47
|
-
}
|
|
52
|
+
export { GLOBAL_STATIC_CONFIG };
|
|
@@ -81,10 +81,8 @@ export class AnyApiService extends ApiBaseService {
|
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
private async _getAnyApiMethod(methodCode: string): Promise<ISysAnyApiEntity> {
|
|
84
|
-
|
|
85
84
|
const { SystemDbName, SystemDbType } = GLOBAL_STATIC_CONFIG.getConfig();
|
|
86
85
|
|
|
87
|
-
|
|
88
86
|
const res = await this.curdMixService.executeCrudByCfg(
|
|
89
87
|
{ condition: { method: methodCode } },
|
|
90
88
|
{
|
|
@@ -70,7 +70,7 @@ export class CrudStdService extends ApiBaseService {
|
|
|
70
70
|
await this.crudStdRelationService.addCfgModelColumnsRelation(cfgModel, appInfo);
|
|
71
71
|
|
|
72
72
|
// 业务系统自定义的修改cfgModel
|
|
73
|
-
await GLOBAL_STATIC_CONFIG.getConfig().
|
|
73
|
+
await GLOBAL_STATIC_CONFIG.getConfig().bizUpdateCfgModelForCrudStd(cfgModel, appInfo, this.ctx);
|
|
74
74
|
|
|
75
75
|
return await this.curdMixService.executeCrudByCfg(params, cfgModel);
|
|
76
76
|
}
|