cmvr-wms/sql/projectdev/018_web_business_navigation.sql

35 lines
5.3 KiB
MySQL
Raw Permalink Normal View History

-- target-database: cmvr-project-dev
-- Business navigation only: keep existing records, button permissions and system administration menus.
UPDATE sys_menu SET menu_name='项目管理',order_num=0 WHERE menu_id=2100 AND path='project';
UPDATE sys_menu SET menu_name='项目列表' WHERE menu_id=2101 AND component='project/info/index';
UPDATE sys_menu SET menu_name='采购明细',order_num=1 WHERE menu_id=2035 AND component='warehouse/purchase/index';
UPDATE sys_menu SET menu_name='库存管理',order_num=2 WHERE menu_id=2000 AND path='warehouse';
UPDATE sys_menu SET menu_name='入库记录',order_num=2 WHERE component='warehouse/inRecord/index';
UPDATE sys_menu SET menu_name='库存查询与操作',order_num=3 WHERE component='warehouse/stock/index';
UPDATE sys_menu SET menu_name='领用与退回记录',order_num=5 WHERE component='warehouse/outRecord/index';
UPDATE sys_menu SET menu_name='库存盘点',order_num=6 WHERE component='warehouse/stockCheck/index';
UPDATE sys_menu SET menu_name='生产管理',order_num=3 WHERE perms='production:entry';
UPDATE sys_menu SET menu_name='生产任务',order_num=1 WHERE component='production/tasks/index';
INSERT INTO sys_menu(menu_name,parent_id,order_num,path,menu_type,visible,status,perms,icon,create_by,create_time)
SELECT '基础资料',0,4,'businessBasics','M','0','0','','documentation','projectdev-migration',CURRENT_TIMESTAMP WHERE NOT EXISTS(SELECT 1 FROM sys_menu WHERE path='businessBasics' AND parent_id=0);
UPDATE sys_menu child JOIN sys_menu parent ON parent.path='businessBasics' AND parent.parent_id=0 SET child.parent_id=parent.menu_id,child.menu_name='物品档案',child.order_num=1 WHERE child.component='warehouse/product/index';
UPDATE sys_menu child JOIN sys_menu parent ON parent.path='businessBasics' AND parent.parent_id=0 SET child.parent_id=parent.menu_id,child.order_num=2 WHERE child.component='production/product/index';
UPDATE sys_menu child JOIN sys_menu parent ON parent.path='businessBasics' AND parent.parent_id=0 SET child.parent_id=parent.menu_id,child.path='products' WHERE child.component='production/product/index';
UPDATE sys_menu child JOIN sys_menu parent ON parent.path='businessBasics' AND parent.parent_id=0 SET child.parent_id=parent.menu_id,child.order_num=3 WHERE child.component='production/bom/index';
UPDATE sys_menu child JOIN sys_menu parent ON parent.path='businessBasics' AND parent.parent_id=0 SET child.parent_id=parent.menu_id,child.order_num=5 WHERE child.component='warehouse/area/index';
INSERT INTO sys_menu(menu_name,parent_id,order_num,path,component,menu_type,visible,status,perms,icon,create_by,create_time)
SELECT '供应商档案',m.menu_id,4,'suppliers','warehouse/suppliers/index','C','0','0','warehouse:purchase:list','peoples','projectdev-migration',CURRENT_TIMESTAMP FROM sys_menu m WHERE m.path='businessBasics' AND m.parent_id=0 AND NOT EXISTS(SELECT 1 FROM sys_menu WHERE component='warehouse/suppliers/index');
INSERT INTO sys_menu(menu_name,parent_id,order_num,path,component,menu_type,visible,status,perms,icon,create_by,create_time)
SELECT '待入库',2000,1,'pending','warehouse/pending/index','C','0','0','warehouse:in:list','download','projectdev-migration',CURRENT_TIMESTAMP WHERE NOT EXISTS(SELECT 1 FROM sys_menu WHERE component='warehouse/pending/index');
INSERT INTO sys_menu(menu_name,parent_id,order_num,path,component,menu_type,visible,status,perms,icon,create_by,create_time)
SELECT '借用与归还',2000,4,'loans','warehouse/loans/index','C','0','0','project:project:list','exchange','projectdev-migration',CURRENT_TIMESTAMP WHERE NOT EXISTS(SELECT 1 FROM sys_menu WHERE component='warehouse/loans/index');
INSERT INTO sys_menu(menu_name,parent_id,order_num,path,component,menu_type,visible,status,perms,icon,create_by,create_time)
SELECT '报废与交付',m.menu_id,2,'operations','production/operations/index','C','0','0','project:project:list','list','projectdev-migration',CURRENT_TIMESTAMP FROM sys_menu m WHERE m.perms='production:entry' AND NOT EXISTS(SELECT 1 FROM sys_menu WHERE component='production/operations/index');
INSERT INTO sys_menu(menu_name,parent_id,order_num,path,component,menu_type,visible,status,perms,icon,create_by,create_time)
SELECT '产品材料成本',0,5,'materialCost','production/cost/index','C','0','0','project:project:list','money','projectdev-migration',CURRENT_TIMESTAMP WHERE NOT EXISTS(SELECT 1 FROM sys_menu WHERE component='production/cost/index');
INSERT INTO sys_role_menu(role_id,menu_id)
SELECT DISTINCT assigned.role_id,added.menu_id FROM sys_role_menu assigned JOIN sys_menu original ON original.menu_id=assigned.menu_id JOIN sys_menu added ON added.perms=original.perms
WHERE added.component IN('warehouse/suppliers/index','warehouse/pending/index','warehouse/loans/index','production/operations/index','production/cost/index') AND NOT EXISTS(SELECT 1 FROM sys_role_menu existing WHERE existing.role_id=assigned.role_id AND existing.menu_id=added.menu_id);
INSERT INTO sys_role_menu(role_id,menu_id)
SELECT DISTINCT assigned.role_id,parent.menu_id FROM sys_role_menu assigned JOIN sys_menu child ON child.menu_id=assigned.menu_id JOIN sys_menu parent ON parent.menu_id=child.parent_id WHERE parent.path IN('businessBasics','warehouse','production') AND parent.parent_id=0 AND NOT EXISTS(SELECT 1 FROM sys_role_menu existing WHERE existing.role_id=assigned.role_id AND existing.menu_id=parent.menu_id);