-- ============================================================
-- 信息智能匹配推送模块 - 补充字典数据
--
-- 说明：这些字典在 Flyway MySQL 脚本（V20260605_3）中已插入
--       sys_dict/sys_dict_item，但前端 useDict 从 DICTIONARY/
--       DICTIONARY_ITEM 表加载，需在此表中补充
--
-- DICTIONARY_ITEM 结构：
--   DictionaryItemID, Code, DictionaryCode, Value(INT), Name, OrderNo, RecordStatus, IsEditable, ParentItemID
--
-- Code 字段规则：
--   - DB存数值的字典（如 publishStatus='0'/'1'）：Code=''，Value 存匹配的 INT
--   - DB存文本的字典（如 companyNature='国有企业'）：Code 存文本，Value 存序号
--
-- 数据库：达梦数据库 (DM8)
-- 创建日期：2026-06-11
-- ============================================================

-- ============================================================
-- 1. 发布状态 (publish_status) — 见习岗位/公益性岗位共用
-- DB存储: '0'=未发布, '1'=已发布
-- ============================================================
INSERT INTO DICTIONARY (DictionaryCode, Name, OrderNo, RecordStatus, DictType)
SELECT 'publish_status', '发布状态', 101, 1, 0 FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM DICTIONARY WHERE DictionaryCode = 'publish_status');

INSERT INTO DICTIONARY_ITEM (DictionaryItemID, Code, DictionaryCode, Value, Name, OrderNo, RecordStatus, IsEditable)
SELECT '178060600000001', '', 'publish_status', 0, '未发布', 1, 1, 1 FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM DICTIONARY_ITEM WHERE DictionaryCode = 'publish_status' AND Value = 0);

INSERT INTO DICTIONARY_ITEM (DictionaryItemID, Code, DictionaryCode, Value, Name, OrderNo, RecordStatus, IsEditable)
SELECT '178060600000002', '', 'publish_status', 1, '已发布', 2, 1, 1 FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM DICTIONARY_ITEM WHERE DictionaryCode = 'publish_status' AND Value = 1);

-- ============================================================
-- 2. 报名状态 (apply_status) — 见习岗位
-- DB存储: '01'=报名中, '02'=人员已满（前导零，需用Code存储）
-- ============================================================
INSERT INTO DICTIONARY (DictionaryCode, Name, OrderNo, RecordStatus, DictType)
SELECT 'apply_status', '报名状态', 102, 1, 0 FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM DICTIONARY WHERE DictionaryCode = 'apply_status');

INSERT INTO DICTIONARY_ITEM (DictionaryItemID, Code, DictionaryCode, Value, Name, OrderNo, RecordStatus, IsEditable)
SELECT '178060600000003', '01', 'apply_status', 1, '报名中', 1, 1, 1 FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM DICTIONARY_ITEM WHERE DictionaryCode = 'apply_status' AND Code = '01');

INSERT INTO DICTIONARY_ITEM (DictionaryItemID, Code, DictionaryCode, Value, Name, OrderNo, RecordStatus, IsEditable)
SELECT '178060600000004', '02', 'apply_status', 2, '人员已满', 2, 1, 1 FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM DICTIONARY_ITEM WHERE DictionaryCode = 'apply_status' AND Code = '02');

-- ============================================================
-- 3. 单位性质 (company_nature) — 见习岗位
-- DB存储文本: '国有企业','民营企业','外资企业','事业单位','社会团体'
-- ============================================================
INSERT INTO DICTIONARY (DictionaryCode, Name, OrderNo, RecordStatus, DictType)
SELECT 'company_nature', '单位性质', 103, 1, 0 FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM DICTIONARY WHERE DictionaryCode = 'company_nature');

INSERT INTO DICTIONARY_ITEM (DictionaryItemID, Code, DictionaryCode, Value, Name, OrderNo, RecordStatus, IsEditable)
SELECT '178060600000005', '国有企业', 'company_nature', 1, '国有企业', 1, 1, 1 FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM DICTIONARY_ITEM WHERE DictionaryCode = 'company_nature' AND Code = '国有企业');

INSERT INTO DICTIONARY_ITEM (DictionaryItemID, Code, DictionaryCode, Value, Name, OrderNo, RecordStatus, IsEditable)
SELECT '178060600000006', '民营企业', 'company_nature', 2, '民营企业', 2, 1, 1 FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM DICTIONARY_ITEM WHERE DictionaryCode = 'company_nature' AND Code = '民营企业');

INSERT INTO DICTIONARY_ITEM (DictionaryItemID, Code, DictionaryCode, Value, Name, OrderNo, RecordStatus, IsEditable)
SELECT '178060600000007', '外资企业', 'company_nature', 3, '外资企业', 3, 1, 1 FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM DICTIONARY_ITEM WHERE DictionaryCode = 'company_nature' AND Code = '外资企业');

INSERT INTO DICTIONARY_ITEM (DictionaryItemID, Code, DictionaryCode, Value, Name, OrderNo, RecordStatus, IsEditable)
SELECT '178060600000008', '事业单位', 'company_nature', 4, '事业单位', 4, 1, 1 FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM DICTIONARY_ITEM WHERE DictionaryCode = 'company_nature' AND Code = '事业单位');

INSERT INTO DICTIONARY_ITEM (DictionaryItemID, Code, DictionaryCode, Value, Name, OrderNo, RecordStatus, IsEditable)
SELECT '178060600000009', '社会团体', 'company_nature', 5, '社会团体', 5, 1, 1 FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM DICTIONARY_ITEM WHERE DictionaryCode = 'company_nature' AND Code = '社会团体');

-- ============================================================
-- 4. 公益性岗位类型 (welfare_post_type) — 公益性岗位
-- DB存储文本: '社区服务','城市管理','公共管理','后勤服务'
-- ============================================================
INSERT INTO DICTIONARY (DictionaryCode, Name, OrderNo, RecordStatus, DictType)
SELECT 'welfare_post_type', '公益性岗位类型', 104, 1, 0 FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM DICTIONARY WHERE DictionaryCode = 'welfare_post_type');

INSERT INTO DICTIONARY_ITEM (DictionaryItemID, Code, DictionaryCode, Value, Name, OrderNo, RecordStatus, IsEditable)
SELECT '178060600000010', '社区服务', 'welfare_post_type', 1, '社区服务', 1, 1, 1 FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM DICTIONARY_ITEM WHERE DictionaryCode = 'welfare_post_type' AND Code = '社区服务');

INSERT INTO DICTIONARY_ITEM (DictionaryItemID, Code, DictionaryCode, Value, Name, OrderNo, RecordStatus, IsEditable)
SELECT '178060600000011', '城市管理', 'welfare_post_type', 2, '城市管理', 2, 1, 1 FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM DICTIONARY_ITEM WHERE DictionaryCode = 'welfare_post_type' AND Code = '城市管理');

INSERT INTO DICTIONARY_ITEM (DictionaryItemID, Code, DictionaryCode, Value, Name, OrderNo, RecordStatus, IsEditable)
SELECT '178060600000012', '公共管理', 'welfare_post_type', 3, '公共管理', 3, 1, 1 FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM DICTIONARY_ITEM WHERE DictionaryCode = 'welfare_post_type' AND Code = '公共管理');

INSERT INTO DICTIONARY_ITEM (DictionaryItemID, Code, DictionaryCode, Value, Name, OrderNo, RecordStatus, IsEditable)
SELECT '178060600000013', '后勤服务', 'welfare_post_type', 4, '后勤服务', 4, 1, 1 FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM DICTIONARY_ITEM WHERE DictionaryCode = 'welfare_post_type' AND Code = '后勤服务');

-- ============================================================
-- 5. 公益性岗位状态 (welfare_post_status) — 公益性岗位
-- DB存储文本: '招聘中','已满','已关闭'
-- ============================================================
INSERT INTO DICTIONARY (DictionaryCode, Name, OrderNo, RecordStatus, DictType)
SELECT 'welfare_post_status', '公益性岗位状态', 105, 1, 0 FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM DICTIONARY WHERE DictionaryCode = 'welfare_post_status');

INSERT INTO DICTIONARY_ITEM (DictionaryItemID, Code, DictionaryCode, Value, Name, OrderNo, RecordStatus, IsEditable)
SELECT '178060600000014', '招聘中', 'welfare_post_status', 1, '招聘中', 1, 1, 1 FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM DICTIONARY_ITEM WHERE DictionaryCode = 'welfare_post_status' AND Code = '招聘中');

INSERT INTO DICTIONARY_ITEM (DictionaryItemID, Code, DictionaryCode, Value, Name, OrderNo, RecordStatus, IsEditable)
SELECT '178060600000015', '已满', 'welfare_post_status', 2, '已满', 2, 1, 1 FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM DICTIONARY_ITEM WHERE DictionaryCode = 'welfare_post_status' AND Code = '已满');

INSERT INTO DICTIONARY_ITEM (DictionaryItemID, Code, DictionaryCode, Value, Name, OrderNo, RecordStatus, IsEditable)
SELECT '178060600000016', '已关闭', 'welfare_post_status', 3, '已关闭', 3, 1, 1 FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM DICTIONARY_ITEM WHERE DictionaryCode = 'welfare_post_status' AND Code = '已关闭');

-- ============================================================
-- 6. 推荐类型 (recommend_type) — 岗位推荐
-- DB存储: '1'=岗位推荐到人, '2'=人推荐到岗位
-- ============================================================
INSERT INTO DICTIONARY (DictionaryCode, Name, OrderNo, RecordStatus, DictType)
SELECT 'recommend_type', '推荐类型', 106, 1, 0 FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM DICTIONARY WHERE DictionaryCode = 'recommend_type');

INSERT INTO DICTIONARY_ITEM (DictionaryItemID, Code, DictionaryCode, Value, Name, OrderNo, RecordStatus, IsEditable)
SELECT '178060600000017', '', 'recommend_type', 1, '岗位推荐到人', 1, 1, 1 FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM DICTIONARY_ITEM WHERE DictionaryCode = 'recommend_type' AND Value = 1);

INSERT INTO DICTIONARY_ITEM (DictionaryItemID, Code, DictionaryCode, Value, Name, OrderNo, RecordStatus, IsEditable)
SELECT '178060600000018', '', 'recommend_type', 2, '人推荐到岗位', 2, 1, 1 FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM DICTIONARY_ITEM WHERE DictionaryCode = 'recommend_type' AND Value = 2);

-- ============================================================
-- 7. 推荐状态 (recommend_status) — 岗位推荐
-- DB存储: '0'=待查看, '1'=已查看, '2'=已接受, '3'=已拒绝
-- ============================================================
INSERT INTO DICTIONARY (DictionaryCode, Name, OrderNo, RecordStatus, DictType)
SELECT 'recommend_status', '推荐状态', 107, 1, 0 FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM DICTIONARY WHERE DictionaryCode = 'recommend_status');

INSERT INTO DICTIONARY_ITEM (DictionaryItemID, Code, DictionaryCode, Value, Name, OrderNo, RecordStatus, IsEditable)
SELECT '178060600000019', '', 'recommend_status', 0, '待查看', 1, 1, 1 FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM DICTIONARY_ITEM WHERE DictionaryCode = 'recommend_status' AND Value = 0);

INSERT INTO DICTIONARY_ITEM (DictionaryItemID, Code, DictionaryCode, Value, Name, OrderNo, RecordStatus, IsEditable)
SELECT '178060600000020', '', 'recommend_status', 1, '已查看', 2, 1, 1 FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM DICTIONARY_ITEM WHERE DictionaryCode = 'recommend_status' AND Value = 1);

INSERT INTO DICTIONARY_ITEM (DictionaryItemID, Code, DictionaryCode, Value, Name, OrderNo, RecordStatus, IsEditable)
SELECT '178060600000021', '', 'recommend_status', 2, '已接受', 3, 1, 1 FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM DICTIONARY_ITEM WHERE DictionaryCode = 'recommend_status' AND Value = 2);

INSERT INTO DICTIONARY_ITEM (DictionaryItemID, Code, DictionaryCode, Value, Name, OrderNo, RecordStatus, IsEditable)
SELECT '178060600000022', '', 'recommend_status', 3, '已拒绝', 4, 1, 1 FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM DICTIONARY_ITEM WHERE DictionaryCode = 'recommend_status' AND Value = 3);

-- ============================================================
-- 8. 见习状态 (internship_status) — 见习人员
-- DB存储文本: '见习中','已期满','已退出'
-- ============================================================
INSERT INTO DICTIONARY (DictionaryCode, Name, OrderNo, RecordStatus, DictType)
SELECT 'internship_status', '见习状态', 108, 1, 0 FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM DICTIONARY WHERE DictionaryCode = 'internship_status');

INSERT INTO DICTIONARY_ITEM (DictionaryItemID, Code, DictionaryCode, Value, Name, OrderNo, RecordStatus, IsEditable)
SELECT '178060600000023', '见习中', 'internship_status', 1, '见习中', 1, 1, 1 FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM DICTIONARY_ITEM WHERE DictionaryCode = 'internship_status' AND Code = '见习中');

INSERT INTO DICTIONARY_ITEM (DictionaryItemID, Code, DictionaryCode, Value, Name, OrderNo, RecordStatus, IsEditable)
SELECT '178060600000024', '已期满', 'internship_status', 2, '已期满', 2, 1, 1 FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM DICTIONARY_ITEM WHERE DictionaryCode = 'internship_status' AND Code = '已期满');

INSERT INTO DICTIONARY_ITEM (DictionaryItemID, Code, DictionaryCode, Value, Name, OrderNo, RecordStatus, IsEditable)
SELECT '178060600000025', '已退出', 'internship_status', 3, '已退出', 3, 1, 1 FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM DICTIONARY_ITEM WHERE DictionaryCode = 'internship_status' AND Code = '已退出');

-- ============================================================
-- 9. 审核状态 (audit_status) — 见习人员
-- DB存储文本: '待审核','已通过','未通过'
-- ============================================================
INSERT INTO DICTIONARY (DictionaryCode, Name, OrderNo, RecordStatus, DictType)
SELECT 'audit_status', '审核状态', 109, 1, 0 FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM DICTIONARY WHERE DictionaryCode = 'audit_status');

INSERT INTO DICTIONARY_ITEM (DictionaryItemID, Code, DictionaryCode, Value, Name, OrderNo, RecordStatus, IsEditable)
SELECT '178060600000026', '待审核', 'audit_status', 1, '待审核', 1, 1, 1 FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM DICTIONARY_ITEM WHERE DictionaryCode = 'audit_status' AND Code = '待审核');

INSERT INTO DICTIONARY_ITEM (DictionaryItemID, Code, DictionaryCode, Value, Name, OrderNo, RecordStatus, IsEditable)
SELECT '178060600000027', '已通过', 'audit_status', 2, '已通过', 2, 1, 1 FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM DICTIONARY_ITEM WHERE DictionaryCode = 'audit_status' AND Code = '已通过');

INSERT INTO DICTIONARY_ITEM (DictionaryItemID, Code, DictionaryCode, Value, Name, OrderNo, RecordStatus, IsEditable)
SELECT '178060600000028', '未通过', 'audit_status', 3, '未通过', 3, 1, 1 FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM DICTIONARY_ITEM WHERE DictionaryCode = 'audit_status' AND Code = '未通过');

-- ============================================================
-- 验证
-- ============================================================
SELECT '字典主表' AS 检查项, DictionaryCode, Name FROM DICTIONARY
WHERE DictionaryCode IN ('publish_status','apply_status','company_nature','welfare_post_type','welfare_post_status','recommend_type','recommend_status','internship_status','audit_status')
ORDER BY DictionaryCode;

SELECT '字典项' AS 检查项, DictionaryCode, Code, Value, Name, OrderNo FROM DICTIONARY_ITEM
WHERE DictionaryCode IN ('publish_status','apply_status','company_nature','welfare_post_type','welfare_post_status','recommend_type','recommend_status','internship_status','audit_status')
ORDER BY DictionaryCode, OrderNo;

-- 注意：Education 和 Gender 字典的 Code 字段保持为空（''）
-- 因为 DB 存储的是数值（'1','2','3'），匹配 DICTIONARY_ITEM.Value(INT)
-- getDictText 通过 String(Value)===String(data) 匹配，无需 Code
-- getDictOptions 返回 value=String(Value)，a-select v-model 数值与 DB 一致

-- ============================================================
-- 10. 身份要求 (identity_requirement) — 见习岗位
-- DB存储文本: '高校毕业生','失业青年','脱贫家庭青年'
-- ============================================================
INSERT INTO DICTIONARY (DictionaryCode, Name, OrderNo, RecordStatus, DictType)
SELECT 'identity_requirement', '身份要求', 110, 1, 0 FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM DICTIONARY WHERE DictionaryCode = 'identity_requirement');

INSERT INTO DICTIONARY_ITEM (DictionaryItemID, Code, DictionaryCode, Value, Name, OrderNo, RecordStatus, IsEditable)
SELECT '178060600000029', '高校毕业生', 'identity_requirement', 1, '高校毕业生', 1, 1, 1 FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM DICTIONARY_ITEM WHERE DictionaryCode = 'identity_requirement' AND Value = 1);

INSERT INTO DICTIONARY_ITEM (DictionaryItemID, Code, DictionaryCode, Value, Name, OrderNo, RecordStatus, IsEditable)
SELECT '178060600000030', '失业青年', 'identity_requirement', 2, '失业青年', 2, 1, 1 FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM DICTIONARY_ITEM WHERE DictionaryCode = 'identity_requirement' AND Value = 2);

INSERT INTO DICTIONARY_ITEM (DictionaryItemID, Code, DictionaryCode, Value, Name, OrderNo, RecordStatus, IsEditable)
SELECT '178060600000031', '脱贫家庭青年', 'identity_requirement', 3, '脱贫家庭青年', 3, 1, 1 FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM DICTIONARY_ITEM WHERE DictionaryCode = 'identity_requirement' AND Value = 3);

-- ============================================================
-- 11. 报名方式 (apply_method) — 见习岗位
-- DB存储文本: '网上报名','现场报名'
-- ============================================================
INSERT INTO DICTIONARY (DictionaryCode, Name, OrderNo, RecordStatus, DictType)
SELECT 'apply_method', '报名方式', 111, 1, 0 FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM DICTIONARY WHERE DictionaryCode = 'apply_method');

INSERT INTO DICTIONARY_ITEM (DictionaryItemID, Code, DictionaryCode, Value, Name, OrderNo, RecordStatus, IsEditable)
SELECT '178060600000032', '网上报名', 'apply_method', 1, '网上报名', 1, 1, 1 FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM DICTIONARY_ITEM WHERE DictionaryCode = 'apply_method' AND Value = 1);

INSERT INTO DICTIONARY_ITEM (DictionaryItemID, Code, DictionaryCode, Value, Name, OrderNo, RecordStatus, IsEditable)
SELECT '178060600000033', '现场报名', 'apply_method', 2, '现场报名', 2, 1, 1 FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM DICTIONARY_ITEM WHERE DictionaryCode = 'apply_method' AND Value = 2);
