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.
- package/dist/config/config.default.js +52 -15
- package/dist/controller/base/BaseApiController.js +9 -6
- package/dist/controller/gateway/CrudMtdGatewayController.js +4 -1
- package/dist/controller/gateway/DocGatewayController.js +13 -8
- package/dist/controller/gateway/StaticController.d.ts +3 -0
- package/dist/controller/gateway/StaticController.js +41 -21
- package/dist/controller/home.controller.js +2 -2
- package/dist/controller/manage/CrudStandardDesignApi.js +89 -74
- package/dist/controller/manage/DeployManageApi.js +6 -4
- package/dist/controller/manage/SuperAdminManageApi.js +12 -8
- package/dist/controller/manage/SysConfigMangeApi.js +3 -1
- package/dist/controller/manage/UserAccountManageApi.d.ts +1 -1
- package/dist/controller/manage/UserAccountManageApi.js +5 -0
- package/dist/controller/myinfo/AuthController.d.ts +0 -4
- package/dist/controller/myinfo/AuthController.js +0 -53
- package/dist/controller/render/AppRenderController.js +4 -2
- package/dist/controller/test.controller.js +1 -1
- package/dist/index.d.ts +28 -4
- package/dist/index.js +28 -4
- package/dist/libs/crud-pro/interfaces.d.ts +1 -1
- package/dist/libs/crud-pro/models/RequestCfgModel.d.ts +1 -1
- package/dist/libs/crud-pro/models/SqlCfgModel.d.ts +1 -1
- package/dist/libs/crud-pro/services/CrudProExecuteSqlService.js +4 -4
- package/dist/libs/crud-pro/services/CrudProGenSqlCondition.js +4 -4
- package/dist/libs/crud-pro/services/CrudProGenSqlService.js +8 -8
- package/dist/libs/crud-pro/services/CrudProOriginToExecuteSql.js +2 -2
- package/dist/libs/crud-pro/utils/sqlConvert/convertColumnName.js +2 -2
- package/dist/libs/global-config/global-config.d.ts +39 -0
- package/dist/libs/global-config/global-config.js +32 -0
- package/dist/models/SystemTables.d.ts +0 -3
- package/dist/models/SystemTables.js +1 -4
- package/dist/service/AuthService.js +8 -5
- package/dist/service/EnumInfoService.js +7 -4
- package/dist/service/FileCenterService.js +13 -9
- package/dist/service/SysConfigService.js +4 -2
- package/dist/service/UserAccountService.js +10 -6
- package/dist/service/VisitStatService.js +4 -2
- package/dist/service/WorkbenchService.js +4 -2
- package/dist/service/anyapi/AnyApiService.js +4 -2
- package/dist/service/crudstd/CrudStdService.js +7 -3
- package/dist/service/curd/CurdMixByAccountService.js +12 -6
- package/dist/service/curd/CurdMixByDictService.js +4 -2
- package/dist/service/curd/CurdMixByLinkToCustomService.js +1 -1
- package/dist/service/curd/CurdMixBySysConfigService.js +4 -2
- package/dist/service/curd/CurdMixByWorkbenchService.js +4 -2
- package/dist/service/curd/CurdMixService.d.ts +1 -1
- package/dist/service/curd/CurdMixService.js +2 -2
- package/dist/service/curd/CurdMixUtils.d.ts +7 -0
- package/dist/service/curd/CurdMixUtils.js +31 -1
- package/dist/service/curd/CurdProService.d.ts +3 -3
- package/dist/service/curd/CurdProService.js +9 -9
- package/dist/service/proxyapi/ProxyApiLoadService.js +7 -4
- package/dist/views/404_app.html +31 -0
- package/dist/views/404_workbench.html +34 -0
- package/dist/views/static/favicon.ico +0 -0
- package/package.json +5 -1
- package/src/config/config.default.ts +58 -27
- package/src/controller/base/BaseApiController.ts +14 -14
- package/src/controller/gateway/CrudMtdGatewayController.ts +6 -2
- package/src/controller/gateway/DocGatewayController.ts +13 -5
- package/src/controller/gateway/StaticController.ts +50 -25
- package/src/controller/home.controller.ts +8 -10
- package/src/controller/manage/CrudStandardDesignApi.ts +145 -100
- package/src/controller/manage/DeployManageApi.ts +6 -3
- package/src/controller/manage/SuperAdminManageApi.ts +15 -6
- package/src/controller/manage/SysConfigMangeApi.ts +4 -1
- package/src/controller/manage/UserAccountManageApi.ts +6 -0
- package/src/controller/myinfo/AuthController.ts +4 -66
- package/src/controller/render/AppRenderController.ts +18 -15
- package/src/controller/test.controller.ts +1 -1
- package/src/index.ts +33 -4
- package/src/libs/crud-pro/interfaces.ts +1 -1
- package/src/libs/crud-pro/models/RequestCfgModel.ts +1 -1
- package/src/libs/crud-pro/models/SqlCfgModel.ts +1 -1
- package/src/libs/crud-pro/services/CrudProExecuteSqlService.ts +4 -4
- package/src/libs/crud-pro/services/CrudProGenSqlCondition.ts +4 -4
- package/src/libs/crud-pro/services/CrudProGenSqlService.ts +8 -8
- package/src/libs/crud-pro/services/CrudProOriginToExecuteSql.ts +2 -2
- package/src/libs/crud-pro/utils/sqlConvert/convertColumnName.ts +2 -2
- package/src/libs/global-config/global-config.ts +72 -0
- package/src/models/SystemTables.ts +0 -4
- package/src/service/AuthService.ts +13 -8
- package/src/service/EnumInfoService.ts +8 -3
- package/src/service/FileCenterService.ts +12 -6
- package/src/service/SysConfigService.ts +10 -6
- package/src/service/UserAccountService.ts +14 -4
- package/src/service/VisitStatService.ts +6 -2
- package/src/service/WorkbenchService.ts +7 -2
- package/src/service/anyapi/AnyApiService.ts +5 -2
- package/src/service/crudstd/CrudStdService.ts +13 -3
- package/src/service/curd/CurdMixByAccountService.ts +14 -6
- package/src/service/curd/CurdMixByDictService.ts +8 -2
- package/src/service/curd/CurdMixByLinkToCustomService.ts +1 -1
- package/src/service/curd/CurdMixBySysConfigService.ts +7 -2
- package/src/service/curd/CurdMixByWorkbenchService.ts +6 -2
- package/src/service/curd/CurdMixService.ts +2 -2
- package/src/service/curd/CurdMixUtils.ts +42 -12
- package/src/service/curd/CurdProService.ts +10 -10
- package/src/service/proxyapi/ProxyApiLoadService.ts +11 -3
- package/src/views/404_app.html +31 -0
- package/src/views/404_workbench.html +34 -0
- package/src/views/static/favicon.ico +0 -0
- package/dist/controller/medstatistic/MedAdminController.d.ts +0 -35
- package/dist/controller/medstatistic/MedAdminController.js +0 -205
- package/dist/controller/medstatistic/MedClientController.d.ts +0 -28
- package/dist/controller/medstatistic/MedClientController.js +0 -188
- package/dist/controller/medstatistic/MedMessageService.d.ts +0 -19
- package/dist/controller/medstatistic/MedMessageService.js +0 -95
- package/dist/controller/medstatistic/MedScoreService.d.ts +0 -21
- package/dist/controller/medstatistic/MedScoreService.js +0 -107
- package/dist/controller/medstatistic/constants.d.ts +0 -32
- package/dist/controller/medstatistic/constants.js +0 -43
- package/src/controller/medstatistic/MedAdminController.ts +0 -221
- package/src/controller/medstatistic/MedClientController.ts +0 -188
- package/src/controller/medstatistic/MedMessageService.ts +0 -89
- package/src/controller/medstatistic/MedScoreService.ts +0 -108
- package/src/controller/medstatistic/constants.ts +0 -63
|
@@ -26,8 +26,7 @@ let CrudStandardDesignApi = class CrudStandardDesignApi extends BaseApiControlle
|
|
|
26
26
|
const postgresList = Object.keys(this.postgres2Config || {});
|
|
27
27
|
const sqlServerList = Object.keys(this.sqlserver2Config || {});
|
|
28
28
|
const toSelectList = (dbCfgNameList, dbType) => {
|
|
29
|
-
return dbCfgNameList.map(
|
|
30
|
-
const dbName = item;
|
|
29
|
+
return dbCfgNameList.map(dbName => {
|
|
31
30
|
const value = (0, DatabaseName_1.toDatabaseNameStr)(dbType, dbName);
|
|
32
31
|
return { value, label: value, dbName, dbType };
|
|
33
32
|
});
|
|
@@ -35,7 +34,14 @@ let CrudStandardDesignApi = class CrudStandardDesignApi extends BaseApiControlle
|
|
|
35
34
|
const mysqlObjList = toSelectList(mysqlList, keys_1.SqlDbType.mysql);
|
|
36
35
|
const postgresObjList = toSelectList(postgresList, keys_1.SqlDbType.postgres);
|
|
37
36
|
const sqlserverObjList = toSelectList(sqlServerList, keys_1.SqlDbType.sqlserver);
|
|
38
|
-
const databaseList = [
|
|
37
|
+
const databaseList = [
|
|
38
|
+
...mysqlObjList,
|
|
39
|
+
...postgresObjList,
|
|
40
|
+
...sqlserverObjList,
|
|
41
|
+
].filter((obj) => {
|
|
42
|
+
const value = '' + obj.value;
|
|
43
|
+
return !value.endsWith('_fatcms_inner_demo_config');
|
|
44
|
+
});
|
|
39
45
|
return {
|
|
40
46
|
success: true,
|
|
41
47
|
data: databaseList,
|
|
@@ -53,7 +59,7 @@ let CrudStandardDesignApi = class CrudStandardDesignApi extends BaseApiControlle
|
|
|
53
59
|
const res = await this.curdMixService.executeSQL({
|
|
54
60
|
executeSql: 'SHOW TABLES',
|
|
55
61
|
sqlDatabase: dbName,
|
|
56
|
-
|
|
62
|
+
sqlDbType: keys_1.SqlDbType.mysql,
|
|
57
63
|
crudType: keys_1.KeyOfCrudTypes.SYS_QUERY,
|
|
58
64
|
});
|
|
59
65
|
const arr = JSON.parse(JSON.stringify(res));
|
|
@@ -82,13 +88,13 @@ let CrudStandardDesignApi = class CrudStandardDesignApi extends BaseApiControlle
|
|
|
82
88
|
const tableDescribe = await this.curdMixService.executeSQL({
|
|
83
89
|
executeSql: 'describe ' + tableName,
|
|
84
90
|
sqlDatabase: dbName,
|
|
85
|
-
|
|
91
|
+
sqlDbType: keys_1.SqlDbType.mysql,
|
|
86
92
|
crudType: keys_1.KeyOfCrudTypes.SYS_QUERY,
|
|
87
93
|
});
|
|
88
94
|
const tableCreate = await this.curdMixService.executeSQL({
|
|
89
95
|
executeSql: 'show create table ' + tableName,
|
|
90
96
|
sqlDatabase: dbName,
|
|
91
|
-
|
|
97
|
+
sqlDbType: keys_1.SqlDbType.mysql,
|
|
92
98
|
crudType: keys_1.KeyOfCrudTypes.SYS_QUERY,
|
|
93
99
|
});
|
|
94
100
|
const tableCreateStr = tableCreate[0]['Create Table'];
|
|
@@ -131,17 +137,14 @@ let CrudStandardDesignApi = class CrudStandardDesignApi extends BaseApiControlle
|
|
|
131
137
|
async getTableListOfSqlserver(dbName) {
|
|
132
138
|
const dbConfig = this.sqlserver2Config[dbName];
|
|
133
139
|
if (!dbConfig) {
|
|
134
|
-
throw new exceptions_1.CommonException(
|
|
140
|
+
throw new exceptions_1.CommonException('DB_NOT_FOUND', '数据库配置没有找到:' + dbName);
|
|
135
141
|
}
|
|
136
142
|
const dbType = keys_1.SqlDbType.sqlserver;
|
|
137
|
-
const sql =
|
|
138
|
-
"SELECT name as tablename \n" +
|
|
139
|
-
"FROM sys.tables" +
|
|
140
|
-
"";
|
|
143
|
+
const sql = 'SELECT name as tablename FROM sys.tables';
|
|
141
144
|
const arr = await this.curdMixService.executeSQL({
|
|
142
145
|
executeSql: sql,
|
|
143
146
|
sqlDatabase: dbName,
|
|
144
|
-
|
|
147
|
+
sqlDbType: dbType,
|
|
145
148
|
crudType: keys_1.KeyOfCrudTypes.SYS_QUERY,
|
|
146
149
|
executeSqlArgs: [],
|
|
147
150
|
});
|
|
@@ -150,8 +153,9 @@ let CrudStandardDesignApi = class CrudStandardDesignApi extends BaseApiControlle
|
|
|
150
153
|
return {
|
|
151
154
|
value: tableName,
|
|
152
155
|
label: tableName,
|
|
153
|
-
dbName,
|
|
154
|
-
|
|
156
|
+
dbName,
|
|
157
|
+
dbType,
|
|
158
|
+
tableName,
|
|
155
159
|
};
|
|
156
160
|
});
|
|
157
161
|
return common_dto_1.CommonResult.successRes(tableNames);
|
|
@@ -159,70 +163,81 @@ let CrudStandardDesignApi = class CrudStandardDesignApi extends BaseApiControlle
|
|
|
159
163
|
async getTableListOfPostgreSQL(dbName) {
|
|
160
164
|
const dbConfig = this.postgres2Config[dbName];
|
|
161
165
|
if (!dbConfig) {
|
|
162
|
-
throw new exceptions_1.CommonException(
|
|
166
|
+
throw new exceptions_1.CommonException('DB_NOT_FOUND', '数据库配置没有找到:' + dbName);
|
|
163
167
|
}
|
|
164
|
-
const schemaname = "public";
|
|
165
|
-
const sql = "" +
|
|
166
|
-
"SELECT tablename\n" +
|
|
167
|
-
"FROM pg_tables\n" +
|
|
168
|
-
`WHERE schemaname = '${schemaname}' \n` +
|
|
169
|
-
"ORDER BY tablename;";
|
|
170
168
|
const dbType = keys_1.SqlDbType.postgres;
|
|
171
|
-
const
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
169
|
+
const schemaname = 'public';
|
|
170
|
+
const tableListSql = '' +
|
|
171
|
+
'SELECT tablename\n' +
|
|
172
|
+
'FROM pg_tables\n' +
|
|
173
|
+
`WHERE schemaname = '${schemaname}' \n` +
|
|
174
|
+
'ORDER BY tablename;';
|
|
175
|
+
const viewListSql = '' +
|
|
176
|
+
'SELECT viewname as tablename\n' +
|
|
177
|
+
'FROM pg_views\n' +
|
|
178
|
+
`WHERE schemaname = '${schemaname}' \n` +
|
|
179
|
+
'ORDER BY viewname;';
|
|
180
|
+
const toSelectOptions = async (executeSql, tableType) => {
|
|
181
|
+
const arr = await this.curdMixService.executeSQL({
|
|
182
|
+
executeSql: executeSql,
|
|
183
|
+
sqlDatabase: dbName,
|
|
184
|
+
sqlDbType: dbType,
|
|
185
|
+
crudType: keys_1.KeyOfCrudTypes.SYS_QUERY,
|
|
186
|
+
executeSqlArgs: [],
|
|
187
|
+
});
|
|
188
|
+
return arr.map(v => {
|
|
189
|
+
const tableName = v.tablename;
|
|
190
|
+
return {
|
|
191
|
+
value: tableName,
|
|
192
|
+
label: tableName,
|
|
193
|
+
dbName,
|
|
194
|
+
dbType,
|
|
195
|
+
tableName,
|
|
196
|
+
tableType,
|
|
197
|
+
};
|
|
198
|
+
});
|
|
199
|
+
};
|
|
200
|
+
const tableNames = await toSelectOptions(tableListSql, 'table');
|
|
201
|
+
const viewNames = await toSelectOptions(viewListSql, 'view');
|
|
202
|
+
const tableNameMerge = [...tableNames, ...viewNames];
|
|
203
|
+
return common_dto_1.CommonResult.successRes(tableNameMerge);
|
|
188
204
|
}
|
|
189
205
|
async getTableFieldsOfSqlServer(dbName, tableName) {
|
|
190
206
|
const dbConfig = this.sqlserver2Config[dbName];
|
|
191
207
|
if (!dbConfig) {
|
|
192
|
-
throw new exceptions_1.CommonException(
|
|
208
|
+
throw new exceptions_1.CommonException('DB_NOT_FOUND', '数据库配置没有找到:' + dbName);
|
|
193
209
|
}
|
|
194
|
-
const columnArraySql =
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
"WHERE\n" +
|
|
210
|
+
const columnArraySql = '' +
|
|
211
|
+
'SELECT\n' +
|
|
212
|
+
' c.name AS column_name,\n' +
|
|
213
|
+
' t.name AS data_type,\n' +
|
|
214
|
+
' c.max_length AS max_length,\n' +
|
|
215
|
+
' c.precision,\n' +
|
|
216
|
+
' c.scale,\n' +
|
|
217
|
+
' c.is_nullable,\n' +
|
|
218
|
+
' c.is_identity,\n' +
|
|
219
|
+
' dc.definition AS column_default, \n' +
|
|
220
|
+
' ep.value AS column_description \n' +
|
|
221
|
+
'FROM\n' +
|
|
222
|
+
' sys.columns c\n' +
|
|
223
|
+
' JOIN\n' +
|
|
224
|
+
' sys.types t ON c.user_type_id = t.user_type_id\n' +
|
|
225
|
+
' LEFT JOIN\n' +
|
|
226
|
+
' sys.default_constraints dc\n' +
|
|
227
|
+
' ON c.default_object_id = dc.object_id \n' +
|
|
228
|
+
' LEFT JOIN\n' +
|
|
229
|
+
' sys.extended_properties ep\n' +
|
|
230
|
+
' ON c.object_id = ep.major_id\n' +
|
|
231
|
+
' AND c.column_id = ep.minor_id\n' +
|
|
232
|
+
'WHERE\n' +
|
|
218
233
|
` c.object_id = OBJECT_ID('${tableName}') \n` +
|
|
219
|
-
|
|
220
|
-
|
|
234
|
+
' ORDER BY\n' +
|
|
235
|
+
' c.column_id;';
|
|
221
236
|
const dbType = keys_1.SqlDbType.sqlserver;
|
|
222
237
|
const columnArray = await this.curdMixService.executeSQL({
|
|
223
238
|
executeSql: columnArraySql,
|
|
224
239
|
sqlDatabase: dbName,
|
|
225
|
-
|
|
240
|
+
sqlDbType: dbType,
|
|
226
241
|
crudType: keys_1.KeyOfCrudTypes.SYS_QUERY,
|
|
227
242
|
executeSqlArgs: [],
|
|
228
243
|
});
|
|
@@ -232,11 +247,11 @@ let CrudStandardDesignApi = class CrudStandardDesignApi extends BaseApiControlle
|
|
|
232
247
|
fieldIndex: column_name || '',
|
|
233
248
|
fieldTitle: column_description || column_name || '',
|
|
234
249
|
isNullable: is_nullable,
|
|
235
|
-
defaultValue: column_default ||
|
|
250
|
+
defaultValue: column_default || '',
|
|
236
251
|
extra: others,
|
|
237
252
|
// key: column_name, // 索引
|
|
238
253
|
type: data_type,
|
|
239
|
-
is_identity: is_identity
|
|
254
|
+
is_identity: is_identity,
|
|
240
255
|
};
|
|
241
256
|
});
|
|
242
257
|
return common_dto_1.CommonResult.successRes({
|
|
@@ -248,9 +263,9 @@ let CrudStandardDesignApi = class CrudStandardDesignApi extends BaseApiControlle
|
|
|
248
263
|
async getTableFieldsOfPostgreSQL(dbName, tableName) {
|
|
249
264
|
const dbConfig = this.postgres2Config[dbName];
|
|
250
265
|
if (!dbConfig) {
|
|
251
|
-
throw new exceptions_1.CommonException(
|
|
266
|
+
throw new exceptions_1.CommonException('DB_NOT_FOUND', '数据库配置没有找到:' + dbName);
|
|
252
267
|
}
|
|
253
|
-
const schemaname =
|
|
268
|
+
const schemaname = 'public';
|
|
254
269
|
const columnArraySql = `
|
|
255
270
|
|
|
256
271
|
SELECT
|
|
@@ -259,12 +274,12 @@ let CrudStandardDesignApi = class CrudStandardDesignApi extends BaseApiControlle
|
|
|
259
274
|
WHERE table_schema = $1 and table_name = $2
|
|
260
275
|
ORDER BY ordinal_position;
|
|
261
276
|
|
|
262
|
-
`.trim();
|
|
277
|
+
`.trim();
|
|
263
278
|
const dbType = keys_1.SqlDbType.postgres;
|
|
264
279
|
const columnArray = await this.curdMixService.executeSQL({
|
|
265
280
|
executeSql: columnArraySql,
|
|
266
281
|
sqlDatabase: dbName,
|
|
267
|
-
|
|
282
|
+
sqlDbType: dbType,
|
|
268
283
|
crudType: keys_1.KeyOfCrudTypes.SYS_QUERY,
|
|
269
284
|
executeSqlArgs: [schemaname, tableName],
|
|
270
285
|
});
|
|
@@ -274,11 +289,11 @@ let CrudStandardDesignApi = class CrudStandardDesignApi extends BaseApiControlle
|
|
|
274
289
|
fieldIndex: column_name || '',
|
|
275
290
|
fieldTitle: column_name || '',
|
|
276
291
|
isNullable: is_nullable,
|
|
277
|
-
defaultValue: column_default ||
|
|
292
|
+
defaultValue: column_default || '',
|
|
278
293
|
extra: others,
|
|
279
294
|
// key: column_name, // 索引
|
|
280
295
|
type: data_type,
|
|
281
|
-
is_identity: is_identity
|
|
296
|
+
is_identity: is_identity,
|
|
282
297
|
};
|
|
283
298
|
});
|
|
284
299
|
return {
|
|
@@ -24,6 +24,7 @@ const FileCenterService_1 = require("../../service/FileCenterService");
|
|
|
24
24
|
const SystemTables_1 = require("../../models/SystemTables");
|
|
25
25
|
const keys_1 = require("../../libs/crud-pro/models/keys");
|
|
26
26
|
const WorkbenchService_1 = require("../../service/WorkbenchService");
|
|
27
|
+
const global_config_1 = require("../../libs/global-config/global-config");
|
|
27
28
|
function toAssetsSchema(fileList) {
|
|
28
29
|
for (let i = 0; i < fileList.length; i++) {
|
|
29
30
|
const fileListElement = fileList[i];
|
|
@@ -109,6 +110,7 @@ let DeployManageApi = class DeployManageApi extends BaseApiController_1.BaseApiC
|
|
|
109
110
|
if (!Array.isArray(cdnResources) || cdnResources.length === 0) {
|
|
110
111
|
throw new devops_1.BizException('cdnResources参数不存在');
|
|
111
112
|
}
|
|
113
|
+
const { SystemDbName, SystemDbType } = global_config_1.GLOBAL_STATIC_CONFIG.getConfig();
|
|
112
114
|
const workbench = await this.curdMixService.executeCrudByCfg({
|
|
113
115
|
data: {
|
|
114
116
|
package_assets: JSON.stringify(toAssetsSchema(cdnResources)),
|
|
@@ -118,8 +120,8 @@ let DeployManageApi = class DeployManageApi extends BaseApiController_1.BaseApiC
|
|
|
118
120
|
}
|
|
119
121
|
}, {
|
|
120
122
|
sqlTable: SystemTables_1.SystemTables.sys_workbench,
|
|
121
|
-
sqlDatabase:
|
|
122
|
-
|
|
123
|
+
sqlDatabase: SystemDbName,
|
|
124
|
+
sqlDbType: SystemDbType,
|
|
123
125
|
sqlSimpleName: keys_1.KeysOfSimpleSQL.SIMPLE_UPDATE
|
|
124
126
|
});
|
|
125
127
|
const app = await this.curdMixService.executeCrudByCfg({
|
|
@@ -131,8 +133,8 @@ let DeployManageApi = class DeployManageApi extends BaseApiController_1.BaseApiC
|
|
|
131
133
|
}
|
|
132
134
|
}, {
|
|
133
135
|
sqlTable: SystemTables_1.SystemTables.sys_app,
|
|
134
|
-
sqlDatabase:
|
|
135
|
-
|
|
136
|
+
sqlDatabase: SystemDbName,
|
|
137
|
+
sqlDbType: SystemDbType,
|
|
136
138
|
sqlSimpleName: keys_1.KeysOfSimpleSQL.SIMPLE_UPDATE
|
|
137
139
|
});
|
|
138
140
|
this.workbenchService.clearCache();
|
|
@@ -18,11 +18,13 @@ const permission_middleware_1 = require("../../middleware/permission.middleware"
|
|
|
18
18
|
const SystemPerm_1 = require("../../models/SystemPerm");
|
|
19
19
|
const SystemTables_1 = require("../../models/SystemTables");
|
|
20
20
|
const common_dto_1 = require("../../libs/utils/common-dto");
|
|
21
|
+
const global_config_1 = require("../../libs/global-config/global-config");
|
|
21
22
|
let SuperAdminManageApi = class SuperAdminManageApi extends BaseApiController_1.BaseApiController {
|
|
22
23
|
/**
|
|
23
24
|
* 预设系统内置功能点数据
|
|
24
25
|
*/
|
|
25
26
|
async presetsFuncCode() {
|
|
27
|
+
const { SystemDbName, SystemDbType } = global_config_1.GLOBAL_STATIC_CONFIG.getConfig();
|
|
26
28
|
const funcCodeList = Object.keys(SystemPerm_1.SystemFuncCodeNameMap);
|
|
27
29
|
for (let i = 0; i < funcCodeList.length; i++) {
|
|
28
30
|
const funcCode = funcCodeList[i];
|
|
@@ -36,8 +38,8 @@ let SuperAdminManageApi = class SuperAdminManageApi extends BaseApiController_1.
|
|
|
36
38
|
}, {
|
|
37
39
|
sqlTable: SystemTables_1.SystemTables.sys_perm_func,
|
|
38
40
|
sqlSimpleName: keys_1.KeysOfSimpleSQL.SIMPLE_INSERT,
|
|
39
|
-
sqlDatabase:
|
|
40
|
-
|
|
41
|
+
sqlDatabase: SystemDbName,
|
|
42
|
+
sqlDbType: SystemDbType,
|
|
41
43
|
});
|
|
42
44
|
}
|
|
43
45
|
return common_dto_1.CommonResult.successRes();
|
|
@@ -46,6 +48,7 @@ let SuperAdminManageApi = class SuperAdminManageApi extends BaseApiController_1.
|
|
|
46
48
|
* 预设系统内置角色数据
|
|
47
49
|
*/
|
|
48
50
|
async presetsRoleCode() {
|
|
51
|
+
const { SystemDbName, SystemDbType } = global_config_1.GLOBAL_STATIC_CONFIG.getConfig();
|
|
49
52
|
const roleCodeList = [SystemPerm_1.SystemRoleCode.DevOpsViewer, SystemPerm_1.SystemRoleCode.DevOpsWriter];
|
|
50
53
|
for (let i = 0; i < roleCodeList.length; i++) {
|
|
51
54
|
const roleCode = roleCodeList[i];
|
|
@@ -59,8 +62,8 @@ let SuperAdminManageApi = class SuperAdminManageApi extends BaseApiController_1.
|
|
|
59
62
|
}, {
|
|
60
63
|
sqlTable: SystemTables_1.SystemTables.sys_perm_role,
|
|
61
64
|
sqlSimpleName: keys_1.KeysOfSimpleSQL.SIMPLE_INSERT,
|
|
62
|
-
sqlDatabase:
|
|
63
|
-
|
|
65
|
+
sqlDatabase: SystemDbName,
|
|
66
|
+
sqlDbType: SystemDbType,
|
|
64
67
|
});
|
|
65
68
|
}
|
|
66
69
|
return common_dto_1.CommonResult.successRes();
|
|
@@ -69,6 +72,7 @@ let SuperAdminManageApi = class SuperAdminManageApi extends BaseApiController_1.
|
|
|
69
72
|
* 预设系统内置:角色和功能点的关系
|
|
70
73
|
*/
|
|
71
74
|
async presetsRoleFuncList() {
|
|
75
|
+
const { SystemDbName, SystemDbType } = global_config_1.GLOBAL_STATIC_CONFIG.getConfig();
|
|
72
76
|
const funcCodeList = Object.keys(SystemPerm_1.SystemFuncCodeNameMap);
|
|
73
77
|
for (let i = 0; i < funcCodeList.length; i++) {
|
|
74
78
|
const funcCode = funcCodeList[i];
|
|
@@ -81,8 +85,8 @@ let SuperAdminManageApi = class SuperAdminManageApi extends BaseApiController_1.
|
|
|
81
85
|
}, {
|
|
82
86
|
sqlTable: SystemTables_1.SystemTables.sys_perm_role_func,
|
|
83
87
|
sqlSimpleName: keys_1.KeysOfSimpleSQL.SIMPLE_INSERT,
|
|
84
|
-
sqlDatabase:
|
|
85
|
-
|
|
88
|
+
sqlDatabase: SystemDbName,
|
|
89
|
+
sqlDbType: SystemDbType,
|
|
86
90
|
});
|
|
87
91
|
}
|
|
88
92
|
for (let i = 0; i < funcCodeList.length; i++) {
|
|
@@ -97,8 +101,8 @@ let SuperAdminManageApi = class SuperAdminManageApi extends BaseApiController_1.
|
|
|
97
101
|
}, {
|
|
98
102
|
sqlTable: SystemTables_1.SystemTables.sys_perm_role_func,
|
|
99
103
|
sqlSimpleName: keys_1.KeysOfSimpleSQL.SIMPLE_INSERT,
|
|
100
|
-
sqlDatabase:
|
|
101
|
-
|
|
104
|
+
sqlDatabase: SystemDbName,
|
|
105
|
+
sqlDbType: SystemDbType,
|
|
102
106
|
});
|
|
103
107
|
}
|
|
104
108
|
}
|
|
@@ -18,6 +18,7 @@ const SystemPerm_1 = require("../../models/SystemPerm");
|
|
|
18
18
|
const bizmodels_1 = require("../../models/bizmodels");
|
|
19
19
|
const SystemTables_1 = require("../../models/SystemTables");
|
|
20
20
|
const common_dto_1 = require("../../libs/utils/common-dto");
|
|
21
|
+
const global_config_1 = require("../../libs/global-config/global-config");
|
|
21
22
|
let SysConfigMangeApi = class SysConfigMangeApi extends BaseApiController_1.BaseApiController {
|
|
22
23
|
async getSysConfigList() {
|
|
23
24
|
return this.executeSysSimpleSQL('sys_configs', keys_1.KeysOfSimpleSQL.SIMPLE_QUERY_PAGE, {
|
|
@@ -47,12 +48,13 @@ let SysConfigMangeApi = class SysConfigMangeApi extends BaseApiController_1.Base
|
|
|
47
48
|
});
|
|
48
49
|
}
|
|
49
50
|
async updateSysConfig() {
|
|
51
|
+
const { SystemDbName, SystemDbType } = global_config_1.GLOBAL_STATIC_CONFIG.getConfig();
|
|
50
52
|
const body = this.ctx.request.body;
|
|
51
53
|
const id = body.condition.id;
|
|
52
54
|
if (!id) {
|
|
53
55
|
return common_dto_1.CommonResult.errorRes("id不能为空");
|
|
54
56
|
}
|
|
55
|
-
const sysConfig = await this.curdMixService.getBbUtil(
|
|
57
|
+
const sysConfig = await this.curdMixService.getBbUtil(SystemDbName, SystemDbType).getOne({ condition: body.condition }, SystemTables_1.SystemTables.sys_configs);
|
|
56
58
|
if (!sysConfig) {
|
|
57
59
|
return common_dto_1.CommonResult.errorRes("配置项不存在");
|
|
58
60
|
}
|
|
@@ -18,6 +18,7 @@ const permission_middleware_1 = require("../../middleware/permission.middleware"
|
|
|
18
18
|
const SystemPerm_1 = require("../../models/SystemPerm");
|
|
19
19
|
const exceptions_1 = require("../../libs/crud-pro/exceptions");
|
|
20
20
|
const SystemTables_1 = require("../../models/SystemTables");
|
|
21
|
+
const global_config_1 = require("../../libs/global-config/global-config");
|
|
21
22
|
const accountNameBlacklist = new Set(['sa', 'root', 'admin', 'superadmin', 'administrator', 'sys', 'sysop', 'schedule_user']);
|
|
22
23
|
function checkAccountCreateBlacklist(value) {
|
|
23
24
|
if (!value) {
|
|
@@ -54,6 +55,10 @@ let UserAccountManageApi = class UserAccountManageApi extends BaseApiController_
|
|
|
54
55
|
async createUserAccount() {
|
|
55
56
|
const body = this.ctx.request.body;
|
|
56
57
|
body.data.account_id = (0, functions_1.createUniqueId)();
|
|
58
|
+
const { generateUserAccountId } = global_config_1.GLOBAL_STATIC_CONFIG.getConfig();
|
|
59
|
+
if (typeof generateUserAccountId === 'function') {
|
|
60
|
+
body.data.account_id = await generateUserAccountId(body.data);
|
|
61
|
+
}
|
|
57
62
|
return this.executeSysSimpleSQL(SystemTables_1.SystemTables.sys_user_account, keys_1.KeysOfSimpleSQL.SIMPLE_INSERT, {
|
|
58
63
|
validateCfg: {
|
|
59
64
|
'data.login_name': LOGIN_NAME_VALIDATE,
|
|
@@ -11,7 +11,6 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.AuthController = void 0;
|
|
13
13
|
const core_1 = require("@midwayjs/core");
|
|
14
|
-
const axios_1 = require("axios");
|
|
15
14
|
const BaseApiController_1 = require("../base/BaseApiController");
|
|
16
15
|
const AuthService_1 = require("../../service/AuthService");
|
|
17
16
|
const userSession_1 = require("../../models/userSession");
|
|
@@ -51,52 +50,6 @@ let AuthController = class AuthController extends BaseApiController_1.BaseApiCon
|
|
|
51
50
|
this.ctx.cookies.set(userSession_1.SESSION_ID_KEY, userSessionInfo.sessionId, userSession_1.sessionCookieCfg);
|
|
52
51
|
return common_dto_1.CommonResult.successMsg('登录成功', userSessionInfo);
|
|
53
52
|
}
|
|
54
|
-
/**
|
|
55
|
-
* 使用https://medstatistic.com/账号登录
|
|
56
|
-
*/
|
|
57
|
-
async loginByMedStatistic() {
|
|
58
|
-
var _a;
|
|
59
|
-
const { medStatisticToken } = this.ctx.request.body;
|
|
60
|
-
if (!medStatisticToken) {
|
|
61
|
-
return common_dto_1.CommonResult.errorRes("medStatisticToken is null");
|
|
62
|
-
}
|
|
63
|
-
const workbench = await this.workbenchService.getCurrentHostWorkbenchInfo();
|
|
64
|
-
if (!workbench) {
|
|
65
|
-
throw new exceptions_1.CommonException('WORKBENCH_IS_NOT_FOUND', '站点未找到');
|
|
66
|
-
}
|
|
67
|
-
// 先删除之前的cookie
|
|
68
|
-
const sessionId = this.ctx.cookies.get(userSession_1.SESSION_ID_KEY, userSession_1.sessionCookieCfg);
|
|
69
|
-
await this.authService.removeUserSession(sessionId);
|
|
70
|
-
let userInfoRes = null;
|
|
71
|
-
try {
|
|
72
|
-
userInfoRes = await axios_1.default.get("https://console.medstatistic.com/api/user/index?lang=zh-cn", {
|
|
73
|
-
headers: {
|
|
74
|
-
host: "console.medstatistic.com",
|
|
75
|
-
origin: "https://console.medstatistic.com",
|
|
76
|
-
token: medStatisticToken
|
|
77
|
-
},
|
|
78
|
-
responseType: 'json'
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
catch (e) {
|
|
82
|
-
return common_dto_1.CommonResult.errorRes((e === null || e === void 0 ? void 0 : e.message) || '');
|
|
83
|
-
}
|
|
84
|
-
const userInfo = (_a = userInfoRes === null || userInfoRes === void 0 ? void 0 : userInfoRes.data) === null || _a === void 0 ? void 0 : _a.data;
|
|
85
|
-
if (!userInfo || !userInfo.id) {
|
|
86
|
-
return common_dto_1.CommonResult.errorRes("USER_NOT_EXIST");
|
|
87
|
-
}
|
|
88
|
-
const consumerUserInfo = {
|
|
89
|
-
workbenchCode: workbench.workbench_code,
|
|
90
|
-
accountType: 'medstatistic',
|
|
91
|
-
accountId: userInfo.id,
|
|
92
|
-
nickName: userInfo.nickname,
|
|
93
|
-
loginName: `${userInfo.id}_${userInfo.username}`,
|
|
94
|
-
avatar: userInfo.avatar,
|
|
95
|
-
};
|
|
96
|
-
const userSessionInfo = await this.authService.createUserSessionForConsumer(consumerUserInfo);
|
|
97
|
-
this.ctx.cookies.set(userSession_1.SESSION_ID_KEY, userSessionInfo.sessionId, userSession_1.sessionCookieCfg);
|
|
98
|
-
return common_dto_1.CommonResult.successMsg('登录成功', userSessionInfo);
|
|
99
|
-
}
|
|
100
53
|
/**
|
|
101
54
|
* 退出
|
|
102
55
|
*/
|
|
@@ -153,12 +106,6 @@ __decorate([
|
|
|
153
106
|
__metadata("design:paramtypes", []),
|
|
154
107
|
__metadata("design:returntype", Promise)
|
|
155
108
|
], AuthController.prototype, "login", null);
|
|
156
|
-
__decorate([
|
|
157
|
-
(0, core_1.Post)('/loginByMedStatistic'),
|
|
158
|
-
__metadata("design:type", Function),
|
|
159
|
-
__metadata("design:paramtypes", []),
|
|
160
|
-
__metadata("design:returntype", Promise)
|
|
161
|
-
], AuthController.prototype, "loginByMedStatistic", null);
|
|
162
109
|
__decorate([
|
|
163
110
|
(0, core_1.Post)('/logout'),
|
|
164
111
|
__metadata("design:type", Function),
|
|
@@ -20,18 +20,20 @@ const SystemTables_1 = require("../../models/SystemTables");
|
|
|
20
20
|
const WorkbenchService_1 = require("../../service/WorkbenchService");
|
|
21
21
|
const render_utils_1 = require("../../libs/utils/render-utils");
|
|
22
22
|
const crypto_utils_1 = require("../../libs/utils/crypto-utils");
|
|
23
|
+
const global_config_1 = require("../../libs/global-config/global-config");
|
|
23
24
|
/**
|
|
24
25
|
* 渲染独立外部应用
|
|
25
26
|
*/
|
|
26
27
|
let AppRenderController = class AppRenderController extends BaseApiController_1.BaseApiController {
|
|
27
28
|
async home(appPath) {
|
|
29
|
+
const { SystemDbName, SystemDbType } = global_config_1.GLOBAL_STATIC_CONFIG.getConfig();
|
|
28
30
|
const appPathArr = appPath.split('/');
|
|
29
31
|
const appCode = appPathArr[0];
|
|
30
32
|
const res = await this.curdMixService.executeCrudByCfg({ condition: { app_code: appCode } }, {
|
|
31
33
|
sqlTable: SystemTables_1.SystemTables.sys_app,
|
|
32
34
|
sqlSimpleName: keys_1.KeysOfSimpleSQL.SIMPLE_QUERY_ONE,
|
|
33
|
-
sqlDatabase:
|
|
34
|
-
|
|
35
|
+
sqlDatabase: SystemDbName,
|
|
36
|
+
sqlDbType: SystemDbType,
|
|
35
37
|
});
|
|
36
38
|
const { row: appInfo } = res.getResModel();
|
|
37
39
|
if (!appInfo) {
|
|
@@ -21,7 +21,7 @@ let TestApiController = class TestApiController extends BaseApiController_1.Base
|
|
|
21
21
|
sqlTable: "test_table1",
|
|
22
22
|
sqlSimpleName: keys_1.KeysOfSimpleSQL.SIMPLE_QUERY,
|
|
23
23
|
sqlDatabase: "postgres_test1",
|
|
24
|
-
|
|
24
|
+
sqlDbType: keys_1.SqlDbType.postgres,
|
|
25
25
|
updateCfg: {},
|
|
26
26
|
};
|
|
27
27
|
return this.curdMixService.executeCrudByCfg({
|
package/dist/index.d.ts
CHANGED
|
@@ -30,10 +30,6 @@ export * from './controller/manage/SysConfigMangeApi';
|
|
|
30
30
|
export * from './controller/manage/SystemInfoManageApi';
|
|
31
31
|
export * from './controller/manage/UserAccountManageApi';
|
|
32
32
|
export * from './controller/manage/WorkbenchMangeApi';
|
|
33
|
-
export * from './controller/medstatistic/MedAdminController';
|
|
34
|
-
export * from './controller/medstatistic/MedClientController';
|
|
35
|
-
export * from './controller/medstatistic/MedMessageService';
|
|
36
|
-
export * from './controller/medstatistic/MedScoreService';
|
|
37
33
|
export * from './controller/myinfo/AuthController';
|
|
38
34
|
export * from './controller/myinfo/MyInfoController';
|
|
39
35
|
export * from './controller/render/AppRenderController';
|
|
@@ -43,6 +39,7 @@ export * from './filter/notfound.filter';
|
|
|
43
39
|
export * from './middleware/forbidden.middleware';
|
|
44
40
|
export * from './middleware/global.middleware';
|
|
45
41
|
export * from './middleware/tx.middleware';
|
|
42
|
+
export * from './middleware/permission.middleware';
|
|
46
43
|
export * from './service/AuthService';
|
|
47
44
|
export * from './service/EnumInfoService';
|
|
48
45
|
export * from './service/FileCenterService';
|
|
@@ -68,3 +65,30 @@ export * from './service/curd/CurdMixService';
|
|
|
68
65
|
export * from './service/curd/CurdProService';
|
|
69
66
|
export * from './service/proxyapi/ProxyApiLoadService';
|
|
70
67
|
export * from './service/proxyapi/ProxyApiService';
|
|
68
|
+
export * from './models/userSession';
|
|
69
|
+
export * from './models/bizmodels';
|
|
70
|
+
export * from './models/SystemEntities';
|
|
71
|
+
export * from './models/SystemPerm';
|
|
72
|
+
export * from './models/contextLogger';
|
|
73
|
+
export * from './models/devops';
|
|
74
|
+
export * from './models/SystemTables';
|
|
75
|
+
export * from './libs/utils/common-dto';
|
|
76
|
+
export * from './libs/utils/crypto-utils';
|
|
77
|
+
export * from './libs/utils/fatcms-request';
|
|
78
|
+
export * from './libs/utils/functions';
|
|
79
|
+
export * from './libs/utils/ordernum-utils';
|
|
80
|
+
export * from './libs/utils/parseConfig';
|
|
81
|
+
export * from './libs/crud-pro/CrudPro';
|
|
82
|
+
export * from './libs/crud-pro/defaultConfigs';
|
|
83
|
+
export * from './libs/crud-pro/exceptions';
|
|
84
|
+
export * from './libs/crud-pro/interfaces';
|
|
85
|
+
export * from './libs/crud-pro/models/ExecuteContext';
|
|
86
|
+
export * from './libs/crud-pro/models/FuncContext';
|
|
87
|
+
export * from './libs/crud-pro/models/RequestModel';
|
|
88
|
+
export * from './libs/crud-pro/models/SqlCfgModel';
|
|
89
|
+
export * from './libs/crud-pro/models/Transaction';
|
|
90
|
+
export * from './libs/crud-pro/models/keys';
|
|
91
|
+
export * from './libs/crud-pro/models/ExecuteContextFunc';
|
|
92
|
+
export * from './libs/crud-pro/models/RequestCfgModel';
|
|
93
|
+
export * from './libs/crud-pro/models/SqlSegArg';
|
|
94
|
+
export * from './libs/global-config/global-config';
|