-- 业绩看板页内「医生日统计」接口权限：挂在 fans/yeji 同级菜单 id=293 下（仅 API，不新增独立页面）
-- 幂等：按 perms 判重

INSERT INTO `zyt_system_menu`
(`pid`, `type`, `name`, `icon`, `sort`, `perms`, `paths`, `component`, `selected`, `params`, `is_show`, `is_disable`, `create_time`, `update_time`)
SELECT
    293, 'A', '业绩-医生日统计', '', 7,
    'stats.doctorDailyStats/overview', '', '', '', '',
    1, 0, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()
FROM DUAL
WHERE EXISTS (SELECT 1 FROM `zyt_system_menu` p WHERE p.id = 293)
  AND NOT EXISTS (
    SELECT 1 FROM `zyt_system_menu` m
    WHERE m.perms = 'stats.doctorDailyStats/overview'
);
