midway-fatcms 0.0.1-beta.68 → 0.0.1-beta.70

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 (70) hide show
  1. package/dist/config/config.default.js +1 -0
  2. package/dist/controller/gateway/CrudStdGatewayController.d.ts +1 -0
  3. package/dist/controller/gateway/CrudStdGatewayController.js +7 -13
  4. package/dist/controller/gateway/PublicApiController.d.ts +2 -1
  5. package/dist/controller/gateway/PublicApiController.js +31 -37
  6. package/dist/controller/manage/AppMangeApi.d.ts +3 -1
  7. package/dist/controller/manage/AppMangeApi.js +13 -0
  8. package/dist/controller/manage/SysConfigMangeApi.d.ts +1 -0
  9. package/dist/controller/manage/SysConfigMangeApi.js +9 -2
  10. package/dist/controller/manage/UserAccountManageApi.d.ts +4 -2
  11. package/dist/controller/manage/UserAccountManageApi.js +24 -0
  12. package/dist/controller/manage/WorkbenchMangeApi.js +2 -2
  13. package/dist/controller/render/AppRenderController.d.ts +1 -0
  14. package/dist/controller/render/AppRenderController.js +6 -11
  15. package/dist/index.d.ts +1 -0
  16. package/dist/index.js +1 -0
  17. package/dist/libs/crud-pro/interfaces.d.ts +1 -0
  18. package/dist/libs/crud-pro/models/SqlCfgModel.d.ts +1 -0
  19. package/dist/libs/crud-pro/services/CrudProExecuteSqlService.js +2 -2
  20. package/dist/libs/crud-pro/services/CrudProServiceBase.js +2 -4
  21. package/dist/libs/crud-pro/utils/sqlConvert/convertMsSql.d.ts +1 -1
  22. package/dist/libs/crud-pro/utils/sqlConvert/convertMsSql.js +4 -1
  23. package/dist/libs/crud-pro/utils/sqlConvert/convertPgSql.d.ts +1 -1
  24. package/dist/libs/crud-pro/utils/sqlConvert/convertPgSql.js +4 -1
  25. package/dist/models/bizmodels.d.ts +4 -3
  26. package/dist/models/bizmodels.js +4 -3
  27. package/dist/service/EnumInfoService.d.ts +1 -0
  28. package/dist/service/EnumInfoService.js +10 -17
  29. package/dist/service/SysAppService.d.ts +14 -0
  30. package/dist/service/SysAppService.js +96 -0
  31. package/dist/service/SysConfigService.d.ts +3 -0
  32. package/dist/service/SysConfigService.js +29 -12
  33. package/dist/service/WorkbenchService.d.ts +10 -5
  34. package/dist/service/WorkbenchService.js +54 -42
  35. package/dist/service/base/cache/CacheServiceFactory.d.ts +5 -0
  36. package/dist/service/base/cache/CacheServiceFactory.js +6 -1
  37. package/dist/service/crudstd/CrudStdService.d.ts +2 -14
  38. package/dist/service/crudstd/CrudStdService.js +6 -39
  39. package/dist/service/curd/CrudProQuick.d.ts +9 -3
  40. package/dist/service/curd/CrudProQuick.js +19 -3
  41. package/dist/service/curd/CurdMixByAccountService.js +4 -4
  42. package/dist/service/curd/CurdMixBySysConfigService.js +2 -2
  43. package/dist/service/curd/CurdMixByWorkbenchService.js +2 -2
  44. package/package.json +1 -1
  45. package/src/config/config.default.ts +1 -0
  46. package/src/controller/gateway/CrudStdGatewayController.ts +7 -13
  47. package/src/controller/gateway/PublicApiController.ts +39 -49
  48. package/src/controller/manage/AppMangeApi.ts +14 -1
  49. package/src/controller/manage/SysConfigMangeApi.ts +16 -8
  50. package/src/controller/manage/UserAccountManageApi.ts +28 -0
  51. package/src/controller/manage/WorkbenchMangeApi.ts +2 -2
  52. package/src/controller/render/AppRenderController.ts +5 -14
  53. package/src/index.ts +1 -0
  54. package/src/libs/crud-pro/interfaces.ts +1 -0
  55. package/src/libs/crud-pro/models/SqlCfgModel.ts +1 -0
  56. package/src/libs/crud-pro/services/CrudProExecuteSqlService.ts +2 -2
  57. package/src/libs/crud-pro/services/CrudProServiceBase.ts +15 -17
  58. package/src/libs/crud-pro/utils/sqlConvert/convertMsSql.ts +5 -1
  59. package/src/libs/crud-pro/utils/sqlConvert/convertPgSql.ts +6 -1
  60. package/src/models/bizmodels.ts +5 -3
  61. package/src/service/EnumInfoService.ts +9 -22
  62. package/src/service/SysAppService.ts +88 -0
  63. package/src/service/SysConfigService.ts +30 -16
  64. package/src/service/WorkbenchService.ts +78 -61
  65. package/src/service/base/cache/CacheServiceFactory.ts +12 -1
  66. package/src/service/crudstd/CrudStdService.ts +7 -43
  67. package/src/service/curd/CrudProQuick.ts +22 -3
  68. package/src/service/curd/CurdMixByAccountService.ts +4 -4
  69. package/src/service/curd/CurdMixBySysConfigService.ts +3 -2
  70. package/src/service/curd/CurdMixByWorkbenchService.ts +2 -2
@@ -0,0 +1,88 @@
1
+ import {Inject, Provide} from '@midwayjs/core';
2
+ import {SystemTables} from '@/models/SystemTables';
3
+ import {BaseService} from './base/BaseService';
4
+ import {CurdProService} from './curd/CurdProService';
5
+ import {GLOBAL_STATIC_CONFIG} from '@/libs/global-config/global-config';
6
+ import {CacheServiceFactory} from "@/service/base/cache/CacheServiceFactory";
7
+ import {CacheNameEnum} from "@/models/bizmodels";
8
+
9
+ @Provide()
10
+ export class SysAppService extends BaseService {
11
+
12
+ @Inject()
13
+ private curdProService: CurdProService;
14
+
15
+ @Inject()
16
+ private cacheServiceFactory: CacheServiceFactory;
17
+
18
+ private get sysAppDao(){
19
+ const { SystemDbName, SystemDbType } = GLOBAL_STATIC_CONFIG.getConfig();
20
+ return this.curdProService.getBbUtil(SystemDbName, SystemDbType, SystemTables.sys_app)
21
+ }
22
+
23
+ private get sysAppPageDao(){
24
+ const { SystemDbName, SystemDbType } = GLOBAL_STATIC_CONFIG.getConfig();
25
+ return this.curdProService.getBbUtil(SystemDbName, SystemDbType, SystemTables.sys_app_page)
26
+ }
27
+
28
+
29
+ async getSysAppPageOne({page_path,workbench_code}:{page_path: string,workbench_code: string}): Promise<any> {
30
+ if (!page_path || typeof page_path !== 'string') {
31
+ throw new Error('[getSysAppPageOne] page_path required');
32
+ }
33
+ if (!workbench_code || typeof workbench_code !== 'string') {
34
+ throw new Error('[getSysAppPageOne] workbench_code required');
35
+ }
36
+ return await this.cacheServiceFactory.getJsonObjectCache({
37
+ cacheKey: `${workbench_code}#${page_path}`,
38
+ cacheName: CacheNameEnum.GetSysAppPageOne,
39
+ getter: async () => {
40
+ return await this.sysAppPageDao.getUniqueOne({
41
+ condition: {page_path, workbench_code, deleted_at: 0}
42
+ });
43
+ },
44
+ });
45
+ }
46
+
47
+
48
+ async getSysAppOne(app_code: string): Promise<any> {
49
+ if (!app_code || typeof app_code !== 'string') {
50
+ throw new Error('[getSysAppOne] app_code required');
51
+ }
52
+ return await this.cacheServiceFactory.getJsonObjectCache({
53
+ cacheKey: app_code,
54
+ cacheName: CacheNameEnum.GetSysAppOne,
55
+ getter: async () => {
56
+ return await this.sysAppDao.getUniqueOne({
57
+ condition: {app_code, deleted_at: 0}
58
+ });
59
+ },
60
+ });
61
+ }
62
+
63
+ public deletePrivateField(parsedAppInfo: any){
64
+ if (!parsedAppInfo) {
65
+ return null;
66
+ }
67
+ const parsedAppInfo2: any = { ...parsedAppInfo };
68
+ delete parsedAppInfo2.created_at;
69
+ delete parsedAppInfo2.created_by;
70
+ delete parsedAppInfo2.workbench_code_array;
71
+ delete parsedAppInfo2.modified_at;
72
+ delete parsedAppInfo2.modified_by;
73
+ delete parsedAppInfo2.modified_desc;
74
+ delete parsedAppInfo2.std_crud_db;
75
+ delete parsedAppInfo2.std_crud_tbl;
76
+ return parsedAppInfo2;
77
+ }
78
+
79
+ async removeSysAppOneCache(app_code: string) {
80
+ if (!app_code || typeof app_code !== 'string') {
81
+ throw new Error('[removeSysAppOneCache] app_code required');
82
+ }
83
+ return await this.cacheServiceFactory.removeItemCache({
84
+ cacheKey: app_code,
85
+ cacheName: CacheNameEnum.GetSysAppOne
86
+ });
87
+ }
88
+ }
@@ -1,10 +1,11 @@
1
1
  import { Inject, Provide } from '@midwayjs/core';
2
2
  import { Context } from '@midwayjs/koa';
3
- import { KeysOfSimpleSQL } from '@/libs/crud-pro/models/keys';
4
3
  import { SystemTables } from '@/models/SystemTables';
5
4
  import { BaseService } from './base/BaseService';
6
5
  import { CurdProService } from './curd/CurdProService';
7
6
  import { GLOBAL_STATIC_CONFIG } from '@/libs/global-config/global-config';
7
+ import { CacheNameEnum } from "@/models/bizmodels";
8
+ import { CacheServiceFactory } from "@/service/base/cache/CacheServiceFactory";
8
9
 
9
10
  @Provide()
10
11
  export class SysConfigService extends BaseService {
@@ -14,24 +15,37 @@ export class SysConfigService extends BaseService {
14
15
  @Inject()
15
16
  private curdProService: CurdProService;
16
17
 
17
- async getSysConfigOne(config_code: string): Promise<any> {
18
- if (!config_code) {
19
- throw new Error('[getSysConfigOne] config_code required');
20
- }
18
+ @Inject()
19
+ private cacheServiceFactory: CacheServiceFactory;
21
20
 
21
+ private get sysConfigsDao(){
22
22
  const { SystemDbName, SystemDbType } = GLOBAL_STATIC_CONFIG.getConfig();
23
+ return this.curdProService.getBbUtil(SystemDbName, SystemDbType, SystemTables.sys_configs)
24
+ }
23
25
 
24
- const res1 = await this.curdProService.executeCrudByCfg(
25
- {
26
- condition: { config_code },
26
+ async getSysConfigOne(config_code: string): Promise<any> {
27
+ if (!config_code || typeof config_code !== 'string') {
28
+ throw new Error('[getSysAppOne] config_code required');
29
+ }
30
+ return await this.cacheServiceFactory.getJsonObjectCache({
31
+ cacheKey: config_code,
32
+ cacheName: CacheNameEnum.GetSysConfigOne,
33
+ getter: async () => {
34
+ return await this.sysConfigsDao.getUniqueOne({
35
+ condition: {config_code, deleted_at: 0}
36
+ });
27
37
  },
28
- {
29
- sqlTable: SystemTables.sys_configs,
30
- sqlSimpleName: KeysOfSimpleSQL.SIMPLE_QUERY_ONE,
31
- sqlDatabase: SystemDbName,
32
- sqlDbType: SystemDbType,
33
- }
34
- );
35
- return res1.getOneObj();
38
+ });
39
+ }
40
+
41
+ async removeSysConfigOneCache(config_code: string) {
42
+ if (!config_code || typeof config_code !== 'string') {
43
+ throw new Error('[removeSysConfigOneCache] config_code required');
44
+ }
45
+
46
+ return await this.cacheServiceFactory.removeItemCache({
47
+ cacheKey: config_code,
48
+ cacheName: CacheNameEnum.GetSysConfigOne,
49
+ });
36
50
  }
37
51
  }
@@ -1,30 +1,27 @@
1
- import { Inject, Provide, Config } from '@midwayjs/core';
2
- import { Context } from '@midwayjs/koa';
3
- import { KeysOfSimpleSQL } from '@/libs/crud-pro/models/keys';
4
- import { SystemTables } from '@/models/SystemTables';
5
- import { BaseService } from './base/BaseService';
1
+ import {Config, Inject, Provide} from '@midwayjs/core';
2
+ import {Context} from '@midwayjs/koa';
3
+ import {KeysOfSimpleSQL} from '@/libs/crud-pro/models/keys';
4
+ import {SystemTables} from '@/models/SystemTables';
5
+ import {BaseService} from './base/BaseService';
6
6
  // import { LRUCache } from 'lru-cache';
7
- import { CurdProService } from './curd/CurdProService';
8
- import { CommonException } from '@/libs/crud-pro/exceptions';
9
- import { parseJsonObject } from '@/libs/utils/functions';
10
- import { IWorkbenchConfig, IWorkbenchEntity } from '@/models/SystemEntities';
11
- import { IScheduleService } from '@/interface';
12
- import { getDebugWorkbenchCode } from '@/libs/utils/fatcms-request';
13
- import { MixinUtils } from '@/libs/crud-pro/utils/MixinUtils';
14
- import { GLOBAL_STATIC_CONFIG } from '@/libs/global-config/global-config';
15
- import { HEADER_KEY_RUN_BY_ASYNC_TASK_WORKBENCH_CODE } from '@/models/AsyncTaskModel';
16
- import { formatHost } from '@/libs/utils/format-url';
17
- //
18
- // const lruCache = new LRUCache<string, any>({
19
- // max: 500,
20
- // ttl: 1000 * 60 * 60,
21
- // ttlAutopurge: true,
22
- // });
23
-
24
- const lruCache = new Map<string, any>();
25
-
26
- const CACHE_KEY_WORKBENCH_LIST = 'CACHE_KEY_WORKBENCH_LIST';
27
- const CACHE_KEY_DOMAIN_MAP = 'CACHE_KEY_DOMAIN_MAP';
7
+ import {CurdProService} from './curd/CurdProService';
8
+ import {CommonException} from '@/libs/crud-pro/exceptions';
9
+ import {parseJsonObject} from '@/libs/utils/functions';
10
+ import {IWorkbenchConfig, IWorkbenchEntity} from '@/models/SystemEntities';
11
+ import {IScheduleService} from '@/interface';
12
+ import {getDebugWorkbenchCode} from '@/libs/utils/fatcms-request';
13
+ import {MixinUtils} from '@/libs/crud-pro/utils/MixinUtils';
14
+ import {GLOBAL_STATIC_CONFIG} from '@/libs/global-config/global-config';
15
+ import {HEADER_KEY_RUN_BY_ASYNC_TASK_WORKBENCH_CODE} from '@/models/AsyncTaskModel';
16
+ import {formatHost} from '@/libs/utils/format-url';
17
+ import {CacheServiceFactory} from "@/service/base/cache/CacheServiceFactory";
18
+ import {CacheNameEnum} from "@/models/bizmodels";
19
+
20
+
21
+ interface IWorkbenchCachedObj {
22
+ workbenchList: IWorkbenchEntity[];
23
+ workbenchDomainMap: Record<string, IWorkbenchEntity>; // key是domain
24
+ }
28
25
 
29
26
  @Provide()
30
27
  export class WorkbenchService extends BaseService implements IScheduleService {
@@ -34,58 +31,74 @@ export class WorkbenchService extends BaseService implements IScheduleService {
34
31
  @Inject()
35
32
  private curdProService: CurdProService;
36
33
 
34
+ @Inject()
35
+ private cacheServiceFactory: CacheServiceFactory;
36
+
37
37
  @Config('fatcmsTargetWorkbenchCode')
38
38
  private fatcmsTargetWorkbenchCode: string;
39
39
 
40
- public clearCache() {
41
- lruCache.set(CACHE_KEY_WORKBENCH_LIST, null);
42
- lruCache.set(CACHE_KEY_DOMAIN_MAP, null);
40
+ public async clearCache() {
41
+
42
+ await this.cacheServiceFactory.removeItemCache({
43
+ cacheKey: CacheNameEnum.CurdMixByWorkbench,
44
+ cacheName: CacheNameEnum.CurdMixByWorkbench,
45
+ });
46
+
47
+ await this.cacheServiceFactory.removeItemCache({
48
+ cacheKey: CacheNameEnum.GetWorkbenchCachedObj,
49
+ cacheName: CacheNameEnum.GetWorkbenchCachedObj,
50
+ });
43
51
  }
44
52
 
45
53
  public async runBySchedule() {
46
- await this.getAllWorkbenchInfoMap(true);
54
+ await this.getWorkbenchCachedObj(true);
55
+ }
56
+
57
+ private async getWorkbenchCachedObj(isForceRefresh?: boolean): Promise<IWorkbenchCachedObj> {
58
+ return this.cacheServiceFactory.getJsonObjectCache({
59
+ cacheKey: CacheNameEnum.GetWorkbenchCachedObj,
60
+ cacheName: CacheNameEnum.GetWorkbenchCachedObj,
61
+ refreshCache: isForceRefresh,
62
+ getter: async () => {
63
+ const { SystemDbName, SystemDbType } = GLOBAL_STATIC_CONFIG.getConfig();
64
+ const reqJson = { condition: {}, pageSize: 1000, limit: 1000 };
65
+ const res = await this.curdProService.executeCrudByCfg(reqJson, {
66
+ sqlTable: SystemTables.sys_workbench,
67
+ sqlSimpleName: KeysOfSimpleSQL.SIMPLE_QUERY,
68
+ sqlDatabase: SystemDbName,
69
+ sqlDbType: SystemDbType,
70
+ });
71
+ const listData = res.getResRows();
72
+
73
+ const domainMap1 = MixinUtils.toMap(listData, (e: any) => e.workbench_domain); // 主域名。其他两个域名。
74
+ const domainMap2 = MixinUtils.toMap(listData, (e: any) => e.workbench_domain2);
75
+ const domainMap3 = MixinUtils.toMap(listData, (e: any) => e.workbench_domain3);
76
+ const domainMap = {...domainMap1, ...domainMap2, ...domainMap3};
77
+ const cacheObj:IWorkbenchCachedObj = {
78
+ workbenchList: listData,
79
+ workbenchDomainMap: domainMap
80
+ }
81
+ return cacheObj;
82
+ },
83
+ });
47
84
  }
48
85
 
49
86
  /**
50
87
  * 获取所有站点列表
51
- * @param isForceRefresh 是否强制刷新缓存
52
88
  * @returns
53
89
  */
54
- public async getAllWorkbenchInfoList(isForceRefresh?: boolean): Promise<IWorkbenchEntity[]> {
55
- const { SystemDbName, SystemDbType } = GLOBAL_STATIC_CONFIG.getConfig();
56
-
57
- let listData = lruCache.get(CACHE_KEY_WORKBENCH_LIST);
58
- if (!listData || isForceRefresh === true) {
59
- const reqJson = { condition: {}, pageSize: 1000, limit: 1000 };
60
- const res = await this.curdProService.executeCrudByCfg(reqJson, {
61
- sqlTable: SystemTables.sys_workbench,
62
- sqlSimpleName: KeysOfSimpleSQL.SIMPLE_QUERY,
63
- sqlDatabase: SystemDbName,
64
- sqlDbType: SystemDbType,
65
- });
66
- listData = res.getResRows();
67
- lruCache.set(CACHE_KEY_WORKBENCH_LIST, listData);
68
- }
69
- return listData;
90
+ public async getAllWorkbenchInfoList(): Promise<IWorkbenchEntity[]> {
91
+ const cachedObj = await this.getWorkbenchCachedObj();
92
+ return cachedObj.workbenchList;
70
93
  }
71
94
 
72
95
  /**
73
96
  * 获取所有站点列表,以map的形式返回。其中key为站点域名,value为站点信息
74
- * @param isForceRefresh 是否强制刷新缓存
75
97
  * @returns
76
98
  */
77
- public async getAllWorkbenchInfoMap(isForceRefresh?: boolean): Promise<Record<any, IWorkbenchEntity>> {
78
- let listData: any[];
79
- let domainMap = lruCache.get(CACHE_KEY_DOMAIN_MAP);
80
- if (!domainMap || isForceRefresh === true) {
81
- listData = await this.getAllWorkbenchInfoList(isForceRefresh);
82
- const domainMap1 = MixinUtils.toMap(listData, (e: any) => e.workbench_domain); // 主域名。其他两个域名。
83
- const domainMap2 = MixinUtils.toMap(listData, (e: any) => e.workbench_domain2);
84
- const domainMap3 = MixinUtils.toMap(listData, (e: any) => e.workbench_domain3);
85
- domainMap = { ...domainMap1, ...domainMap2, ...domainMap3 };
86
- lruCache.set(CACHE_KEY_DOMAIN_MAP, domainMap);
87
- }
88
- return domainMap;
99
+ public async getAllWorkbenchInfoMap(): Promise<Record<string, IWorkbenchEntity>> {
100
+ const cachedObj = await this.getWorkbenchCachedObj();
101
+ return cachedObj.workbenchDomainMap;
89
102
  }
90
103
 
91
104
  /**
@@ -222,7 +235,11 @@ export class WorkbenchService extends BaseService implements IScheduleService {
222
235
  }
223
236
 
224
237
 
225
-
238
+ /**
239
+ * 根据站点,配置接口报名单模式
240
+ * @param workbenchInfo
241
+ * @param path
242
+ */
226
243
  public isSupportTheNodePathByWorkbenchInfo(workbenchInfo: IWorkbenchEntity, path: string): boolean {
227
244
 
228
245
  // 非node api路径,直接返回true
@@ -16,9 +16,14 @@ interface IGetJsonObjectCacheParam {
16
16
  getter: () => Promise<any>;
17
17
  }
18
18
 
19
+ interface IRemoveItemCacheParam {
20
+ cacheName: CacheNameEnum;
21
+ cacheKey: string;
22
+ }
23
+
19
24
  const defaultCacheConfig: IWorkbenchConfigCacheLevel = {
20
25
  cacheLevel: CacheLevelEnum.MEMORY,
21
- cacheSecond: 60 * 5
26
+ cacheSecond: 60 * 60 * 24 * 7
22
27
  }
23
28
 
24
29
  @Provide()
@@ -72,4 +77,10 @@ export class CacheServiceFactory {
72
77
  return obj;
73
78
  }
74
79
 
80
+ public async removeItemCache(param: IRemoveItemCacheParam): Promise<any> {
81
+ const {cacheName, cacheKey } = param;
82
+ const cacheService = this.getCacheServiceByName(cacheName);
83
+ return await cacheService.removeItem(cacheKey);
84
+ }
85
+
75
86
  }
@@ -10,15 +10,13 @@ import {parseJsonObject} from '@/libs/utils/functions';
10
10
  import {ICrudStdAppInfo, ICrudStdAppInfoForSettingKey} from '@/models/bizmodels';
11
11
  import {BizException} from '@/models/devops';
12
12
  import {ExecuteContext} from '@/libs/crud-pro/models/ExecuteContext';
13
- import {SystemTables} from '@/models/SystemTables';
14
13
  import {CrudStdActionService} from './CrudStdActionService';
15
14
  import {CrudStdRelationService} from './CrudStdRelationService';
16
15
  import {ApiBaseService} from '../base/ApiBaseService';
17
16
  import {parseDatabaseName} from '@/libs/crud-pro/utils/DatabaseName';
18
17
  import {GLOBAL_STATIC_CONFIG} from '@/libs/global-config/global-config';
19
18
  import {MixinUtils} from '@/libs/crud-pro/utils/MixinUtils';
20
- import {CacheServiceFactory} from '../base/cache/CacheServiceFactory';
21
- import {CacheNameEnum} from "@/models/bizmodels";
19
+ import {SysAppService} from "@/service/SysAppService";
22
20
 
23
21
 
24
22
  export const SPECIAL_SETTING_KEY = {
@@ -87,7 +85,9 @@ export class CrudStdService extends ApiBaseService {
87
85
  protected crudStdRelationService: CrudStdRelationService;
88
86
 
89
87
  @Inject()
90
- protected cacheServiceFactory: CacheServiceFactory;
88
+ protected sysAppService: SysAppService;
89
+
90
+
91
91
 
92
92
  /**
93
93
  * 执行普通CRUD
@@ -284,25 +284,6 @@ export class CrudStdService extends ApiBaseService {
284
284
  return this.crudStdActionService.handleStdActionByReq({ appInfo, params, actionsMap, actionCfg });
285
285
  }
286
286
 
287
- /**
288
- * 查询APP信息
289
- * @param appCode
290
- * @private
291
- */
292
- private async getCrudStdAppInfo(appCode?: string) {
293
- const { SystemDbName, SystemDbType } = GLOBAL_STATIC_CONFIG.getConfig();
294
-
295
- this.logInfo('getCrudStdAppInfo', appCode);
296
-
297
- const ss = {
298
- sqlTable: SystemTables.sys_app,
299
- sqlSimpleName: KeysOfSimpleSQL.SIMPLE_QUERY_ONE,
300
- sqlDatabase: SystemDbName,
301
- sqlDbType: SystemDbType,
302
- };
303
- return await this.curdMixService.executeCrudByCfg({ condition: { app_code: appCode } }, ss);
304
- }
305
-
306
287
 
307
288
  /**
308
289
  * 查询APP信息
@@ -310,28 +291,11 @@ export class CrudStdService extends ApiBaseService {
310
291
  * @private
311
292
  */
312
293
  public async getParsedCrudStdAppInfo(appCode: string): Promise<ICrudStdAppInfo> {
313
- return await this.cacheServiceFactory.getJsonObjectCache({
314
- cacheKey: appCode,
315
- cacheName: CacheNameEnum.GetParsedCrudStdAppInfo,
316
- getter: async () => {
317
- return await this.getParsedCrudStdAppInfoPrivate(appCode);
318
- },
319
- });
320
- }
321
-
322
-
323
- /**
324
- * 查询APP信息
325
- * @param appCode
326
- * @private
327
- */
328
- private async getParsedCrudStdAppInfoPrivate(appCode: string): Promise<ICrudStdAppInfo> {
329
- const a = await this.getCrudStdAppInfo(appCode);
330
- const { row } = a.getResModel();
331
- if (!row) {
294
+ const appInfo = await this.sysAppService.getSysAppOne(appCode);
295
+ if (!appInfo) {
332
296
  return null;
333
297
  }
334
- const { app_schema, ...others } = row;
298
+ const { app_schema, ...others } = appInfo;
335
299
  const stdCrudCfgObj = parseJsonObject(app_schema);
336
300
 
337
301
  const handleArrayCfg = (arrayCfg: any[]) => {
@@ -51,7 +51,7 @@ export class CrudProQuick {
51
51
  * @deprecated
52
52
  * @param reqJson
53
53
  * @param sqlTable
54
- * @returns
54
+ * @returns 返回一条数据对象
55
55
  */
56
56
  public async getOne(reqJson: IRequestModel, sqlTable?: string): Promise<any> {
57
57
  const cfgModel: IRequestCfgModel = {
@@ -66,7 +66,7 @@ export class CrudProQuick {
66
66
  * 期望获取唯一的一个对象,如果数据库中的数量不唯一,则报错。
67
67
  * @param reqJson
68
68
  * @param sqlTable
69
- * @returns
69
+ * @returns 返回一条数据对象
70
70
  */
71
71
  public async getUniqueOne(reqJson: IRequestModel, sqlTable?: string): Promise<any> {
72
72
  const cfgModel: IRequestCfgModel = {
@@ -92,7 +92,7 @@ export class CrudProQuick {
92
92
  * 获取数据列表
93
93
  * @param reqJson
94
94
  * @param sqlTable 数据库表名称
95
- * @returns
95
+ * @returns 返回多条数据对象组成的数组
96
96
  */
97
97
  public async getList(reqJson: IRequestModel, sqlTable?: string): Promise<any[]> {
98
98
  const cfgModel: IRequestCfgModel = {
@@ -167,4 +167,23 @@ export class CrudProQuick {
167
167
  };
168
168
  return await this.curdPro.executeSQL(sqlCfgModel);
169
169
  }
170
+
171
+
172
+ /**
173
+ * 执行数据库的原生SQL语句,不做任何封装的SQL
174
+ * @param executeNativeSql
175
+ * @param args
176
+ */
177
+ public async executeNativeSQL(executeNativeSql: string, args?: any[]): Promise<any> {
178
+ const sqlCfgModel: ISqlCfgModel = {
179
+ isNativeSQL: true,
180
+ executeSql: executeNativeSql,
181
+ executeSqlArgs: args,
182
+ sqlDatabase: this.sqlDatabase,
183
+ sqlDbType: this.sqlDbType,
184
+ maxLimit: this.baseCfgModel.maxLimit || DEFAULT_MAX_LIMIT,
185
+ };
186
+ return await this.curdPro.executeSQL(sqlCfgModel);
187
+ }
188
+
170
189
  }
@@ -69,14 +69,14 @@ export class CurdMixByAccountService implements IExecuteContextHandler {
69
69
  }
70
70
 
71
71
 
72
- private async getFromCache(code: string): Promise<any> {
72
+ private async getFromCache(accountId: string): Promise<any> {
73
73
  const cacheService = this.cacheServiceFactory.getCacheServiceByName(CacheNameEnum.CurdMixByAccount);
74
- return cacheService.getJsonObject(code);
74
+ return cacheService.getJsonObject(accountId);
75
75
  }
76
76
 
77
- private async setToCache(code: string, value: any): Promise<any> {
77
+ private async setToCache(accountId: string, value: any): Promise<any> {
78
78
  const cacheService = this.cacheServiceFactory.getCacheServiceByName(CacheNameEnum.CurdMixByAccount);
79
- return cacheService.setJsonObject(code, value);
79
+ return cacheService.setJsonObject(accountId, value);
80
80
  }
81
81
 
82
82
  private async queryUserAccountIdList(accountIds: string[]): Promise<any[]> {
@@ -25,17 +25,18 @@ export class CurdMixBySysConfigService implements IExecuteContextHandler {
25
25
 
26
26
  @Inject()
27
27
  protected curdProService: CurdProService;
28
+
28
29
  @Inject()
29
30
  private cacheServiceFactory: CacheServiceFactory;
30
31
 
31
32
 
32
33
  private async getFromCache(code: string): Promise<any> {
33
- const cacheService = this.cacheServiceFactory.getCacheServiceByName(CacheNameEnum.CurdMixBySysConfig);
34
+ const cacheService = this.cacheServiceFactory.getCacheServiceByName(CacheNameEnum.GetSysConfigOne);
34
35
  return cacheService.getJsonObject(code);
35
36
  }
36
37
 
37
38
  private async setToCache(code: string, value: any): Promise<any> {
38
- const cacheService = this.cacheServiceFactory.getCacheServiceByName(CacheNameEnum.CurdMixBySysConfig);
39
+ const cacheService = this.cacheServiceFactory.getCacheServiceByName(CacheNameEnum.GetSysConfigOne);
39
40
  return cacheService.setJsonObject(code, value);
40
41
  }
41
42
 
@@ -31,9 +31,9 @@ export class CurdMixByWorkbenchService implements IExecuteContextHandler {
31
31
  private async loadWorkbenchListMap(): Promise<Map<string, any>> {
32
32
  const { SystemDbName, SystemDbType } = GLOBAL_STATIC_CONFIG.getConfig();
33
33
  return await this.cacheServiceFactory.getJsonObjectCache({
34
- cacheKey: 'loadWorkbenchListMap',
35
- refreshCache: false,
34
+ cacheKey: CacheNameEnum.CurdMixByWorkbench,
36
35
  cacheName: CacheNameEnum.CurdMixByWorkbench,
36
+ refreshCache: false,
37
37
  getter: async () => {
38
38
  const reqJson = {
39
39
  columns: 'workbench_code,workbench_name,workbench_domain',