2025-10-14 19:32:27 +08:00

64 lines
5.7 KiB
SQL

-- SQLite数据库初始化数据
-- 插入默认的解析规则数据
INSERT OR IGNORE INTO parse_rule (id, xml_tag, tag_type, txt_key, parent_tag, is_required, default_value, description, sort_order) VALUES
('1', '任务', 'element', 'task', NULL, 1, NULL, '任务根节点', 1),
('2', '任务信息', 'element', NULL, '任务', 1, NULL, '任务信息节点', 2),
('3', '任务行动信息', 'text', NULL, '任务信息', 1, NULL, '任务行动信息', 3),
('4', '指令有效期', 'text', NULL, '任务信息', 1, NULL, '指令有效期', 4),
('5', '指令确认信息', 'text', NULL, '任务信息', 1, NULL, '指令确认信息', 5),
('6', '覆盖的指令文档', 'text', NULL, '任务信息', 0, NULL, '覆盖的指令文档', 6),
('7', '平台', 'element', 'platform', '任务', 1, NULL, '平台信息节点', 7),
('8', '平台名称', 'text', 'platform_name', '平台', 1, NULL, '平台名称', 8),
('9', '机型', 'text', 'machine_type', '平台', 1, NULL, '机型', 9),
('10', '架数', 'text', 'num_of_cpus', '平台', 1, NULL, 'CPU数量', 10),
('11', '平台识别码', 'text', 'platform_id', '平台', 1, NULL, '平台识别码', 11),
('12', '国家', 'text', 'country', '平台', 1, NULL, '国家', 12),
('13', '行动', 'element_with_attributes', 'action', '平台', 1, NULL, '行动节点', 13),
('14', '航线名称', 'text', 'route_name', '行动', 1, NULL, '航线名称', 14);
-- 插入默认的映射规则数据
INSERT OR IGNORE INTO mapper_rule (id, parse_rule_id, txt_key, mapping_type, mapping_value, function_name, description, sort_order) VALUES
('1', '1', 'task', 'direct', NULL, NULL, '任务根节点映射', 1),
('2', '3', 'task_action', 'direct', NULL, NULL, '任务行动信息映射', 2),
('3', '4', 'start_time', 'function', 'splitTimeRange', 'extractStartTime', '开始时间映射', 3),
('4', '4', 'end_time', 'function', 'splitTimeRange', 'extractEndTime', '结束时间映射', 4),
('5', '5', 'confirm_info', 'direct', NULL, NULL, '指令确认信息映射', 5),
('6', '6', 'document_version', 'direct', NULL, NULL, '文档版本映射', 6),
('7', '7', 'platform', 'direct', NULL, NULL, '平台信息映射', 7),
('8', '8', 'platform_name', 'direct', NULL, NULL, '平台名称映射', 8),
('9', '9', 'machine_type', 'direct', NULL, NULL, '机型映射', 9),
('10', '10', 'num_of_cpus', 'direct', NULL, NULL, 'CPU数量映射', 10),
('11', '11', 'platform_id', 'direct', NULL, NULL, '平台识别码映射', 11),
('12', '12', 'country', 'direct', NULL, NULL, '国家映射', 12),
('13', '13', 'action', 'direct', NULL, NULL, '行动节点映射', 13),
('14', '14', 'route_name', 'direct', NULL, NULL, '航线名称映射', 14);
-- 插入默认的配置文档数据
INSERT OR IGNORE INTO config_document (id, document_name, document_type, description, sort_order, name, name_space, sort_name) VALUES
('config_doc_001', 'XML解析配置文档', 'xml_parser', 'XML到TXT转换的解析配置文档', 1, 'XML解析配置', 'parser', 'xml_parser_config');
-- 插入默认的条件类型映射数据
INSERT OR IGNORE INTO condition_map (id, config_document_id, condition_key, condition_value, description, sort_order, name, name_space, sort_name) VALUES
('cond_001', 'config_doc_001', 'platform_type', 'Windows', 'Windows平台条件', 1, 'Windows条件', 'platform', 'windows_condition'),
('cond_002', 'config_doc_001', 'platform_type', 'Linux', 'Linux平台条件', 2, 'Linux条件', 'platform', 'linux_condition'),
('cond_003', 'config_doc_001', 'task_type', '常规任务', '常规任务条件', 3, '常规任务条件', 'task', 'normal_task_condition');
-- 插入默认的层级配置数据
INSERT OR IGNORE INTO level_config (id, config_document_id, level_name, level_type, description, sort_order, name, name_space, sort_name) VALUES
('level_001', 'config_doc_001', '任务层级', 'task_level', '任务信息层级配置', 1, '任务层级', 'task', 'task_level'),
('level_002', 'config_doc_001', '平台层级', 'platform_level', '平台信息层级配置', 2, '平台层级', 'platform', 'platform_level'),
('level_003', 'config_doc_001', '行动层级', 'action_level', '行动信息层级配置', 3, '行动层级', 'action', 'action_level');
-- 插入默认的值配置数据
INSERT OR IGNORE INTO value_config (id, level_config_id, value_name, comment, sort_order, name, name_space, sort_name) VALUES
('value_001', 'level_001', '任务名称', '任务名称配置', 1, '任务名称配置', 'task', 'task_name_config'),
('value_002', 'level_001', '任务时间', '任务时间范围配置', 2, '任务时间配置', 'task', 'task_time_config'),
('value_003', 'level_002', '平台信息', '平台基本信息配置', 1, '平台信息配置', 'platform', 'platform_info_config'),
('value_004', 'level_003', '行动信息', '行动详细信息配置', 1, '行动信息配置', 'action', 'action_info_config');
-- 插入默认的配置值数据
INSERT OR IGNORE INTO config_value (id, value_config_id, value_data, value_unit, combined, regex_pattern, regex_replacement, sort_order, enable_value, condition_type, parent_id, name, name_space, sort_name) VALUES
('config_val_001', 'value_001', '{"default": "默认任务"}', NULL, 0, NULL, NULL, 1, 1, NULL, NULL, '默认任务值', 'task', 'default_task_value'),
('config_val_002', 'value_002', '{"format": "yyyy-MM-dd_HH:mm:ss"}', '时间', 0, '(\\d{4}-\\d{2}-\\d{2}_\\d{2}:\\d{2}:\\d{2})~(\\d{4}-\\d{2}-\\d{2}_\\d{2}:\\d{2}:\\d{2})', '$1,$2', 1, 1, 'time_range', NULL, '时间格式配置', 'time', 'time_format_config'),
('config_val_003', 'value_003', '{"platforms": ["Windows", "Linux", "MacOS"]}', NULL, 0, NULL, NULL, 1, 1, NULL, NULL, '平台列表', 'platform', 'platform_list'),
('config_val_004', 'value_004', '{"action_types": ["解析行动", "执行行动", "监控行动"]}', NULL, 0, NULL, NULL, 1, 1, NULL, NULL, '行动类型', 'action', 'action_types');