-- 专属数字资产 菜单和权限配置
-- 注意：需要根据实际的菜单表结构调整字段名称（如前缀 zyt_ 可能需根据您的实际表前缀替换）

-- 1. 添加一级菜单：资源分发管理
INSERT INTO `zyt_system_menu` (`pid`, `type`, `name`, `icon`, `sort`, `perms`, `paths`, `component`, `selected`, `params`, `is_cache`, `is_show`, `is_disable`, `create_time`, `update_time`) 
VALUES (0, 'M', '资源分发管理', 'el-icon-FolderOpened', 110, '', '/asset', '', '', '', 0, 1, 0, UNIX_TIMESTAMP(), UNIX_TIMESTAMP());

-- 获取刚插入的一级菜单ID
SET @asset_pid = LAST_INSERT_ID();

-- 2. 添加二级菜单：分发账号管理
INSERT INTO `zyt_system_menu` (`pid`, `type`, `name`, `icon`, `sort`, `perms`, `paths`, `component`, `selected`, `params`, `is_cache`, `is_show`, `is_disable`, `create_time`, `update_time`) 
VALUES (@asset_pid, 'C', '分发账号管理', 'el-icon-User', 1, 'asset.AssetUser/lists', '/asset/user', '/asset/user/index', '', '', 0, 1, 0, UNIX_TIMESTAMP(), UNIX_TIMESTAMP());

-- 获取【分发账号管理】菜单ID
SET @user_menu_id = LAST_INSERT_ID();

-- 3. 添加账号相关按钮权限
INSERT INTO `zyt_system_menu` (`pid`, `type`, `name`, `icon`, `sort`, `perms`, `paths`, `component`, `selected`, `params`, `is_cache`, `is_show`, `is_disable`, `create_time`, `update_time`) 
VALUES 
(@user_menu_id, 'A', '新增账号', '', 1, 'asset.AssetUser/add', '', '', '', '', 0, 1, 0, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
(@user_menu_id, 'A', '编辑账号', '', 2, 'asset.AssetUser/edit', '', '', '', '', 0, 1, 0, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
(@user_menu_id, 'A', '删除账号', '', 3, 'asset.AssetUser/delete', '', '', '', '', 0, 1, 0, UNIX_TIMESTAMP(), UNIX_TIMESTAMP());


-- 4. 添加二级菜单：资源素材下发
INSERT INTO `zyt_system_menu` (`pid`, `type`, `name`, `icon`, `sort`, `perms`, `paths`, `component`, `selected`, `params`, `is_cache`, `is_show`, `is_disable`, `create_time`, `update_time`) 
VALUES (@asset_pid, 'C', '资源素材下发', 'el-icon-Files', 2, 'asset.AssetResource/lists', '/asset/resource', '/asset/resource/index', '', '', 0, 1, 0, UNIX_TIMESTAMP(), UNIX_TIMESTAMP());

-- 获取【资源素材下发】菜单ID
SET @resource_menu_id = LAST_INSERT_ID();

-- 5. 添加资源相关按钮权限
INSERT INTO `zyt_system_menu` (`pid`, `type`, `name`, `icon`, `sort`, `perms`, `paths`, `component`, `selected`, `params`, `is_cache`, `is_show`, `is_disable`, `create_time`, `update_time`) 
VALUES 
(@resource_menu_id, 'A', '上传分配资源', '', 1, 'asset.AssetResource/add', '', '', '', '', 0, 1, 0, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
(@resource_menu_id, 'A', '删除资源', '', 2, 'asset.AssetResource/delete', '', '', '', '', 0, 1, 0, UNIX_TIMESTAMP(), UNIX_TIMESTAMP());

