use of io.jpom.service.dblog.DbMonitorNotifyLogService in project Jpom by dromara.
the class LoadJsonConfigToDb method convertMonitorLogField.
/**
* 将 监控报警记录 里面但 logId 字段更新为 id
*/
public void convertMonitorLogField() {
DbMonitorNotifyLogService monitorNotifyLogService = SpringUtil.getBean(DbMonitorNotifyLogService.class);
String tableName = monitorNotifyLogService.getTableName();
List<Entity> query = monitorNotifyLogService.query("select * from " + tableName + " order by createTime asc limit 1");
Entity first = CollUtil.getFirst(query);
if (first == null) {
this.checkLogFiled(monitorNotifyLogService);
return;
}
Object logId = first.get("logId");
if (logId == null) {
this.checkLogFiled(monitorNotifyLogService);
return;
}
String sql = "update " + tableName + " set ID = LOGID where ID = '' and LOGID is not null and LOGID <> '';";
int execute = monitorNotifyLogService.execute(sql);
if (execute > 0) {
Console.log("convert monitor log field {}", execute);
}
// 标记包含旧字段
MonitorNotifyLog.HAS_LOG_ID = true;
}
Aggregations