-- =====================================================
-- 数据字典SQL：员工实体关系模块
-- 创建时间: 2026-02-09
-- 说明: 包含关系状态和数据来源两个字典类型
-- =====================================================

-- =====================================================
-- 一、字典类型定义
-- =====================================================

-- 字典类型：关系状态
INSERT INTO sys_dict_type(dict_id, tenant_id, dict_name, dict_type, status, create_dept, create_by, create_time,
                          update_by, update_time, remark)
VALUES (NULL, '000000', '关系状态', 'ccdi_relation_status', '0', NULL, 'admin', NOW(), NULL, NULL,
        '关系状态列表：0-无效，1-有效');

-- 字典类型：数据来源
INSERT INTO sys_dict_type(dict_id, tenant_id, dict_name, dict_type, status, create_dept, create_by, create_time,
                          update_by, update_time, remark)
VALUES (NULL, '000000', '数据来源', 'ccdi_data_source', '0', NULL, 'admin', NOW(), NULL, NULL,
        '数据来源列表：MANUAL-手动录入，SYSTEM-系统同步，IMPORT-批量导入，API-接口获取');

-- =====================================================
-- 二、字典数据定义
-- =====================================================

-- 关系状态字典数据
INSERT INTO sys_dict_data(dict_code, tenant_id, dict_sort, dict_label, dict_value, dict_type, css_class, list_class,
                          is_default, status, create_dept, create_by, create_time, update_by, update_time, remark)
VALUES (NULL, '000000', 2, '无效', '0', 'ccdi_relation_status', NULL, 'danger', 'N', '0', NULL, 'admin', NOW(), NULL,
        NULL, '关系状态：无效');

INSERT INTO sys_dict_data(dict_code, tenant_id, dict_sort, dict_label, dict_value, dict_type, css_class, list_class,
                          is_default, status, create_dept, create_by, create_time, update_by, update_time, remark)
VALUES (NULL, '000000', 1, '有效', '1', 'ccdi_relation_status', NULL, 'primary', 'Y', '0', NULL, 'admin', NOW(), NULL,
        NULL, '关系状态：有效');

-- 数据来源字典数据
INSERT INTO sys_dict_data(dict_code, tenant_id, dict_sort, dict_label, dict_value, dict_type, css_class, list_class,
                          is_default, status, create_dept, create_by, create_time, update_by, update_time, remark)
VALUES (NULL, '000000', 1, '手动录入', 'MANUAL', 'ccdi_data_source', NULL, 'default', 'N', '0', NULL, 'admin', NOW(),
        NULL, NULL, '数据来源：手动录入');

INSERT INTO sys_dict_data(dict_code, tenant_id, dict_sort, dict_label, dict_value, dict_type, css_class, list_class,
                          is_default, status, create_dept, create_by, create_time, update_by, update_time, remark)
VALUES (NULL, '000000', 2, '系统同步', 'SYSTEM', 'ccdi_data_source', NULL, 'info', 'N', '0', NULL, 'admin', NOW(), NULL,
        NULL, '数据来源：系统同步');

INSERT INTO sys_dict_data(dict_code, tenant_id, dict_sort, dict_label, dict_value, dict_type, css_class, list_class,
                          is_default, status, create_dept, create_by, create_time, update_by, update_time, remark)
VALUES (NULL, '000000', 3, '批量导入', 'IMPORT', 'ccdi_data_source', NULL, 'success', 'N', '0', NULL, 'admin', NOW(),
        NULL, NULL, '数据来源：批量导入');

INSERT INTO sys_dict_data(dict_code, tenant_id, dict_sort, dict_label, dict_value, dict_type, css_class, list_class,
                          is_default, status, create_dept, create_by, create_time, update_by, update_time, remark)
VALUES (NULL, '000000', 4, '接口获取', 'API', 'ccdi_data_source', NULL, 'warning', 'N', '0', NULL, 'admin', NOW(), NULL,
        NULL, '数据来源：接口获取');

-- =====================================================
-- 三、回滚SQL（如需删除这些字典数据，执行以下语句）
-- =====================================================
-- DELETE FROM sys_dict_data WHERE dict_type = 'ccdi_relation_status';
-- DELETE FROM sys_dict_data WHERE dict_type = 'ccdi_data_source';
-- DELETE FROM sys_dict_type WHERE dict_type = 'ccdi_relation_status';
-- DELETE FROM sys_dict_type WHERE dict_type = 'ccdi_data_source';
