sys_menu_business.sql 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. -- ============================================================================
  2. -- sys_menu SQL for 基础信息管理子系统(14张业务表)
  3. -- 包含: 项目/人员/机构/参建单位/分包单位/灌排渠道/行政区划/关联关系
  4. -- PostgreSQL
  5. -- ============================================================================
  6. DO $$
  7. DECLARE
  8. parent_menu_id BIGINT := 0; -- ★ 修改为实际的父级菜单ID(0=根目录)★
  9. -- 一级目录
  10. base_dir_id BIGINT; -- 基础信息
  11. -- 二级目录
  12. proj_dir_id BIGINT; -- 项目管理
  13. pers_dir_id BIGINT; -- 人员管理
  14. org_dir_id BIGINT; -- 机构管理
  15. eng_dir_id BIGINT; -- 工程设施
  16. rel_dir_id BIGINT; -- 关联关系
  17. -- 临时变量
  18. menu_id BIGINT;
  19. max_order INT;
  20. BEGIN
  21. -- ========================================================================
  22. -- 清理(支持重复执行)
  23. -- ========================================================================
  24. DELETE FROM sys_menu WHERE perms LIKE 'business:%';
  25. DELETE FROM sys_menu WHERE path IN ('base-dir','proj-dir','pers-dir','org-dir','eng-dir','rel-dir') AND menu_type = 'M';
  26. PERFORM setval('sys_menu_menu_id_seq', COALESCE((SELECT MAX(menu_id) FROM sys_menu), 0));
  27. SELECT COALESCE(MAX(order_num), 0) INTO max_order FROM sys_menu WHERE parent_id = parent_menu_id;
  28. -- ============================================================================
  29. -- 一、基础信息 一级目录
  30. -- ============================================================================
  31. max_order := max_order + 1;
  32. INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time)
  33. VALUES ('基础信息', 0, 10, 'base-dir', NULL, 1, 0, 'M', '0', '0', '', 'database', 'admin', now())
  34. RETURNING menu_id INTO base_dir_id;
  35. -- ============================================================================
  36. -- 二、项目管理 (projbase)
  37. -- ============================================================================
  38. max_order := max_order + 1;
  39. INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time)
  40. VALUES ('项目管理', base_dir_id, max_order, 'proj-dir', NULL, 1, 0, 'M', '0', '0', '', 'build', 'admin', now());
  41. -- 项目基础信息
  42. INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time)
  43. VALUES ('项目基础信息', base_dir_id, (SELECT order_num FROM sys_menu WHERE menu_name = '项目管理' AND parent_id = base_dir_id), 'projbase', 'system/projbase/index', 1, 0, 'C', '0', '0', 'business:projbase:list', 'list', 'admin', now())
  44. RETURNING menu_id INTO menu_id;
  45. INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time) VALUES ('项目新增', menu_id, 1, '', '', 1, 0, 'F', '0', '0', 'business:projbase:add', '#', 'admin', now());
  46. INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time) VALUES ('项目修改', menu_id, 2, '', '', 1, 0, 'F', '0', '0', 'business:projbase:edit', '#', 'admin', now());
  47. INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time) VALUES ('项目删除', menu_id, 3, '', '', 1, 0, 'F', '0', '0', 'business:projbase:remove', '#', 'admin', now());
  48. -- ============================================================================
  49. -- 三、人员管理 (persbase + persext)
  50. -- ============================================================================
  51. max_order := max_order + 1;
  52. INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time)
  53. VALUES ('人员管理', base_dir_id, max_order, 'pers-dir', NULL, 1, 0, 'M', '0', '0', '', 'peoples', 'admin', now());
  54. -- 人员基础信息
  55. INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time)
  56. VALUES ('人员基础信息', base_dir_id, (SELECT order_num FROM sys_menu WHERE menu_name = '人员管理' AND parent_id = base_dir_id), 'persbase', 'system/persbase/index', 1, 0, 'C', '0', '0', 'business:persbase:list', 'list', 'admin', now())
  57. RETURNING menu_id INTO menu_id;
  58. INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time) VALUES ('人员新增', menu_id, 1, '', '', 1, 0, 'F', '0', '0', 'business:persbase:add', '#', 'admin', now());
  59. INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time) VALUES ('人员修改', menu_id, 2, '', '', 1, 0, 'F', '0', '0', 'business:persbase:edit', '#', 'admin', now());
  60. INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time) VALUES ('人员删除', menu_id, 3, '', '', 1, 0, 'F', '0', '0', 'business:persbase:remove', '#', 'admin', now());
  61. -- 人员扩展信息(监理单位项目组成员)
  62. INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time)
  63. VALUES ('项目组成员', base_dir_id, (SELECT order_num+1 FROM sys_menu WHERE menu_name = '人员基础信息' AND parent_id = base_dir_id), 'persext', 'system/persext/index', 1, 0, 'C', '0', '0', 'business:persext:list', 'team', 'admin', now())
  64. RETURNING menu_id INTO menu_id;
  65. INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time) VALUES ('成员新增', menu_id, 1, '', '', 1, 0, 'F', '0', '0', 'business:persext:add', '#', 'admin', now());
  66. INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time) VALUES ('成员修改', menu_id, 2, '', '', 1, 0, 'F', '0', '0', 'business:persext:edit', '#', 'admin', now());
  67. INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time) VALUES ('成员删除', menu_id, 3, '', '', 1, 0, 'F', '0', '0', 'business:persext:remove', '#', 'admin', now());
  68. -- ============================================================================
  69. -- 四、机构管理 (orgext + orguwatbase + orguwatext + orgwsub)
  70. -- ============================================================================
  71. max_order := max_order + 1;
  72. INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time)
  73. VALUES ('机构管理', base_dir_id, max_order, 'org-dir', NULL, 1, 0, 'M', '0', '0', '', 'tree-table', 'admin', now());
  74. -- 水利机构扩展信息
  75. INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time)
  76. VALUES ('水利机构扩展', base_dir_id, (SELECT order_num FROM sys_menu WHERE menu_name = '机构管理' AND parent_id = base_dir_id), 'orgext', 'system/orgext/index', 1, 0, 'C', '0', '0', 'business:orgext:list', 'guide', 'admin', now())
  77. RETURNING menu_id INTO menu_id;
  78. INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time) VALUES ('机构新增', menu_id, 1, '', '', 1, 0, 'F', '0', '0', 'business:orgext:add', '#', 'admin', now());
  79. INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time) VALUES ('机构修改', menu_id, 2, '', '', 1, 0, 'F', '0', '0', 'business:orgext:edit', '#', 'admin', now());
  80. INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time) VALUES ('机构删除', menu_id, 3, '', '', 1, 0, 'F', '0', '0', 'business:orgext:remove', '#', 'admin', now());
  81. -- 参建单位信息
  82. INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time)
  83. VALUES ('参建单位信息', base_dir_id, (SELECT order_num+1 FROM sys_menu WHERE menu_name = '水利机构扩展' AND parent_id = base_dir_id), 'orguwatbase', 'system/orguwatbase/index', 1, 0, 'C', '0', '0', 'business:orguwatbase:list', 'company', 'admin', now())
  84. RETURNING menu_id INTO menu_id;
  85. INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time) VALUES ('单位新增', menu_id, 1, '', '', 1, 0, 'F', '0', '0', 'business:orguwatbase:add', '#', 'admin', now());
  86. INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time) VALUES ('单位修改', menu_id, 2, '', '', 1, 0, 'F', '0', '0', 'business:orguwatbase:edit', '#', 'admin', now());
  87. INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time) VALUES ('单位删除', menu_id, 3, '', '', 1, 0, 'F', '0', '0', 'business:orguwatbase:remove', '#', 'admin', now());
  88. -- 参建单位扩展信息
  89. INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time)
  90. VALUES ('参建单位扩展', base_dir_id, (SELECT order_num+1 FROM sys_menu WHERE menu_name = '参建单位信息' AND parent_id = base_dir_id), 'orguwatext', 'system/orguwatext/index', 1, 0, 'C', '0', '0', 'business:orguwatext:list', 'nested', 'admin', now())
  91. RETURNING menu_id INTO menu_id;
  92. INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time) VALUES ('扩展新增', menu_id, 1, '', '', 1, 0, 'F', '0', '0', 'business:orguwatext:add', '#', 'admin', now());
  93. INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time) VALUES ('扩展修改', menu_id, 2, '', '', 1, 0, 'F', '0', '0', 'business:orguwatext:edit', '#', 'admin', now());
  94. INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time) VALUES ('扩展删除', menu_id, 3, '', '', 1, 0, 'F', '0', '0', 'business:orguwatext:remove', '#', 'admin', now());
  95. -- 分包单位信息
  96. INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time)
  97. VALUES ('分包单位信息', base_dir_id, (SELECT order_num+1 FROM sys_menu WHERE menu_name = '参建单位扩展' AND parent_id = base_dir_id), 'orgwsub', 'system/orgwsub/index', 1, 0, 'C', '0', '0', 'business:orgwsub:list', 'international', 'admin', now())
  98. RETURNING menu_id INTO menu_id;
  99. INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time) VALUES ('分包新增', menu_id, 1, '', '', 1, 0, 'F', '0', '0', 'business:orgwsub:add', '#', 'admin', now());
  100. INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time) VALUES ('分包修改', menu_id, 2, '', '', 1, 0, 'F', '0', '0', 'business:orgwsub:edit', '#', 'admin', now());
  101. INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time) VALUES ('分包删除', menu_id, 3, '', '', 1, 0, 'F', '0', '0', 'business:orgwsub:remove', '#', 'admin', now());
  102. -- ============================================================================
  103. -- 五、工程设施 (irrchan + adbase)
  104. -- ============================================================================
  105. max_order := max_order + 1;
  106. INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time)
  107. VALUES ('工程设施', base_dir_id, max_order, 'eng-dir', NULL, 1, 0, 'M', '0', '0', '', 'color', 'admin', now());
  108. -- 灌排渠道信息
  109. INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time)
  110. VALUES ('灌排渠道信息', base_dir_id, (SELECT order_num FROM sys_menu WHERE menu_name = '工程设施' AND parent_id = base_dir_id), 'irrchan', 'system/irrchan/index', 1, 0, 'C', '0', '0', 'business:irrchan:list', 'route', 'admin', now())
  111. RETURNING menu_id INTO menu_id;
  112. INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time) VALUES ('渠道新增', menu_id, 1, '', '', 1, 0, 'F', '0', '0', 'business:irrchan:add', '#', 'admin', now());
  113. INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time) VALUES ('渠道修改', menu_id, 2, '', '', 1, 0, 'F', '0', '0', 'business:irrchan:edit', '#', 'admin', now());
  114. INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time) VALUES ('渠道删除', menu_id, 3, '', '', 1, 0, 'F', '0', '0', 'business:irrchan:remove', '#', 'admin', now());
  115. -- 行政区划信息
  116. INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time)
  117. VALUES ('行政区划信息', base_dir_id, (SELECT order_num+1 FROM sys_menu WHERE menu_name = '灌排渠道信息' AND parent_id = base_dir_id), 'adbase', 'system/adbase/index', 1, 0, 'C', '0', '0', 'business:adbase:list', 'map', 'admin', now())
  118. RETURNING menu_id INTO menu_id;
  119. INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time) VALUES ('区划新增', menu_id, 1, '', '', 1, 0, 'F', '0', '0', 'business:adbase:add', '#', 'admin', now());
  120. INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time) VALUES ('区划修改', menu_id, 2, '', '', 1, 0, 'F', '0', '0', 'business:adbase:edit', '#', 'admin', now());
  121. INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time) VALUES ('区划删除', menu_id, 3, '', '', 1, 0, 'F', '0', '0', 'business:adbase:remove', '#', 'admin', now());
  122. -- ============================================================================
  123. -- 六、关联关系 (5张关系表)
  124. -- ============================================================================
  125. max_order := max_order + 1;
  126. INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time)
  127. VALUES ('关联关系', base_dir_id, max_order, 'rel-dir', NULL, 1, 0, 'M', '0', '0', '', 'link', 'admin', now());
  128. -- 工程与水利机构关系
  129. INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time)
  130. VALUES ('工程-水利机构', base_dir_id, (SELECT order_num FROM sys_menu WHERE menu_name = '关联关系' AND parent_id = base_dir_id), 'relengorg', 'system/relengorg/index', 1, 0, 'C', '0', '0', 'business:relengorg:list', 'connection', 'admin', now())
  131. RETURNING menu_id INTO menu_id;
  132. INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time) VALUES ('关联新增', menu_id, 1, '', '', 1, 0, 'F', '0', '0', 'business:relengorg:add', '#', 'admin', now());
  133. INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time) VALUES ('关联修改', menu_id, 2, '', '', 1, 0, 'F', '0', '0', 'business:relengorg:edit', '#', 'admin', now());
  134. INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time) VALUES ('关联删除', menu_id, 3, '', '', 1, 0, 'F', '0', '0', 'business:relengorg:remove', '#', 'admin', now());
  135. -- 工程与非水利机构关系
  136. INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time)
  137. VALUES ('工程-参建单位', base_dir_id, (SELECT order_num+1 FROM sys_menu WHERE menu_name = '工程-水利机构' AND parent_id = base_dir_id), 'relengorguwat', 'system/relengorguwat/index', 1, 0, 'C', '0', '0', 'business:relengorguwat:list', 'connection', 'admin', now())
  138. RETURNING menu_id INTO menu_id;
  139. INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time) VALUES ('关联新增', menu_id, 1, '', '', 1, 0, 'F', '0', '0', 'business:relengorguwat:add', '#', 'admin', now());
  140. INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time) VALUES ('关联修改', menu_id, 2, '', '', 1, 0, 'F', '0', '0', 'business:relengorguwat:edit', '#', 'admin', now());
  141. INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time) VALUES ('关联删除', menu_id, 3, '', '', 1, 0, 'F', '0', '0', 'business:relengorguwat:remove', '#', 'admin', now());
  142. -- 项目与机构关系
  143. INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time)
  144. VALUES ('项目-机构关系', base_dir_id, (SELECT order_num+1 FROM sys_menu WHERE menu_name = '工程-参建单位' AND parent_id = base_dir_id), 'relprojorg', 'system/relprojorg/index', 1, 0, 'C', '0', '0', 'business:relprojorg:list', 'connection', 'admin', now())
  145. RETURNING menu_id INTO menu_id;
  146. INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time) VALUES ('关联新增', menu_id, 1, '', '', 1, 0, 'F', '0', '0', 'business:relprojorg:add', '#', 'admin', now());
  147. INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time) VALUES ('关联修改', menu_id, 2, '', '', 1, 0, 'F', '0', '0', 'business:relprojorg:edit', '#', 'admin', now());
  148. INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time) VALUES ('关联删除', menu_id, 3, '', '', 1, 0, 'F', '0', '0', 'business:relprojorg:remove', '#', 'admin', now());
  149. -- 标段与非水利机构关系
  150. INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time)
  151. VALUES ('标段-参建单位', base_dir_id, (SELECT order_num+1 FROM sys_menu WHERE menu_name = '项目-机构关系' AND parent_id = base_dir_id), 'reltendorg', 'system/reltendorg/index', 1, 0, 'C', '0', '0', 'business:reltendorg:list', 'connection', 'admin', now())
  152. RETURNING menu_id INTO menu_id;
  153. INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time) VALUES ('关联新增', menu_id, 1, '', '', 1, 0, 'F', '0', '0', 'business:reltendorg:add', '#', 'admin', now());
  154. INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time) VALUES ('关联修改', menu_id, 2, '', '', 1, 0, 'F', '0', '0', 'business:reltendorg:edit', '#', 'admin', now());
  155. INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time) VALUES ('关联删除', menu_id, 3, '', '', 1, 0, 'F', '0', '0', 'business:reltendorg:remove', '#', 'admin', now());
  156. -- 用户与标段关系
  157. INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time)
  158. VALUES ('用户-标段关系', base_dir_id, (SELECT order_num+1 FROM sys_menu WHERE menu_name = '标段-参建单位' AND parent_id = base_dir_id), 'relusertend', 'system/relusertend/index', 1, 0, 'C', '0', '0', 'business:relusertend:list', 'connection', 'admin', now())
  159. RETURNING menu_id INTO menu_id;
  160. INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time) VALUES ('关联新增', menu_id, 1, '', '', 1, 0, 'F', '0', '0', 'business:relusertend:add', '#', 'admin', now());
  161. INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time) VALUES ('关联修改', menu_id, 2, '', '', 1, 0, 'F', '0', '0', 'business:relusertend:edit', '#', 'admin', now());
  162. INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time) VALUES ('关联删除', menu_id, 3, '', '', 1, 0, 'F', '0', '0', 'business:relusertend:remove', '#', 'admin', now());
  163. -- ========================================================================
  164. -- 完成
  165. -- ========================================================================
  166. RAISE NOTICE '========================================';
  167. RAISE NOTICE '基础信息管理子系统菜单 SQL 执行完成!';
  168. RAISE NOTICE 'parent_menu_id = %', parent_menu_id;
  169. RAISE NOTICE '共插入 14 个菜单项 + 42 个按钮权限';
  170. RAISE NOTICE '========================================';
  171. END $$;