/*
 Navicat Premium Data Transfer
 
 Source Server         : local_mariadb
 Source Server Type    : MariaDB
 Source Server Version : 100338 (10.3.38-MariaDB)
 Source Host           : localhost:33066
 Source Schema         : omc_db
 
 Target Server Type    : MariaDB
 Target Server Version : 100338 (10.3.38-MariaDB)
 File Encoding         : 65001
 
 Date: 25/10/2023 18:24:04
 */
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for sys_job
-- ----------------------------
CREATE TABLE IF NOT EXISTS `omc_db`.`sys_job` (
  `job_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '任务ID',
  `job_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '任务名称',
  `job_group` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'DEFAULT' COMMENT '任务组名',
  `invoke_target` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '调用目标字符串',
  `target_params` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '调用目标传入参数',
  `cron_expression` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT 'cron执行表达式',
  `misfire_policy` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '3' COMMENT '计划执行错误策略（1立即执行 2执行一次 3放弃执行）',
  `concurrent` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '0' COMMENT '是否并发执行（0禁止 1允许）',
  `status` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '0' COMMENT '任务状态（0暂停 1正常）',
  `save_log` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '0' COMMENT '是否记录任务日志（0不记录 1记录）',
  `create_by` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '创建者',
  `create_time` bigint(20) NULL DEFAULT 0 COMMENT '创建时间',
  `update_by` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '更新者',
  `update_time` bigint(20) NULL DEFAULT 0 COMMENT '更新时间',
  `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '备注',
  PRIMARY KEY (`job_id`, `job_name`, `job_group`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 8 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '调度任务调度表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of sys_job
-- ----------------------------
INSERT IGNORE INTO
    `omc_db`.`sys_job` (
        `job_id`,
        `job_name`,
        `job_group`,
        `invoke_target`,
        `target_params`,
        `cron_expression`,
        `misfire_policy`,
        `concurrent`,
        `status`,
        `save_log`,
        `create_by`,
        `create_time`,
        `update_by`,
        `update_time`,
        `remark`
    )
VALUES (
        1,
        '监控-系统资源',
        'SYSTEM',
        'monitor_sys_resource',
        '{\"interval\":5}',
        '0 0/5 * * * ?',
        '3',
        '0',
        '1',
        '0',
        'admin',
        1698478134839,
        'admin',
        1698483081920,
        '系统资源CPU/IO/Netword收集，interval单位分钟，0 0/5 * * * ? 表示平均interva5分钟资源情况'
    );

INSERT IGNORE INTO
    `omc_db`.`sys_job` (
        `job_id`,
        `job_name`,
        `job_group`,
        `invoke_target`,
        `target_params`,
        `cron_expression`,
        `misfire_policy`,
        `concurrent`,
        `status`,
        `save_log`,
        `create_by`,
        `create_time`,
        `update_by`,
        `update_time`,
        `remark`
    )
VALUES (
        4,
        '删除过期网元备份文件',
        'SYSTEM',
        'delExpiredNeBackup',
        '{\"duration\":60}',
        '0 20 0 * * ?',
        '3',
        '0',
        '1',
        '1',
        'admin',
        1697091151529,
        'admin',
        1698134207967,
        '删除过期网元etc备份文件, 传入参数表示保留{duration}天的备份文件, 默认60天'
    );

INSERT IGNORE INTO
    `omc_db`.`sys_job` (
        `job_id`,
        `job_name`,
        `job_group`,
        `invoke_target`,
        `target_params`,
        `cron_expression`,
        `misfire_policy`,
        `concurrent`,
        `status`,
        `save_log`,
        `create_by`,
        `create_time`,
        `update_by`,
        `update_time`,
        `remark`
    )
VALUES (
        5,
        '删除过期历史告警记录',
        'SYSTEM',
        'deleteExpiredRecord',
        '{\"duration\":90,\"tableName\":\"alarm\",\"colName\":\"event_time\",\"extras\":\"alarm_status=\'0\'\"}',
        '0 10 0 * * ?',
        '3',
        '0',
        '1',
        '1',
        'admin',
        1698150591601,
        'admin',
        1698197292003,
        '删除过期历史告警记录，传入参数表示保留{duration}天的历史告警记录'
    );

INSERT IGNORE INTO
    `omc_db`.`sys_job` (
        `job_id`,
        `job_name`,
        `job_group`,
        `invoke_target`,
        `target_params`,
        `cron_expression`,
        `misfire_policy`,
        `concurrent`,
        `status`,
        `save_log`,
        `create_by`,
        `create_time`,
        `update_by`,
        `update_time`,
        `remark`
    )
VALUES (
        6,
        '删除过期黄金指标记录',
        'SYSTEM',
        'deleteExpiredRecord',
        '{\"duration\":15,\"tableName\":\"gold_kpi\",\"colName\":\"date\"}',
        '0 15 0 * * ?',
        '3',
        '0',
        '1',
        '1',
        'admin',
        1698197983126,
        'admin',
        1698198074872,
        '黄金指标记录保留{duration}天'
    );

INSERT IGNORE INTO
    `omc_db`.`sys_job` (
        `job_id`,
        `job_name`,
        `job_group`,
        `invoke_target`,
        `target_params`,
        `cron_expression`,
        `misfire_policy`,
        `concurrent`,
        `status`,
        `save_log`,
        `create_by`,
        `create_time`,
        `update_by`,
        `update_time`,
        `remark`
    )
VALUES (
        7,
        '网元配置自动备份任务',
        'SYSTEM',
        'backupEtcFromNE',
        '',
        '0 30 0 * * ?',
        '3',
        '0',
        '1',
        '1',
        'admin',
        1698223216479,
        '',
        0,
        '自动备份网元etc目录下的配置文件'
    );

UPDATE `omc_db`.`sys_job`
SET
    `invoke_target` = 'monitor_sys_resource',
    `target_params` = '{\"interval\":5}',
    `cron_expression` = '0 0/5 * * * ?',
    `misfire_policy` = '3',
    `concurrent` = '0',
    `status` = '0',
    `save_log` = '0',
    `create_by` = 'supervisor',
    `create_time` = 1698478134839,
    `update_by` = 'supervisor',
    `update_time` = 1700566657587,
    `remark` = 'job.monitor_sys_resource_remark'
WHERE
    `job_id` = 1
    AND `job_name` = 'job.monitor_sys_resource'
    AND `job_group` = 'SYSTEM';

UPDATE `omc_db`.`sys_job`
SET
    `invoke_target` = 'delExpiredNeBackup',
    `target_params` = '{\"duration\":60}',
    `cron_expression` = '0 20 0 * * ?',
    `misfire_policy` = '3',
    `concurrent` = '0',
    `status` = '1',
    `save_log` = '1',
    `create_by` = 'supervisor',
    `create_time` = 1698478134840,
    `update_by` = NULL,
    `update_time` = 0,
    `remark` = 'job.delExpiredNeBackupRemark'
WHERE
    `job_id` = 4
    AND `job_name` = 'job.delExpiredNeBackup'
    AND `job_group` = 'SYSTEM';

UPDATE `omc_db`.`sys_job`
SET
    `invoke_target` = 'deleteExpiredRecord',
    `target_params` = '{\"duration\":90,\"tableName\":\"alarm\",\"colName\":\"event_time\",\"extras\":\"alarm_status=\'0\'\"}',
    `cron_expression` = '0 10 0 * * ?',
    `misfire_policy` = '3',
    `concurrent` = '0',
    `status` = '1',
    `save_log` = '1',
    `create_by` = 'supervisor',
    `create_time` = 1698478134841,
    `update_by` = NULL,
    `update_time` = 0,
    `remark` = 'job.deleteExpiredAlarmRecordRemark'
WHERE
    `job_id` = 5
    AND `job_name` = 'job.deleteExpiredAlarmRecord'
    AND `job_group` = 'SYSTEM';

UPDATE `omc_db`.`sys_job`
SET
    `invoke_target` = 'deleteExpiredRecord',
    `target_params` = '{\"duration\":15,\"tableName\":\"gold_kpi\",\"colName\":\"date\"}',
    `cron_expression` = '0 15 0 * * ?',
    `misfire_policy` = '3',
    `concurrent` = '0',
    `status` = '1',
    `save_log` = '1',
    `create_by` = 'supervisor',
    `create_time` = 1698478134842,
    `update_by` = NULL,
    `update_time` = 0,
    `remark` = 'job.deleteExpiredKpiRecordRemark'
WHERE
    `job_id` = 6
    AND `job_name` = 'job.deleteExpiredKpiRecord'
    AND `job_group` = 'SYSTEM';

UPDATE `omc_db`.`sys_job`
SET
    `invoke_target` = 'backupEtcFromNE',
    `target_params` = NULL,
    `cron_expression` = '0 30 0 * * ?',
    `misfire_policy` = '3',
    `concurrent` = '0',
    `status` = '1',
    `save_log` = '1',
    `create_by` = 'supervisor',
    `create_time` = 1698478134843,
    `update_by` = NULL,
    `update_time` = 0,
    `remark` = 'job.backupEtcFromNERemark'
WHERE
    `job_id` = 7
    AND `job_name` = 'job.backupEtcFromNE'
    AND `job_group` = 'SYSTEM';

-- 调度任务记录日志字段
UPDATE `omc_db`.`sys_job` SET `save_log` = '1';    

SET FOREIGN_KEY_CHECKS = 1;