risk_personnel_dict.sql 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. -- ============================================================
  2. -- 人员管理相关字典(前端用 getDicts() 加载,但数据库没有)
  3. -- 1. person_type 人员类型
  4. -- 2. certificate_type 证书类型
  5. -- 3. insurance_status 保险状态
  6. -- ============================================================
  7. USE risk_control_platform;
  8. -- ===== 1. 人员类型 =====
  9. INSERT IGNORE INTO sys_dict_type (dict_name, dict_type, remark, create_by, create_time, update_by, update_time)
  10. VALUES ('人员类型', 'person_type', '人员信息-人员类型', 1, NOW(), 1, NOW());
  11. INSERT IGNORE INTO sys_dict_data (dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, remark, create_by, create_time, update_by, update_time) VALUES
  12. (1, '员工', '员工', 'person_type', '', 'primary', 'N', '', 1, NOW(), 1, NOW()),
  13. (2, '管理人员', '管理人员', 'person_type', '', 'success', 'N', '', 1, NOW(), 1, NOW()),
  14. (3, '临时工', '临时工', 'person_type', '', 'info', 'N', '', 1, NOW(), 1, NOW()),
  15. (4, '实习生', '实习生', 'person_type', '', 'warning', 'N', '', 1, NOW(), 1, NOW()),
  16. (5, '外包人员', '外包人员', 'person_type', '', 'danger', 'N', '', 1, NOW(), 1, NOW());
  17. -- ===== 2. 证书类型 =====
  18. INSERT IGNORE INTO sys_dict_type (dict_name, dict_type, remark, create_by, create_time, update_by, update_time)
  19. VALUES ('证书类型', 'certificate_type', '人员证书-证书类型', 1, NOW(), 1, NOW());
  20. INSERT IGNORE INTO sys_dict_data (dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, remark, create_by, create_time, update_by, update_time) VALUES
  21. (1, '操作证', '操作证', 'certificate_type', '', 'primary', 'N', '', 1, NOW(), 1, NOW()),
  22. (2, '健康证', '健康证', 'certificate_type', '', 'success', 'N', '', 1, NOW(), 1, NOW()),
  23. (3, '职业资格证', '职业资格证', 'certificate_type', '', 'warning', 'N', '', 1, NOW(), 1, NOW()),
  24. (4, '特种作业证', '特种作业证', 'certificate_type', '', 'danger', 'N', '', 1, NOW(), 1, NOW()),
  25. (5, '其他', '其他', 'certificate_type', '', 'info', 'N', '', 1, NOW(), 1, NOW());
  26. -- ===== 3. 保险状态 =====
  27. INSERT IGNORE INTO sys_dict_type (dict_name, dict_type, remark, create_by, create_time, update_by, update_time)
  28. VALUES ('保险状态', 'insurance_status', '人员信息-保险状态', 1, NOW(), 1, NOW());
  29. INSERT IGNORE INTO sys_dict_data (dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, remark, create_by, create_time, update_by, update_time) VALUES
  30. (1, '未投保', '未投保', 'insurance_status', '', 'danger', 'Y', '默认', 1, NOW(), 1, NOW()),
  31. (2, '已投保', '已投保', 'insurance_status', '', 'success', 'N', '', 1, NOW(), 1, NOW()),
  32. (3, '已过期', '已过期', 'insurance_status', '', 'warning', 'N', '', 1, NOW(), 1, NOW());
  33. -- 验证
  34. SELECT '--- 字典统计 ---' AS info;
  35. SELECT dict_type, COUNT(*) cnt FROM sys_dict_data
  36. WHERE dict_type IN ('person_type', 'certificate_type', 'insurance_status')
  37. GROUP BY dict_type;