From 3d1873907aeb0d0bb5efe555ada3381d224a4699 Mon Sep 17 00:00:00 2001 From: "gao.zhiyuan" Date: Mon, 26 Sep 2022 15:00:05 +0800 Subject: [PATCH] alarmTypeOldName --- api/app/lib/controllers/alarm/app.js | 1 + api/app/lib/controllers/alarm/data.js | 2 +- api/app/lib/models/app_inspection.js | 11 ++++++++++- api/sequelize-automate.config.js | 2 +- script/0.0.4/schema/1.alert_table.sql | 3 +++ 5 files changed, 16 insertions(+), 3 deletions(-) diff --git a/api/app/lib/controllers/alarm/app.js b/api/app/lib/controllers/alarm/app.js index e97305d..a1550c9 100644 --- a/api/app/lib/controllers/alarm/app.js +++ b/api/app/lib/controllers/alarm/app.js @@ -15,6 +15,7 @@ async function inspection (ctx) { screenshot: s.url, createTime: now, description: s.description, + router: s.router } }) diff --git a/api/app/lib/controllers/alarm/data.js b/api/app/lib/controllers/alarm/data.js index 4239f05..68cd57e 100644 --- a/api/app/lib/controllers/alarm/data.js +++ b/api/app/lib/controllers/alarm/data.js @@ -92,7 +92,7 @@ async function list (ctx) { ${anxinyun}.t_structure.name AS StructureName, ${anxinyun}.t_alarm_code.name AS AlarmCodeName, AlarmContent, - ${anxinyun}.t_alarm_type.name AS alarmType + ${anxinyun}.t_alarm_type.old_name AS alarmTypeOldName FROM alarms LEFT JOIN ${anxinyun}.t_structure diff --git a/api/app/lib/models/app_inspection.js b/api/app/lib/models/app_inspection.js index cb48dab..09e4751 100644 --- a/api/app/lib/models/app_inspection.js +++ b/api/app/lib/models/app_inspection.js @@ -25,7 +25,7 @@ module.exports = dc => { autoIncrement: false, references: { key: "id", - model: "projectApp" + model: "app" } }, createTime: { @@ -72,6 +72,15 @@ module.exports = dc => { primaryKey: false, field: "description", autoIncrement: false + }, + router: { + type: DataTypes.STRING, + allowNull: true, + defaultValue: null, + comment: null, + primaryKey: false, + field: "router", + autoIncrement: false } }, { tableName: "app_inspection", diff --git a/api/sequelize-automate.config.js b/api/sequelize-automate.config.js index e34d53b..ae7d5c4 100644 --- a/api/sequelize-automate.config.js +++ b/api/sequelize-automate.config.js @@ -26,7 +26,7 @@ module.exports = { dir: './app/lib/models', // 指定输出 models 文件的目录 typesDir: 'models', // 指定输出 TypeScript 类型定义的文件目录,只有 TypeScript / Midway 等会有类型定义 emptyDir: false, // !!! 谨慎操作 生成 models 之前是否清空 `dir` 以及 `typesDir` - tables: ['app_alarm'], // 指定生成哪些表的 models,如 ['user', 'user_post'];如果为 null,则忽略改属性 + tables: ['app_inspection'], // 指定生成哪些表的 models,如 ['user', 'user_post'];如果为 null,则忽略改属性 skipTables: [], // 指定跳过哪些表的 models,如 ['user'];如果为 null,则忽略改属性 tsNoCheck: false, // 是否添加 `@ts-nocheck` 注释到 models 文件中 ignorePrefix: [], // 生成的模型名称忽略的前缀,因为 项目中有以下表名是以 t_ 开头的,在实际模型中不需要, 可以添加多个 [ 't_data_', 't_',] ,长度较长的 前缀放前面 diff --git a/script/0.0.4/schema/1.alert_table.sql b/script/0.0.4/schema/1.alert_table.sql index 24b49aa..0ed86f1 100644 --- a/script/0.0.4/schema/1.alert_table.sql +++ b/script/0.0.4/schema/1.alert_table.sql @@ -1,2 +1,5 @@ alter table app_alarm add type varchar(64); + +alter table app_inspection + add router varchar(1024);