midway-fatcms 0.0.1-beta.1 → 0.0.1-beta.11

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.
Files changed (117) hide show
  1. package/dist/config/config.default.js +52 -15
  2. package/dist/controller/base/BaseApiController.js +9 -6
  3. package/dist/controller/gateway/CrudMtdGatewayController.js +4 -1
  4. package/dist/controller/gateway/DocGatewayController.js +13 -8
  5. package/dist/controller/gateway/StaticController.d.ts +3 -0
  6. package/dist/controller/gateway/StaticController.js +41 -21
  7. package/dist/controller/home.controller.js +2 -2
  8. package/dist/controller/manage/CrudStandardDesignApi.js +89 -74
  9. package/dist/controller/manage/DeployManageApi.js +6 -4
  10. package/dist/controller/manage/SuperAdminManageApi.js +12 -8
  11. package/dist/controller/manage/SysConfigMangeApi.js +3 -1
  12. package/dist/controller/manage/UserAccountManageApi.d.ts +1 -1
  13. package/dist/controller/manage/UserAccountManageApi.js +5 -0
  14. package/dist/controller/myinfo/AuthController.d.ts +0 -4
  15. package/dist/controller/myinfo/AuthController.js +0 -53
  16. package/dist/controller/render/AppRenderController.js +4 -2
  17. package/dist/controller/test.controller.js +1 -1
  18. package/dist/index.d.ts +28 -4
  19. package/dist/index.js +28 -4
  20. package/dist/libs/crud-pro/interfaces.d.ts +1 -1
  21. package/dist/libs/crud-pro/models/RequestCfgModel.d.ts +1 -1
  22. package/dist/libs/crud-pro/models/SqlCfgModel.d.ts +1 -1
  23. package/dist/libs/crud-pro/services/CrudProExecuteSqlService.js +4 -4
  24. package/dist/libs/crud-pro/services/CrudProGenSqlCondition.js +4 -4
  25. package/dist/libs/crud-pro/services/CrudProGenSqlService.js +8 -8
  26. package/dist/libs/crud-pro/services/CrudProOriginToExecuteSql.js +2 -2
  27. package/dist/libs/crud-pro/utils/sqlConvert/convertColumnName.js +2 -2
  28. package/dist/libs/global-config/global-config.d.ts +39 -0
  29. package/dist/libs/global-config/global-config.js +32 -0
  30. package/dist/models/SystemTables.d.ts +0 -3
  31. package/dist/models/SystemTables.js +1 -4
  32. package/dist/service/AuthService.js +8 -5
  33. package/dist/service/EnumInfoService.js +7 -4
  34. package/dist/service/FileCenterService.js +13 -9
  35. package/dist/service/SysConfigService.js +4 -2
  36. package/dist/service/UserAccountService.js +10 -6
  37. package/dist/service/VisitStatService.js +4 -2
  38. package/dist/service/WorkbenchService.js +4 -2
  39. package/dist/service/anyapi/AnyApiService.js +4 -2
  40. package/dist/service/crudstd/CrudStdService.js +7 -3
  41. package/dist/service/curd/CurdMixByAccountService.js +12 -6
  42. package/dist/service/curd/CurdMixByDictService.js +4 -2
  43. package/dist/service/curd/CurdMixByLinkToCustomService.js +1 -1
  44. package/dist/service/curd/CurdMixBySysConfigService.js +4 -2
  45. package/dist/service/curd/CurdMixByWorkbenchService.js +4 -2
  46. package/dist/service/curd/CurdMixService.d.ts +1 -1
  47. package/dist/service/curd/CurdMixService.js +2 -2
  48. package/dist/service/curd/CurdMixUtils.d.ts +7 -0
  49. package/dist/service/curd/CurdMixUtils.js +31 -1
  50. package/dist/service/curd/CurdProService.d.ts +3 -3
  51. package/dist/service/curd/CurdProService.js +9 -9
  52. package/dist/service/proxyapi/ProxyApiLoadService.js +7 -4
  53. package/dist/views/404_app.html +31 -0
  54. package/dist/views/404_workbench.html +34 -0
  55. package/dist/views/static/favicon.ico +0 -0
  56. package/package.json +5 -1
  57. package/src/config/config.default.ts +58 -27
  58. package/src/controller/base/BaseApiController.ts +14 -14
  59. package/src/controller/gateway/CrudMtdGatewayController.ts +6 -2
  60. package/src/controller/gateway/DocGatewayController.ts +13 -5
  61. package/src/controller/gateway/StaticController.ts +50 -25
  62. package/src/controller/home.controller.ts +8 -10
  63. package/src/controller/manage/CrudStandardDesignApi.ts +145 -100
  64. package/src/controller/manage/DeployManageApi.ts +6 -3
  65. package/src/controller/manage/SuperAdminManageApi.ts +15 -6
  66. package/src/controller/manage/SysConfigMangeApi.ts +4 -1
  67. package/src/controller/manage/UserAccountManageApi.ts +6 -0
  68. package/src/controller/myinfo/AuthController.ts +4 -66
  69. package/src/controller/render/AppRenderController.ts +18 -15
  70. package/src/controller/test.controller.ts +1 -1
  71. package/src/index.ts +33 -4
  72. package/src/libs/crud-pro/interfaces.ts +1 -1
  73. package/src/libs/crud-pro/models/RequestCfgModel.ts +1 -1
  74. package/src/libs/crud-pro/models/SqlCfgModel.ts +1 -1
  75. package/src/libs/crud-pro/services/CrudProExecuteSqlService.ts +4 -4
  76. package/src/libs/crud-pro/services/CrudProGenSqlCondition.ts +4 -4
  77. package/src/libs/crud-pro/services/CrudProGenSqlService.ts +8 -8
  78. package/src/libs/crud-pro/services/CrudProOriginToExecuteSql.ts +2 -2
  79. package/src/libs/crud-pro/utils/sqlConvert/convertColumnName.ts +2 -2
  80. package/src/libs/global-config/global-config.ts +72 -0
  81. package/src/models/SystemTables.ts +0 -4
  82. package/src/service/AuthService.ts +13 -8
  83. package/src/service/EnumInfoService.ts +8 -3
  84. package/src/service/FileCenterService.ts +12 -6
  85. package/src/service/SysConfigService.ts +10 -6
  86. package/src/service/UserAccountService.ts +14 -4
  87. package/src/service/VisitStatService.ts +6 -2
  88. package/src/service/WorkbenchService.ts +7 -2
  89. package/src/service/anyapi/AnyApiService.ts +5 -2
  90. package/src/service/crudstd/CrudStdService.ts +13 -3
  91. package/src/service/curd/CurdMixByAccountService.ts +14 -6
  92. package/src/service/curd/CurdMixByDictService.ts +8 -2
  93. package/src/service/curd/CurdMixByLinkToCustomService.ts +1 -1
  94. package/src/service/curd/CurdMixBySysConfigService.ts +7 -2
  95. package/src/service/curd/CurdMixByWorkbenchService.ts +6 -2
  96. package/src/service/curd/CurdMixService.ts +2 -2
  97. package/src/service/curd/CurdMixUtils.ts +42 -12
  98. package/src/service/curd/CurdProService.ts +10 -10
  99. package/src/service/proxyapi/ProxyApiLoadService.ts +11 -3
  100. package/src/views/404_app.html +31 -0
  101. package/src/views/404_workbench.html +34 -0
  102. package/src/views/static/favicon.ico +0 -0
  103. package/dist/controller/medstatistic/MedAdminController.d.ts +0 -35
  104. package/dist/controller/medstatistic/MedAdminController.js +0 -205
  105. package/dist/controller/medstatistic/MedClientController.d.ts +0 -28
  106. package/dist/controller/medstatistic/MedClientController.js +0 -188
  107. package/dist/controller/medstatistic/MedMessageService.d.ts +0 -19
  108. package/dist/controller/medstatistic/MedMessageService.js +0 -95
  109. package/dist/controller/medstatistic/MedScoreService.d.ts +0 -21
  110. package/dist/controller/medstatistic/MedScoreService.js +0 -107
  111. package/dist/controller/medstatistic/constants.d.ts +0 -32
  112. package/dist/controller/medstatistic/constants.js +0 -43
  113. package/src/controller/medstatistic/MedAdminController.ts +0 -221
  114. package/src/controller/medstatistic/MedClientController.ts +0 -188
  115. package/src/controller/medstatistic/MedMessageService.ts +0 -89
  116. package/src/controller/medstatistic/MedScoreService.ts +0 -108
  117. package/src/controller/medstatistic/constants.ts +0 -63
@@ -23,6 +23,7 @@ const MixinUtils_1 = require("../../libs/crud-pro/utils/MixinUtils");
23
23
  const WorkbenchService_1 = require("../WorkbenchService");
24
24
  const ValidateUtils_1 = require("../../libs/crud-pro/utils/ValidateUtils");
25
25
  const ApiBaseService_1 = require("../base/ApiBaseService");
26
+ const global_config_1 = require("../../libs/global-config/global-config");
26
27
  const lruCache = new lru_cache_1.LRUCache({
27
28
  max: 500,
28
29
  ttl: 1000 * 60,
@@ -65,12 +66,13 @@ let AnyApiService = class AnyApiService extends ApiBaseService_1.ApiBaseService
65
66
  return anyApi;
66
67
  }
67
68
  async _getAnyApiMethod(methodCode) {
69
+ const { SystemDbName, SystemDbType } = global_config_1.GLOBAL_STATIC_CONFIG.getConfig();
68
70
  const res = await this.curdMixService.executeCrudByCfg({ condition: { method: methodCode } }, {
69
71
  sqlTable: SystemTables_1.SystemTables.sys_anyapi,
70
72
  method: `get_sys_anyapi_${methodCode}`,
71
73
  sqlSimpleName: keys_1.KeysOfSimpleSQL.SIMPLE_QUERY_ONE,
72
- sqlDatabase: SystemTables_1.SystemDbName,
73
- sqlDdType: SystemTables_1.SystemDbType,
74
+ sqlDatabase: SystemDbName,
75
+ sqlDbType: SystemDbType,
74
76
  updateCfg: {},
75
77
  });
76
78
  const obj = res.getOneObj();
@@ -21,6 +21,7 @@ const CrudStdRelationService_1 = require("./CrudStdRelationService");
21
21
  const _ = require("lodash");
22
22
  const ApiBaseService_1 = require("../base/ApiBaseService");
23
23
  const DatabaseName_1 = require("../../libs/crud-pro/utils/DatabaseName");
24
+ const global_config_1 = require("../../libs/global-config/global-config");
24
25
  exports.SPECIAL_SETTING_KEY = {
25
26
  QUERY_LIST: 'QUERY_LIST',
26
27
  QUERY_ONE: 'QUERY_ONE',
@@ -39,7 +40,7 @@ let CrudStdService = class CrudStdService extends ApiBaseService_1.ApiBaseServic
39
40
  const { dbType, dbName } = (0, DatabaseName_1.parseDatabaseName)(databaseName);
40
41
  const cfgModel = {
41
42
  sqlDatabase: dbName,
42
- sqlDdType: dbType,
43
+ sqlDbType: dbType,
43
44
  sqlTable: stdCrudCfgObj.tableBaseInfo.tableName,
44
45
  sqlSimpleName,
45
46
  };
@@ -53,6 +54,8 @@ let CrudStdService = class CrudStdService extends ApiBaseService_1.ApiBaseServic
53
54
  }
54
55
  // 根据用户配置,设置关联查询的数据信息。
55
56
  await this.crudStdRelationService.addCfgModelColumnsRelation(cfgModel, appInfo);
57
+ // 业务系统自定义的修改cfgModel
58
+ await global_config_1.GLOBAL_STATIC_CONFIG.getConfig().bizUpdateCfgModelForCrudStd(params, cfgModel, appInfo, this.ctx);
56
59
  return await this.curdMixService.executeCrudByCfg(params, cfgModel);
57
60
  }
58
61
  /**
@@ -112,12 +115,13 @@ let CrudStdService = class CrudStdService extends ApiBaseService_1.ApiBaseServic
112
115
  * @private
113
116
  */
114
117
  async getCrudStdAppInfo(appCode) {
118
+ const { SystemDbName, SystemDbType } = global_config_1.GLOBAL_STATIC_CONFIG.getConfig();
115
119
  this.logInfo('getCrudStdAppInfo', appCode);
116
120
  const ss = {
117
121
  sqlTable: SystemTables_1.SystemTables.sys_app,
118
122
  sqlSimpleName: keys_1.KeysOfSimpleSQL.SIMPLE_QUERY_ONE,
119
- sqlDatabase: SystemTables_1.SystemDbName,
120
- sqlDdType: SystemTables_1.SystemDbType,
123
+ sqlDatabase: SystemDbName,
124
+ sqlDbType: SystemDbType,
121
125
  };
122
126
  return await this.curdMixService.executeCrudByCfg({ condition: { app_code: appCode } }, ss);
123
127
  }
@@ -17,10 +17,12 @@ const CurdMixUtils_1 = require("./CurdMixUtils");
17
17
  const SystemTables_1 = require("../../models/SystemTables");
18
18
  const keys_1 = require("../../libs/crud-pro/models/keys");
19
19
  const MixinUtils_1 = require("../../libs/crud-pro/utils/MixinUtils");
20
+ const global_config_1 = require("../../libs/global-config/global-config");
20
21
  const dictMixUtils = new CurdMixUtils_1.CrudMixUtils(CurdMixUtils_1.RelatedType.accountBasic);
21
22
  const TMP_CTX_KEY = _.uniqueId('CurdMixByAccountService');
22
23
  let CurdMixByAccountService = class CurdMixByAccountService {
23
24
  async handleExecuteContextPrepare(executeContext) {
25
+ const { SystemDbName, SystemDbType, toFatcmsUserAccountId } = global_config_1.GLOBAL_STATIC_CONFIG.getConfig();
24
26
  const relations = dictMixUtils.pickColumnRelations(executeContext);
25
27
  if (!relations || relations.length === 0) {
26
28
  return;
@@ -28,9 +30,13 @@ let CurdMixByAccountService = class CurdMixByAccountService {
28
30
  const accountIds = new Set();
29
31
  dictMixUtils.forEachRowAndColumnsRelation(executeContext, (row, columnRelation) => {
30
32
  const { sourceColumn } = columnRelation;
31
- const accountId = _.get(row, sourceColumn);
32
- if (accountId) {
33
- accountIds.add(accountId);
33
+ if (sourceColumn) {
34
+ const accountId = _.get(row, sourceColumn);
35
+ if (accountId) {
36
+ const fatcmsUserAccountId = toFatcmsUserAccountId(accountId);
37
+ accountIds.add(fatcmsUserAccountId);
38
+ row['__fatcmsUserAccountId__'] = fatcmsUserAccountId;
39
+ }
34
40
  }
35
41
  });
36
42
  if (accountIds.size === 0) {
@@ -40,8 +46,8 @@ let CurdMixByAccountService = class CurdMixByAccountService {
40
46
  method: 'UserAccountService.queryAccountBasicInfoByIds',
41
47
  sqlTable: SystemTables_1.SystemTables.sys_user_account,
42
48
  sqlSimpleName: keys_1.KeysOfSimpleSQL.SIMPLE_QUERY,
43
- sqlDatabase: SystemTables_1.SystemDbName,
44
- sqlDdType: SystemTables_1.SystemDbType,
49
+ sqlDatabase: SystemDbName,
50
+ sqlDbType: SystemDbType,
45
51
  };
46
52
  const reqJson = {
47
53
  columns: ['nick_name', 'avatar', 'account_id'],
@@ -69,7 +75,7 @@ let CurdMixByAccountService = class CurdMixByAccountService {
69
75
  { from: 'avatar', to: `${sourceColumn}_user.avatar` },
70
76
  ];
71
77
  }
72
- dictMixUtils.copyColumnRelationToRowNoRelatedCode(row, userInfoMap, columnRelation);
78
+ dictMixUtils.copyUserInfoToRowNoRelatedCode(row, userInfoMap, columnRelation);
73
79
  });
74
80
  }
75
81
  };
@@ -18,6 +18,7 @@ const keys_1 = require("../../libs/crud-pro/models/keys");
18
18
  const MultiKeyMap_1 = require("../../libs/crud-pro/utils/MultiKeyMap");
19
19
  const _ = require("lodash");
20
20
  const RedisCacheService_1 = require("../base/RedisCacheService");
21
+ const global_config_1 = require("../../libs/global-config/global-config");
21
22
  const TMP_CTX_KEY = _.uniqueId('CurdMixByDictService');
22
23
  const dictMixUtils = new CurdMixUtils_1.CrudMixUtils(CurdMixUtils_1.RelatedType.dict);
23
24
  let CurdMixByDictService = class CurdMixByDictService {
@@ -38,6 +39,7 @@ let CurdMixByDictService = class CurdMixByDictService {
38
39
  executeContext[TMP_CTX_KEY] = new MultiKeyMap_1.MultiKeyMap(rows, 'dict_code', 'value');
39
40
  }
40
41
  async getDictItemRows(codes) {
42
+ const { SystemDbName, SystemDbType } = global_config_1.GLOBAL_STATIC_CONFIG.getConfig();
41
43
  const noCacheCodes = [];
42
44
  // 从缓存里面取
43
45
  let cachedRows = [];
@@ -60,8 +62,8 @@ let CurdMixByDictService = class CurdMixByDictService {
60
62
  }, {
61
63
  sqlTable: SystemTables_1.SystemTables.sys_data_dict_item,
62
64
  sqlSimpleName: keys_1.KeysOfSimpleSQL.SIMPLE_QUERY,
63
- sqlDatabase: SystemTables_1.SystemDbName,
64
- sqlDdType: SystemTables_1.SystemDbType,
65
+ sqlDatabase: SystemDbName,
66
+ sqlDbType: SystemDbType,
65
67
  });
66
68
  selectedRows = res1.getResRows();
67
69
  //放到缓存里
@@ -101,7 +101,7 @@ let CurdMixByLinkToCustomService = class CurdMixByLinkToCustomService {
101
101
  sqlTable,
102
102
  sqlSimpleName: keys_1.KeysOfSimpleSQL.SIMPLE_QUERY,
103
103
  sqlDatabase: dbName,
104
- sqlDdType: dbType,
104
+ sqlDbType: dbType,
105
105
  maxLimit: 4000,
106
106
  });
107
107
  const rows = res1.getResRows();
@@ -18,10 +18,12 @@ const SystemTables_1 = require("../../models/SystemTables");
18
18
  const keys_1 = require("../../libs/crud-pro/models/keys");
19
19
  const MultiKeyMap_1 = require("../../libs/crud-pro/utils/MultiKeyMap");
20
20
  const parseConfig_1 = require("../../libs/utils/parseConfig");
21
+ const global_config_1 = require("../../libs/global-config/global-config");
21
22
  const dictMixUtils = new CurdMixUtils_1.CrudMixUtils(CurdMixUtils_1.RelatedType.sysCfgEnum);
22
23
  const TMP_CTX_KEY = _.uniqueId('CurdMixBySysConfigService');
23
24
  let CurdMixBySysConfigService = class CurdMixBySysConfigService {
24
25
  async handleExecuteContextPrepare(executeContext) {
26
+ const { SystemDbName, SystemDbType } = global_config_1.GLOBAL_STATIC_CONFIG.getConfig();
25
27
  const codes = dictMixUtils.pickColumnRelationCodes(executeContext);
26
28
  if (!codes || codes.length === 0) {
27
29
  return;
@@ -31,8 +33,8 @@ let CurdMixBySysConfigService = class CurdMixBySysConfigService {
31
33
  }, {
32
34
  sqlTable: SystemTables_1.SystemTables.sys_configs,
33
35
  sqlSimpleName: keys_1.KeysOfSimpleSQL.SIMPLE_QUERY,
34
- sqlDatabase: SystemTables_1.SystemDbName,
35
- sqlDdType: SystemTables_1.SystemDbType,
36
+ sqlDatabase: SystemDbName,
37
+ sqlDbType: SystemDbType,
36
38
  });
37
39
  const rows = res1.getResRows();
38
40
  const multiKeyMap = new MultiKeyMap_1.MultiKeyMap();
@@ -18,6 +18,7 @@ const CurdMixUtils_1 = require("./CurdMixUtils");
18
18
  const SystemTables_1 = require("../../models/SystemTables");
19
19
  const keys_1 = require("../../libs/crud-pro/models/keys");
20
20
  const MixinUtils_1 = require("../../libs/crud-pro/utils/MixinUtils");
21
+ const global_config_1 = require("../../libs/global-config/global-config");
21
22
  const lruCache = new lru_cache_1.LRUCache({
22
23
  max: 500,
23
24
  ttl: 1000 * 60 * 5,
@@ -27,6 +28,7 @@ const workbenchMixUtils = new CurdMixUtils_1.CrudMixUtils(CurdMixUtils_1.Related
27
28
  const TMP_CTX_KEY = _.uniqueId('CurdMixByWorkbenchService');
28
29
  let CurdMixByWorkbenchService = class CurdMixByWorkbenchService {
29
30
  async loadWorkbenchListMap() {
31
+ const { SystemDbName, SystemDbType } = global_config_1.GLOBAL_STATIC_CONFIG.getConfig();
30
32
  let workbenchListMap = lruCache.get('workbenchListMap');
31
33
  if (!workbenchListMap) {
32
34
  const reqJson = {
@@ -36,8 +38,8 @@ let CurdMixByWorkbenchService = class CurdMixByWorkbenchService {
36
38
  const res = await this.curdProService.executeCrudByCfg(reqJson, {
37
39
  sqlTable: SystemTables_1.SystemTables.sys_workbench,
38
40
  sqlSimpleName: keys_1.KeysOfSimpleSQL.SIMPLE_QUERY,
39
- sqlDatabase: SystemTables_1.SystemDbName,
40
- sqlDdType: SystemTables_1.SystemDbType,
41
+ sqlDatabase: SystemDbName,
42
+ sqlDbType: SystemDbType,
41
43
  });
42
44
  const workbenchList = res.getResRows();
43
45
  workbenchListMap = MixinUtils_1.MixinUtils.toNewMap(workbenchList, (obj) => obj.workbench_code);
@@ -10,7 +10,7 @@ export declare class CurdMixService {
10
10
  private curdMixByLinkToCustomService;
11
11
  private prepare;
12
12
  executeCrudByCfg(reqJson: IRequestModel, cfgModel: IRequestCfgModel2): Promise<import("../../libs/crud-pro/models/ExecuteContext").ExecuteContext>;
13
- getBbUtil(database: string, sqlDdType: SqlDbType): import("./CurdProService").DBUtils;
13
+ getBbUtil(database: string, sqlDbType: SqlDbType): import("./CurdProService").DBUtils;
14
14
  executeSQL(sqlCfgModel: ISqlCfgModel): Promise<any>;
15
15
  executeCrud(reqJson: IRequestModel): Promise<import("../../libs/crud-pro/models/ExecuteContext").ExecuteContext>;
16
16
  getCachedCfgByMethod(method: string): Promise<IRequestCfgModel>;
@@ -30,9 +30,9 @@ let CurdMixService = class CurdMixService {
30
30
  this.prepare();
31
31
  return this.curdProService.executeCrudByCfg(reqJson, cfgModel);
32
32
  }
33
- getBbUtil(database, sqlDdType) {
33
+ getBbUtil(database, sqlDbType) {
34
34
  this.prepare();
35
- return this.curdProService.getBbUtil(database, sqlDdType);
35
+ return this.curdProService.getBbUtil(database, sqlDbType);
36
36
  }
37
37
  async executeSQL(sqlCfgModel) {
38
38
  this.prepare();
@@ -24,5 +24,12 @@ declare class CrudMixUtils {
24
24
  * @param columnRelation
25
25
  */
26
26
  copyColumnRelationToRowNoRelatedCode(row: any, map: Map<string, any>, columnRelation: ColumnRelation): void;
27
+ /**
28
+ * 专门COPY用户信息到row上面。无relatedCode模式
29
+ * @param row
30
+ * @param map
31
+ * @param columnRelation
32
+ */
33
+ copyUserInfoToRowNoRelatedCode(row: any, map: Map<string, any>, columnRelation: ColumnRelation): void;
27
34
  }
28
35
  export { CrudMixUtils, RelatedType, FuncRowColumnRelation };
@@ -67,7 +67,7 @@ function copyByArraySourceValue(row, sourceValue, targetColumns, getValue) {
67
67
  }
68
68
  else {
69
69
  const dictAttrValue = _.get(codeObject, targetColumn.from);
70
- if (typeof dictAttrValue !== "undefined" && dictAttrValue !== null) {
70
+ if (typeof dictAttrValue !== 'undefined' && dictAttrValue !== null) {
71
71
  const toStr = targetColumn.to.replace('$ARRAY_INDEX', `${codeIndex}`);
72
72
  _.set(row, toStr, dictAttrValue);
73
73
  isSetArray = true;
@@ -197,5 +197,35 @@ class CrudMixUtils {
197
197
  copyBySingleSourceValue(row, sourceValue, targetColumns, getValue);
198
198
  }
199
199
  }
200
+ /**
201
+ * 专门COPY用户信息到row上面。无relatedCode模式
202
+ * @param row
203
+ * @param map
204
+ * @param columnRelation
205
+ */
206
+ copyUserInfoToRowNoRelatedCode(row, map, columnRelation) {
207
+ const { targetColumns } = columnRelation;
208
+ if (!targetColumns) {
209
+ return;
210
+ }
211
+ const tmpSourceColumn = '__fatcmsUserAccountId__';
212
+ const sourceValue = _.get(row, tmpSourceColumn);
213
+ if (!sourceValue) {
214
+ return;
215
+ }
216
+ const getValue = (code) => {
217
+ if (!map) {
218
+ return null;
219
+ }
220
+ if (typeof map.get === 'function') {
221
+ return map.get(`${code}`);
222
+ }
223
+ return map[code];
224
+ };
225
+ const isSetArray = copyByArraySourceValue(row, sourceValue, targetColumns, getValue);
226
+ if (!isSetArray) {
227
+ copyBySingleSourceValue(row, sourceValue, targetColumns, getValue);
228
+ }
229
+ }
200
230
  }
201
231
  exports.CrudMixUtils = CrudMixUtils;
@@ -7,9 +7,9 @@ import { BaseService } from '../base/BaseService';
7
7
  import { IRequestCfgModel2 } from '../../models/bizmodels';
8
8
  export declare class DBUtils {
9
9
  private readonly sqlDatabase;
10
- private readonly sqlDdType;
10
+ private readonly sqlDbType;
11
11
  private readonly curdProService;
12
- constructor(sqlDatabase: string, sqlDdType: SqlDbType, curdProService: CurdProService);
12
+ constructor(sqlDatabase: string, sqlDbType: SqlDbType, curdProService: CurdProService);
13
13
  getOne(reqJson: IRequestModel, sqlTable: string): Promise<any>;
14
14
  getList(reqJson: IRequestModel, sqlTable: string): Promise<any[]>;
15
15
  }
@@ -34,6 +34,6 @@ export declare class CurdProService extends BaseService {
34
34
  executeSQL(sqlCfgModel: ISqlCfgModel): Promise<any>;
35
35
  executeCrudByCfg(reqJson: IRequestModel, cfgModel: IRequestCfgModel2): Promise<ExecuteContext>;
36
36
  private applyStandardUpdateCfg;
37
- getBbUtil(database: string, sqlDdType: SqlDbType): DBUtils;
37
+ getBbUtil(database: string, sqlDbType: SqlDbType): DBUtils;
38
38
  getCachedCfgByMethod(method: string): Promise<IRequestCfgModel>;
39
39
  }
@@ -65,15 +65,15 @@ class MyContextFunc extends ExecuteContextFunc_1.BaseExecuteContextFunc {
65
65
  throw new exceptions_1.CommonException(exceptions_1.Exceptions.DB_QUERY_PARAM_EMPTY, '查询语句中未指定数据库');
66
66
  }
67
67
  const dataBaseName = sqlCfgModel.sqlDatabase;
68
- const sqlDdType = sqlCfgModel.sqlDdType;
69
- if (sqlDdType === keys_1.SqlDbType.postgres) {
68
+ const sqlDbType = sqlCfgModel.sqlDbType;
69
+ if (sqlDbType === keys_1.SqlDbType.postgres) {
70
70
  const dbConfig = _.get(this.postgres2Config, dataBaseName);
71
71
  if (!dbConfig) {
72
72
  throw new exceptions_1.CommonException(exceptions_1.Exceptions.DB_NOT_FOUND, 'postgres配置中不存在此数据库:' + dataBaseName);
73
73
  }
74
74
  return (0, PostgresUtils_1.getConnectionPool)(dataBaseName, dbConfig);
75
75
  }
76
- if (sqlDdType === keys_1.SqlDbType.sqlserver) {
76
+ if (sqlDbType === keys_1.SqlDbType.sqlserver) {
77
77
  const dbConfig = _.get(this.sqlserver2Config, dataBaseName);
78
78
  if (!dbConfig) {
79
79
  throw new exceptions_1.CommonException(exceptions_1.Exceptions.DB_NOT_FOUND, 'sqlserver配置中不存在此数据库:' + dataBaseName);
@@ -98,9 +98,9 @@ class MyContextFunc extends ExecuteContextFunc_1.BaseExecuteContextFunc {
98
98
  }
99
99
  }
100
100
  class DBUtils {
101
- constructor(sqlDatabase, sqlDdType, curdProService) {
101
+ constructor(sqlDatabase, sqlDbType, curdProService) {
102
102
  this.sqlDatabase = sqlDatabase;
103
- this.sqlDdType = sqlDdType;
103
+ this.sqlDbType = sqlDbType;
104
104
  this.curdProService = curdProService;
105
105
  }
106
106
  async getOne(reqJson, sqlTable) {
@@ -108,7 +108,7 @@ class DBUtils {
108
108
  sqlTable,
109
109
  sqlSimpleName: keys_1.KeysOfSimpleSQL.SIMPLE_QUERY_ONE,
110
110
  sqlDatabase: this.sqlDatabase,
111
- sqlDdType: this.sqlDdType,
111
+ sqlDbType: this.sqlDbType,
112
112
  updateCfg: {},
113
113
  };
114
114
  const res = await this.curdProService.executeCrudByCfg(reqJson, cfgModel);
@@ -119,7 +119,7 @@ class DBUtils {
119
119
  sqlTable,
120
120
  sqlSimpleName: keys_1.KeysOfSimpleSQL.SIMPLE_QUERY,
121
121
  sqlDatabase: this.sqlDatabase,
122
- sqlDdType: this.sqlDdType,
122
+ sqlDbType: this.sqlDbType,
123
123
  updateCfg: {},
124
124
  };
125
125
  const res = await this.curdProService.executeCrudByCfg(reqJson, cfgModel);
@@ -287,8 +287,8 @@ let CurdProService = class CurdProService extends BaseService_1.BaseService {
287
287
  Object.assign(cfgModel.updateCfg, updateCfgObj3);
288
288
  }
289
289
  }
290
- getBbUtil(database, sqlDdType) {
291
- return new DBUtils(database, sqlDdType, this);
290
+ getBbUtil(database, sqlDbType) {
291
+ return new DBUtils(database, sqlDbType, this);
292
292
  }
293
293
  async getCachedCfgByMethod(method) {
294
294
  const curdPro = this.getCrudPro();
@@ -24,6 +24,7 @@ const WeightedRandom_1 = require("./WeightedRandom");
24
24
  const WeightedRoundRobin_1 = require("./WeightedRoundRobin");
25
25
  const WorkbenchService_1 = require("../WorkbenchService");
26
26
  const exceptions_1 = require("../../libs/crud-pro/exceptions");
27
+ const global_config_1 = require("../../libs/global-config/global-config");
27
28
  function toUpstreamInfo(config_content) {
28
29
  const obj = (0, functions_1.parseJsonObject)(config_content);
29
30
  if (!obj) {
@@ -79,6 +80,7 @@ let ProxyApiLoadService = class ProxyApiLoadService extends BaseService_1.BaseSe
79
80
  return routeTrie;
80
81
  }
81
82
  async buildUpstreamMap() {
83
+ const { SystemDbName, SystemDbType } = global_config_1.GLOBAL_STATIC_CONFIG.getConfig();
82
84
  // biz_tag={'upstream'}
83
85
  const res = await this.curdProService.executeCrudByCfg({
84
86
  condition: {
@@ -86,8 +88,8 @@ let ProxyApiLoadService = class ProxyApiLoadService extends BaseService_1.BaseSe
86
88
  },
87
89
  }, {
88
90
  sqlTable: SystemTables_1.SystemTables.sys_configs,
89
- sqlDatabase: SystemTables_1.SystemDbName,
90
- sqlDdType: SystemTables_1.SystemDbType,
91
+ sqlDatabase: SystemDbName,
92
+ sqlDbType: SystemDbType,
91
93
  sqlSimpleName: keys_1.KeysOfSimpleSQL.SIMPLE_QUERY,
92
94
  });
93
95
  const upstreamMap = {};
@@ -100,12 +102,13 @@ let ProxyApiLoadService = class ProxyApiLoadService extends BaseService_1.BaseSe
100
102
  return upstreamMap;
101
103
  }
102
104
  async loadProxyApiEntity(workbench_code, upstreamMap) {
105
+ const { SystemDbName, SystemDbType } = global_config_1.GLOBAL_STATIC_CONFIG.getConfig();
103
106
  const res = await this.curdProService.executeCrudByCfg({
104
107
  condition: {},
105
108
  }, {
106
109
  sqlTable: SystemTables_1.SystemTables.sys_proxyapi,
107
- sqlDatabase: SystemTables_1.SystemDbName,
108
- sqlDdType: SystemTables_1.SystemDbType,
110
+ sqlDatabase: SystemDbName,
111
+ sqlDbType: SystemDbType,
109
112
  sqlSimpleName: keys_1.KeysOfSimpleSQL.SIMPLE_QUERY,
110
113
  });
111
114
  const rows0 = res.getResRows();
@@ -0,0 +1,31 @@
1
+ <html dir="ltr" lang="zh">
2
+ <head>
3
+ <meta charset="utf-8">
4
+ <meta name="color-scheme" content="light dark">
5
+ <meta name="theme-color" content="#fff">
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
7
+ <title>无法访问此应用</title>
8
+ <link rel="stylesheet" href="https://cdnjsx.oss-cn-shanghai.aliyuncs.com/styles/chrome-error.css">
9
+ </head>
10
+ <body class="neterror" style="font-family: system-ui,PingFang SC,STHeiti,sans-serif; font-size: 75%">
11
+
12
+ <div id="content">
13
+ <div id="main-frame-error" class="interstitial-wrapper ">
14
+ <div id="main-content">
15
+ <div class="icon icon-generic"></div>
16
+ <div id="main-message">
17
+ <h1><span>无法访问此应用</span></h1>
18
+ <p>此应用存在如下可能的状态导致无法访问:应用不存在、应用已下线、站点不支持</p>
19
+ <p>appCode: <%=appCode%></p>
20
+ <div>
21
+ <p>errorMsg: <%=errorMsg%></p>
22
+ </div>
23
+ </div>
24
+ </div>
25
+ </div>
26
+ </div>
27
+
28
+ </body>
29
+ </html>
30
+
31
+
@@ -0,0 +1,34 @@
1
+ <html dir="ltr" lang="zh">
2
+ <head>
3
+ <meta charset="utf-8">
4
+ <meta name="color-scheme" content="light dark">
5
+ <meta name="theme-color" content="#fff">
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
7
+ <title>无法访问此网站</title>
8
+ <link rel="stylesheet" href="https://cdnjsx.oss-cn-shanghai.aliyuncs.com/styles/chrome-error.css">
9
+ </head>
10
+ <body class="neterror" style="font-family: system-ui,PingFang SC,STHeiti,sans-serif; font-size: 75%">
11
+
12
+ <div id="content">
13
+ <div id="main-frame-error" class="interstitial-wrapper ">
14
+ <div id="main-content">
15
+ <div class="icon icon-generic"></div>
16
+ <div id="main-message">
17
+ <h1>
18
+ <span>无法访问此网站</span>
19
+ </h1>
20
+ <p>检查 <span id="domain_span"><%-host%></span> 中是否有拼写错误。</p>
21
+ <div class="error-code" style="text-transform: none;"><%-errorInfo%></div>
22
+ </div>
23
+ </div>
24
+ </div>
25
+ </div>
26
+ <script>
27
+ setTimeout(function () {
28
+ document.getElementById('domain_span').innerHTML = location.host
29
+ }, 10)
30
+ </script>
31
+ </body>
32
+ </html>
33
+
34
+
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "midway-fatcms",
3
- "version": "0.0.1-beta.1",
3
+ "version": "0.0.1-beta.11",
4
4
  "description": "This is a midway component sample",
5
5
  "main": "dist/index.js",
6
6
  "typings": "index.d.ts",
@@ -17,8 +17,12 @@
17
17
  "dist/**/*.txt",
18
18
  "dist/**/*.js",
19
19
  "dist/**/*.d.ts",
20
+ "dist/**/*.html",
21
+ "dist/**/*.ico",
20
22
  "src/**/*.ts",
21
23
  "src/**/*.txt",
24
+ "src/**/*.html",
25
+ "src/**/*.ico",
22
26
  "index.d.ts"
23
27
  ],
24
28
  "license": "MIT",