midway-fatcms 0.0.1-beta.58 → 0.0.1-beta.60
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.
|
@@ -32,7 +32,7 @@ exports.SPECIAL_SETTING_KEY = {
|
|
|
32
32
|
function isNotEmptyStr(str) {
|
|
33
33
|
return typeof str === 'string' && str.trim().length > 0;
|
|
34
34
|
}
|
|
35
|
-
function getExecuteTableNameBySettingKey(appInfo, stdAction) {
|
|
35
|
+
function getExecuteTableNameBySettingKey(appInfo, stdAction, sqlSimpleName) {
|
|
36
36
|
const { settingKey } = stdAction || {};
|
|
37
37
|
const stdCrudCfgObj = appInfo.stdCrudCfgObj;
|
|
38
38
|
const actionsMap = appInfo.actionsMap || {};
|
|
@@ -44,10 +44,12 @@ function getExecuteTableNameBySettingKey(appInfo, stdAction) {
|
|
|
44
44
|
return mainTableName.trim();
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
47
|
+
if (sqlSimpleName === keys_1.KeysOfSimpleSQL.SIMPLE_DELETE || sqlSimpleName === keys_1.KeysOfSimpleSQL.SIMPLE_INSERT || sqlSimpleName === keys_1.KeysOfSimpleSQL.SIMPLE_UPDATE) {
|
|
48
|
+
// 全局配置了mainTableName字段
|
|
49
|
+
const globalMainTableName = _.get(stdCrudCfgObj, 'othersSetting.values.globalMainTableName');
|
|
50
|
+
if (isNotEmptyStr(globalMainTableName)) {
|
|
51
|
+
return globalMainTableName.trim();
|
|
52
|
+
}
|
|
51
53
|
}
|
|
52
54
|
// 视图中配置的表。
|
|
53
55
|
return stdCrudCfgObj.tableBaseInfo.tableName;
|
|
@@ -68,7 +70,7 @@ let CrudStdService = class CrudStdService extends ApiBaseService_1.ApiBaseServic
|
|
|
68
70
|
const cfgModel = {
|
|
69
71
|
sqlDatabase: dbName,
|
|
70
72
|
sqlDbType: dbType,
|
|
71
|
-
sqlTable: getExecuteTableNameBySettingKey(appInfo, stdAction),
|
|
73
|
+
sqlTable: getExecuteTableNameBySettingKey(appInfo, stdAction, sqlSimpleName),
|
|
72
74
|
sqlSimpleName,
|
|
73
75
|
updateCfg: {}
|
|
74
76
|
};
|
package/package.json
CHANGED
|
@@ -40,7 +40,7 @@ function isNotEmptyStr(str: any): boolean {
|
|
|
40
40
|
return typeof str === 'string' && str.trim().length > 0;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
function getExecuteTableNameBySettingKey(appInfo: ICrudStdAppInfoForSettingKey, stdAction: ICrudStdActionParams): string {
|
|
43
|
+
function getExecuteTableNameBySettingKey(appInfo: ICrudStdAppInfoForSettingKey, stdAction: ICrudStdActionParams, sqlSimpleName: KeysOfSimpleSQL): string {
|
|
44
44
|
const { settingKey } = stdAction || {};
|
|
45
45
|
|
|
46
46
|
const stdCrudCfgObj = appInfo.stdCrudCfgObj;
|
|
@@ -56,12 +56,15 @@ function getExecuteTableNameBySettingKey(appInfo: ICrudStdAppInfoForSettingKey,
|
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
59
|
+
if (sqlSimpleName === KeysOfSimpleSQL.SIMPLE_DELETE || sqlSimpleName === KeysOfSimpleSQL.SIMPLE_INSERT || sqlSimpleName === KeysOfSimpleSQL.SIMPLE_UPDATE) {
|
|
60
|
+
// 全局配置了mainTableName字段
|
|
61
|
+
const globalMainTableName: string = _.get(stdCrudCfgObj, 'othersSetting.values.globalMainTableName');
|
|
62
|
+
if (isNotEmptyStr(globalMainTableName)) {
|
|
63
|
+
return globalMainTableName.trim();
|
|
64
|
+
}
|
|
63
65
|
}
|
|
64
66
|
|
|
67
|
+
|
|
65
68
|
// 视图中配置的表。
|
|
66
69
|
return stdCrudCfgObj.tableBaseInfo.tableName;
|
|
67
70
|
}
|
|
@@ -100,7 +103,7 @@ export class CrudStdService extends ApiBaseService {
|
|
|
100
103
|
const cfgModel: IRequestCfgModel = {
|
|
101
104
|
sqlDatabase: dbName,
|
|
102
105
|
sqlDbType: dbType,
|
|
103
|
-
sqlTable: getExecuteTableNameBySettingKey(appInfo, stdAction),
|
|
106
|
+
sqlTable: getExecuteTableNameBySettingKey(appInfo, stdAction, sqlSimpleName),
|
|
104
107
|
sqlSimpleName,
|
|
105
108
|
updateCfg: {}
|
|
106
109
|
};
|