-- 挂号批量改渠道：接口 doctor.appointment/batchEditChannel
-- 须写入菜单权限才会走鉴权；实际访问时 AuthMiddleware 将 batch 映射为已勾选的 doctor.appointment/edit
-- 执行前确认表前缀为 zyt_

SET @guahao_menu_id := (SELECT id FROM zyt_system_menu WHERE paths = 'consumer/prescription_guahao' LIMIT 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
)
SELECT
    @guahao_menu_id, 'A', '批量修改挂号渠道', '', 2,
    'doctor.appointment/batchEditChannel', '', '',
    '', '', 0, 1, 0, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()
FROM DUAL
WHERE @guahao_menu_id IS NOT NULL
  AND NOT EXISTS (SELECT 1 FROM zyt_system_menu WHERE perms = 'doctor.appointment/batchEditChannel');
