-- 新增业务用户
delete from sys_work_user where id = 1;
insert into sys_work_user(id, account, password, create_time, update_time)
values(1, 'xyadmin', 'e10adc3949ba59abbe56e057f20f883e', now(), now());

-- 新增管理系统
delete from sys_system where id = 1;
insert into sys_system(id, code, name, create_time, update_time, create_user, update_user)
values(1, 'xy_system', '兴元管理系统', now(), now(), 1, 1);

-- 新增角色
delete from sys_role where id = 1;
insert into sys_role(id, sys_id, code, name, description, create_time, update_time)
values(1, 1, 'xy_admin', '超级管理员', '超级管理员', now(), now());

-- 新增业务用户角色关联
delete from sys_user_role where id = 1;
insert into sys_user_role(id, work_user_id, role_id, sys_id)
values(1, 1, 1, 1);

-- 新增菜单
delete from sys_menu where id in(10000, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 100, 300, 101);

insert into sys_menu(id, pater_id, sys_id, code, name, type, interface_uri, web_json, create_time, update_time)
values(10000, null, 1, 'operationMaintenance', '平台运维', 1, null, null, now(), now());

insert into sys_menu(id, pater_id, sys_id, code, name, type, interface_uri, web_json, create_time, update_time)
values(1, 10000, 1, 'authorize', '权限管理', 1, null, null, now(), now());

insert into sys_menu(id, pater_id, sys_id, code, name, type, interface_uri, web_json, create_time, update_time)
values(2, 1, 1, 'menu', '菜单管理', 1, null, null, now(), now());
insert into sys_menu(id, pater_id, sys_id, code, name, type, interface_uri, web_json, create_time, update_time)
values(3, 2, 1, 'menu_data', '菜单列表', 2, '/sys-menu/menu,/authorize/sys-menu/menu,/dev-authorize/sys-menu/menu', null, now(), now());
insert into sys_menu(id, pater_id, sys_id, code, name, type, interface_uri, web_json, create_time, update_time)
values(4, 3, 1, 'menu_add', '添加菜单', 3, '/sys-menu/save,/authorize/sys-menu/save,/dev-authorize/sys-menu/save', null, now(), now());
insert into sys_menu(id, pater_id, sys_id, code, name, type, interface_uri, web_json, create_time, update_time)
values(5, 3, 1, 'menu_del', '删除菜单', 3, '/sys-menu/del,/authorize/sys-menu/del,/dev-authorize/sys-menu/del', null, now(), now());
insert into sys_menu(id, pater_id, sys_id, code, name, type, interface_uri, web_json, create_time, update_time)
values(6, 3, 1, 'menu_edit', '编辑菜单', 3, '/sys-menu/update,/authorize/sys-menu/update,/dev-authorize/sys-menu/update', null, now(), now());
insert into sys_menu(id, pater_id, sys_id, code, name, type, interface_uri, web_json, create_time, update_time)
values(100, 3, 1, 'menu_work', '用户菜单树', 3, '/sys-menu/workMenu,/authorize/sys-menu/workMenu,/dev-authorize/sys-menu/workMenu', null, now(), now());
insert into sys_menu(id, pater_id, sys_id, code, name, type, interface_uri, web_json, create_time, update_time)
values(101, 3, 1, 'menu_work_list', '用户菜单集合', 3, '/sys-menu/workMenuList,/authorize/sys-menu/workMenuList,/dev-authorize/sys-menu/workMenuList', null, now(), now());

insert into sys_menu(id, pater_id, sys_id, code, name, type, interface_uri, web_json, create_time, update_time)
values(7, 1, 1, 'role', '角色管理', 1, null, null, now(), now());
insert into sys_menu(id, pater_id, sys_id, code, name, type, interface_uri, web_json, create_time, update_time)
values(8, 7, 1, 'role_data', '角色列表', 2, '/sysRole/page,/authorize/sysRole/page,/dev-authorize/sysRole/page', null, now(), now());
insert into sys_menu(id, pater_id, sys_id, code, name, type, interface_uri, web_json, create_time, update_time)
values(9, 8, 1, 'role_add', '添加角色', 3, '/sysRole/saveOrUpdate,/authorize/sysRole/saveOrUpdate,/dev-authorize/sysRole/saveOrUpdate', null, now(), now());
insert into sys_menu(id, pater_id, sys_id, code, name, type, interface_uri, web_json, create_time, update_time)
values(10, 8, 1, 'role_add', '删除角色', 3, '/sysRole/batchDelete,/authorize/sysRole/batchDelete,/dev-authorize/sysRole/batchDelete', null, now(), now());
insert into sys_menu(id, pater_id, sys_id, code, name, type, interface_uri, web_json, create_time, update_time)
values(11, 8, 1, 'role_menu', '分配菜单', 3, '/sysRole/saveRoleMenus,/authorize/sysRole/saveRoleMenus,/dev-authorize/sysRole/saveRoleMenus', null, now(), now());
insert into sys_menu(id, pater_id, sys_id, code, name, type, interface_uri, web_json, create_time, update_time)
values(12, 8, 1, 'role_edit', '编辑角色', 3, '/sysRole/saveOrUpdate,/authorize/sysRole/saveOrUpdate,/dev-authorize/sysRole/saveOrUpdate', null, now(), now());

insert into sys_menu(id, pater_id, sys_id, code, name, type, interface_uri, web_json, create_time, update_time)
values(13, 1, 1, 'system', '系统管理', 1, null, null, now(), now());
insert into sys_menu(id, pater_id, sys_id, code, name, type, interface_uri, web_json, create_time, update_time)
values(14, 13, 1, 'system_data', '系统列表', 2, '/sys-system/page,/authorize/sys-system/page,/dev-authorize/sys-system/page', null, now(), now());
insert into sys_menu(id, pater_id, sys_id, code, name, type, interface_uri, web_json, create_time, update_time)
values(15, 14, 1, 'system_add', '添加系统', 2, '/sys-system/save,/authorize/sys-system/save,/dev-authorize/sys-system/save', null, now(), now());
insert into sys_menu(id, pater_id, sys_id, code, name, type, interface_uri, web_json, create_time, update_time)
values(16, 14, 1, 'system_del', '删除系统', 2, '/sys-system/del,/authorize/sys-system/del,/dev-authorize/sys-system/del', null, now(), now());
insert into sys_menu(id, pater_id, sys_id, code, name, type, interface_uri, web_json, create_time, update_time)
values(17, 14, 1, 'system_edit', '编辑系统', 2, '/sys-system/update,/authorize/sys-system/update,/dev-authorize/sys-system/update', null, now(), now());
insert into sys_menu(id, pater_id, sys_id, code, name, type, interface_uri, web_json, create_time, update_time)
values(300, 14, 1, 'system_list', '登录人所属系统列表', 2, '/sys-system/list,/authorize/sys-system/list,/dev-authorize/sys-system/list', null, now(), now());

insert into sys_menu(id, pater_id, sys_id, code, name, type, interface_uri, web_json, create_time, update_time)
values(18, 1, 1, 'dept', '部门管理', 1, null, null, now(), now());
insert into sys_menu(id, pater_id, sys_id, code, name, type, interface_uri, web_json, create_time, update_time)
values(19, 18, 1, 'dept_data', '部门列表', 2, '/sysDept/tree/list,/authorize/sysDept/tree/list,/dev-authorize/sysDept/tree/list', null, now(), now());
insert into sys_menu(id, pater_id, sys_id, code, name, type, interface_uri, web_json, create_time, update_time)
values(20, 19, 1, 'dept_add', '添加部门', 2, '/sysDept/saveOrUpdate,/authorize/sysDept/saveOrUpdate,/dev-authorize/sysDept/saveOrUpdate', null, now(), now());
insert into sys_menu(id, pater_id, sys_id, code, name, type, interface_uri, web_json, create_time, update_time)
values(21, 19, 1, 'dept_del', '删除部门', 2, '/sysDept/deleteById,/authorize/sysDept/deleteById,/dev-authorize/sysDept/deleteById', null, now(), now());
insert into sys_menu(id, pater_id, sys_id, code, name, type, interface_uri, web_json, create_time, update_time)
values(22, 19, 1, 'dept_edit', '编辑部门', 2, '/sysDept/saveOrUpdate,/authorize/sysDept/saveOrUpdate,/dev-authorize/sysDept/saveOrUpdate', null, now(), now());
insert into sys_menu(id, pater_id, sys_id, code, name, type, interface_uri, web_json, create_time, update_time)
values(23, 19, 1, 'dept_role', '分配角色', 2, '/sysDept/saveOrUpdate,/authorize/sysDept/saveOrUpdate,/dev-authorize/sysDept/saveOrUpdate', null, now(), now());

insert into sys_menu(id, pater_id, sys_id, code, name, type, interface_uri, web_json, create_time, update_time)
values(24, 1, 1, 'system_value', '系统属性', 1, null, null, now(), now());
insert into sys_menu(id, pater_id, sys_id, code, name, type, interface_uri, web_json, create_time, update_time)
values(25, 24, 1, 'system_value_data', '系统属性列表', 2, '/sys-system-value/page,/authorize/sys-system-value/page,/dev-authorize/sys-system-value/page', null, now(), now());
insert into sys_menu(id, pater_id, sys_id, code, name, type, interface_uri, web_json, create_time, update_time)
values(26, 24, 1, 'system_value_add', '添加系统属性', 2, '/sys-system-value/save,/authorize/sys-system-value/save,/dev-authorize/sys-system-value/save', null, now(), now());
insert into sys_menu(id, pater_id, sys_id, code, name, type, interface_uri, web_json, create_time, update_time)
values(27, 24, 1, 'system_value_del', '删除系统属性', 2, '/sys-system-value/del,/authorize/sys-system-value/del,/dev-authorize/sys-system-value/del', null, now(), now());
insert into sys_menu(id, pater_id, sys_id, code, name, type, interface_uri, web_json, create_time, update_time)
values(28, 24, 1, 'system_value_edit', '编辑系统属性', 2, '/sys-system-value/update,/authorize/sys-system-value/update,/dev-authorize/sys-system-value/update', null, now(), now());

-- 新增角色菜单关联
delete from sys_role_menu where id in(10000, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 100, 101, 300);
insert into sys_role_menu(id, role_id, menu_id, sys_id, select_admin)
values(10000, 1, 10000, 1, true);
insert into sys_role_menu(id, role_id, menu_id, sys_id, select_admin)
values(1, 1, 1, 1, true);
insert into sys_role_menu(id, role_id, menu_id, sys_id, select_admin)
values(2, 1, 2, 1, true);
insert into sys_role_menu(id, role_id, menu_id, sys_id, select_admin)
values(3, 1, 3, 1, true);
insert into sys_role_menu(id, role_id, menu_id, sys_id, select_admin)
values(4, 1, 4, 1, true);
insert into sys_role_menu(id, role_id, menu_id, sys_id, select_admin)
values(5, 1, 5, 1, true);
insert into sys_role_menu(id, role_id, menu_id, sys_id, select_admin)
values(6, 1, 6, 1, true);
insert into sys_role_menu(id, role_id, menu_id, sys_id, select_admin)
values(7, 1, 7, 1, true);
insert into sys_role_menu(id, role_id, menu_id, sys_id, select_admin)
values(8, 1, 8, 1, true);
insert into sys_role_menu(id, role_id, menu_id, sys_id, select_admin)
values(9, 1, 9, 1, true);
insert into sys_role_menu(id, role_id, menu_id, sys_id, select_admin)
values(10, 1, 10, 1, true);
insert into sys_role_menu(id, role_id, menu_id, sys_id, select_admin)
values(11, 1, 11, 1, true);
insert into sys_role_menu(id, role_id, menu_id, sys_id, select_admin)
values(12, 1, 12, 1, true);
insert into sys_role_menu(id, role_id, menu_id, sys_id, select_admin)
values(13, 1, 13, 1, true);
insert into sys_role_menu(id, role_id, menu_id, sys_id, select_admin)
values(14, 1, 14, 1, true);
insert into sys_role_menu(id, role_id, menu_id, sys_id, select_admin)
values(15, 1, 15, 1, true);
insert into sys_role_menu(id, role_id, menu_id, sys_id, select_admin)
values(16, 1, 16, 1, true);
insert into sys_role_menu(id, role_id, menu_id, sys_id, select_admin)
values(17, 1, 17, 1, true);
insert into sys_role_menu(id, role_id, menu_id, sys_id, select_admin)
values(18, 1, 18, 1, true);
insert into sys_role_menu(id, role_id, menu_id, sys_id, select_admin)
values(19, 1, 19, 1, true);
insert into sys_role_menu(id, role_id, menu_id, sys_id, select_admin)
values(20, 1, 20, 1, true);
insert into sys_role_menu(id, role_id, menu_id, sys_id, select_admin)
values(21, 1, 21, 1, true);
insert into sys_role_menu(id, role_id, menu_id, sys_id, select_admin)
values(22, 1, 22, 1, true);
insert into sys_role_menu(id, role_id, menu_id, sys_id, select_admin)
values(23, 1, 23, 1, true);
insert into sys_role_menu(id, role_id, menu_id, sys_id, select_admin)
values(24, 1, 24, 1, true);
insert into sys_role_menu(id, role_id, menu_id, sys_id, select_admin)
values(25, 1, 25, 1, true);
insert into sys_role_menu(id, role_id, menu_id, sys_id, select_admin)
values(26, 1, 26, 1, true);
insert into sys_role_menu(id, role_id, menu_id, sys_id, select_admin)
values(27, 1, 27, 1, true);
insert into sys_role_menu(id, role_id, menu_id, sys_id, select_admin)
values(28, 1, 28, 1, true);
insert into sys_role_menu(id, role_id, menu_id, sys_id, select_admin)
values(100, 1, 100, 1, true);
insert into sys_role_menu(id, role_id, menu_id, sys_id, select_admin)
values(101, 1, 101, 1, true);
insert into sys_role_menu(id, role_id, menu_id, sys_id, select_admin)
values(300, 1, 300, 1, true);