mysql获取上一行数据插入的id,作为变量给后面的值使用
-- 菜单 SQL
insert into sys_menu (menu_name, parent_id, order_num, url,menu_type, visible, perms, icon, create_by, create_time, update_by, update_time, remark)
values('客户', '3', '1', '/system/customer', 'C', '0', 'system:customer:view', '#', 'admin', '2018-03-01', 'ry', '2018-03-01', '客户菜单');
-- 按钮父菜单ID
SELECT @parentId := LAST_INSERT_ID();
或者用set @parentid=@@IDENTITY ;
-- 按钮 SQL
insert into sys_menu (menu_name, parent_id, order_num, url,menu_type, visible, perms, icon, create_by, create_time, update_by, update_time, remark)
values('客户查询', @parentId, '1', '#', 'F', '0', 'system:customer:list', '#', 'admin', '2018-03-01', 'ry', '2018-03-01', '');
--end--