bpm_minimal_menu_dict.sql 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. -- 最小工作流(方案3): 菜单 + 字典 初始化脚本
  2. -- 适用: MySQL
  3. -- 说明:
  4. -- 1) 本脚本会新增一个一级菜单【流程管理】及其子菜单(流程定义/我的待办/我的已办/流程发起)
  5. -- 2) 本脚本会补充字典【流程状态 bpm_status】(如已存在同 code 的字典请按需手动去重)
  6. -- 3) 由于 sys_permission 主键为 id,本脚本使用“按 url/perms/name 清理后插入”的方式尽量保证可重复执行
  7. START TRANSACTION;
  8. -- =========================
  9. -- 1. 字典:流程状态 bpm_status
  10. -- =========================
  11. -- 注意:如果你的库中已存在 code=bpm_status 的字典,这里会先删除再插入(避免重复)。如你不希望删除,可改成只 insert。
  12. DELETE FROM sys_dict_item WHERE dict_id IN (SELECT id FROM sys_dict WHERE dict_code='bpm_status');
  13. DELETE FROM sys_dict WHERE dict_code='bpm_status';
  14. INSERT INTO sys_dict (id, dict_name, dict_code, description, del_flag, create_by, create_time, update_by, update_time, type)
  15. VALUES ('BPM_DICT_STATUS_0001', '流程状态', 'bpm_status', '流程状态', 0, 'admin', NOW(), NULL, NULL, 0);
  16. INSERT INTO sys_dict_item (id, dict_id, item_text, item_value, description, sort_order, status, create_by, create_time, update_by, update_time)
  17. VALUES
  18. ('BPM_DICT_STATUS_ITEM_1', 'BPM_DICT_STATUS_0001', '草稿', 'draft', NULL, 1, 1, 'admin', NOW(), NULL, NULL),
  19. ('BPM_DICT_STATUS_ITEM_2', 'BPM_DICT_STATUS_0001', '审批中', 'running', NULL, 2, 1, 'admin', NOW(), NULL, NULL),
  20. ('BPM_DICT_STATUS_ITEM_3', 'BPM_DICT_STATUS_0001', '已通过', 'passed', NULL, 3, 1, 'admin', NOW(), NULL, NULL),
  21. ('BPM_DICT_STATUS_ITEM_4', 'BPM_DICT_STATUS_0001', '已驳回', 'rejected', NULL, 4, 1, 'admin', NOW(), NULL, NULL),
  22. ('BPM_DICT_STATUS_ITEM_5', 'BPM_DICT_STATUS_0001', '已撤回', 'revoked', NULL, 5, 1, 'admin', NOW(), NULL, NULL);
  23. -- =========================
  24. -- 2. 菜单:流程管理(一级菜单)
  25. -- =========================
  26. -- 清理:按 url/component/perms/name 清理可能存在的旧记录(避免重复)
  27. DELETE FROM sys_permission WHERE url IN ('/bpm', '/bpm/process-definition', '/bpm/process/design', '/bpm/task/todo', '/bpm/task/done', '/bpm/process/start');
  28. DELETE FROM sys_permission WHERE component IN (
  29. 'layouts/RouteView',
  30. 'modules/bpm/process/ProcessDefinitionList',
  31. 'modules/bpm/process/ProcessDesigner',
  32. 'modules/bpm/task/MyTaskList',
  33. 'modules/bpm/task/MyDoneList',
  34. 'modules/bpm/process/StartProcess'
  35. ) AND name IN ('流程管理','流程定义','流程设计','我的待办','我的已办','流程发起');
  36. -- 一级菜单
  37. INSERT INTO sys_permission (
  38. id, parent_id, name, url, component, component_name, redirect,
  39. menu_type, perms, perms_type, sort_no, always_show, icon,
  40. is_route, is_leaf, keep_alive, hidden, hide_tab, description,
  41. create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external
  42. ) VALUES (
  43. 'BPM_MENU_ROOT_0001', '', '流程管理', '/bpm', 'layouts/RouteView', NULL, NULL,
  44. 0, NULL, '1', 50.00, 0, 'profile',
  45. 1, 0, 0, 0, 0, '最小工作流菜单(方案3)',
  46. 'admin', NOW(), NULL, NULL, 0, 0, '1', 0
  47. );
  48. -- 子菜单:流程定义
  49. INSERT INTO sys_permission (
  50. id, parent_id, name, url, component, component_name, redirect,
  51. menu_type, perms, perms_type, sort_no, always_show, icon,
  52. is_route, is_leaf, keep_alive, hidden, hide_tab, description,
  53. create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external
  54. ) VALUES (
  55. 'BPM_MENU_PROC_DEF_0001', 'BPM_MENU_ROOT_0001', '流程定义', '/bpm/process-definition', 'modules/bpm/process/ProcessDefinitionList', NULL, NULL,
  56. 1, NULL, '1', 1.00, 0, 'deployment-unit',
  57. 1, 1, 0, 0, 0, NULL,
  58. 'admin', NOW(), NULL, NULL, 0, 0, '1', 0
  59. );
  60. -- 子菜单:流程设计(画布设计器)
  61. INSERT INTO sys_permission (
  62. id, parent_id, name, url, component, component_name, redirect,
  63. menu_type, perms, perms_type, sort_no, always_show, icon,
  64. is_route, is_leaf, keep_alive, hidden, hide_tab, description,
  65. create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external
  66. ) VALUES (
  67. 'BPM_MENU_DESIGN_0001', 'BPM_MENU_ROOT_0001', '流程设计', '/bpm/process/design', 'modules/bpm/process/ProcessDesigner', NULL, NULL,
  68. 1, NULL, '1', 1.50, 0, 'edit',
  69. 1, 1, 0, 0, 0, '可视化流程设计器',
  70. 'admin', NOW(), NULL, NULL, 0, 0, '1', 0
  71. );
  72. -- 子菜单:我的待办
  73. INSERT INTO sys_permission (
  74. id, parent_id, name, url, component, component_name, redirect,
  75. menu_type, perms, perms_type, sort_no, always_show, icon,
  76. is_route, is_leaf, keep_alive, hidden, hide_tab, description,
  77. create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external
  78. ) VALUES (
  79. 'BPM_MENU_TASK_TODO_0001', 'BPM_MENU_ROOT_0001', '我的待办', '/bpm/task/todo', 'modules/bpm/task/MyTaskList', NULL, NULL,
  80. 1, NULL, '1', 2.00, 0, 'clock-circle',
  81. 1, 1, 0, 0, 0, NULL,
  82. 'admin', NOW(), NULL, NULL, 0, 0, '1', 0
  83. );
  84. -- 子菜单:我的已办
  85. INSERT INTO sys_permission (
  86. id, parent_id, name, url, component, component_name, redirect,
  87. menu_type, perms, perms_type, sort_no, always_show, icon,
  88. is_route, is_leaf, keep_alive, hidden, hide_tab, description,
  89. create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external
  90. ) VALUES (
  91. 'BPM_MENU_TASK_DONE_0001', 'BPM_MENU_ROOT_0001', '我的已办', '/bpm/task/done', 'modules/bpm/task/MyDoneList', NULL, NULL,
  92. 1, NULL, '1', 3.00, 0, 'check-square',
  93. 1, 1, 0, 0, 0, NULL,
  94. 'admin', NOW(), NULL, NULL, 0, 0, '1', 0
  95. );
  96. -- 子菜单:流程发起
  97. INSERT INTO sys_permission (
  98. id, parent_id, name, url, component, component_name, redirect,
  99. menu_type, perms, perms_type, sort_no, always_show, icon,
  100. is_route, is_leaf, keep_alive, hidden, hide_tab, description,
  101. create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external
  102. ) VALUES (
  103. 'BPM_MENU_START_0001', 'BPM_MENU_ROOT_0001', '流程发起', '/bpm/process/start', 'modules/bpm/process/StartProcess', NULL, NULL,
  104. 1, NULL, '1', 4.00, 0, 'play-circle',
  105. 1, 1, 0, 0, 0, NULL,
  106. 'admin', NOW(), NULL, NULL, 0, 0, '1', 0
  107. );
  108. COMMIT;