Files
yunzerwebsiteallinone/sql/seed_oa_notice_menu.sql
T
2026-09-08 23:22:49 +08:00

70 lines
2.0 KiB
SQL
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
-- 通知公告菜单(租户端):挂在“办公自动化”模块目录下。
--
-- 说明:
-- 1. 本脚本只创建/修正 yz_system_menu 菜单记录,不涉及通知公告业务数据表。
-- 2. 路由由前端根据登录接口返回的菜单数据动态注册;
-- 不需要在 backend/src/router/index.js 中增加静态业务路由。
-- 3. 执行完成后,请在角色菜单权限关联表中为目标角色授予“通知公告”菜单权限,
-- 然后退出重登或清理菜单缓存。
--
-- views: [2] = 租户端
-- type: 1 = 目录,2 = 页面
-- 脚本可重复执行:通过 path 判重,已有记录会被修正为当前配置。
-- 确保“办公自动化”父级目录存在。
INSERT INTO `yz_system_menu`
(`pid`, `title`, `path`, `component_path`, `icon`, `sort`, `status`, `is_visible`, `views`, `type`, `remark`)
SELECT
0, '办公自动化', '/apps/oa', '', 'Document', 31, 1, 1, '[2]', 1, '办公自动化模块'
FROM DUAL
WHERE NOT EXISTS (
SELECT 1
FROM (SELECT * FROM `yz_system_menu`) AS t
WHERE t.`path` = '/apps/oa'
);
SET @oa_pid := (
SELECT `id`
FROM `yz_system_menu`
WHERE `path` = '/apps/oa'
ORDER BY `id`
LIMIT 1
);
-- 新增“通知公告”页面菜单。
INSERT INTO `yz_system_menu`
(`pid`, `title`, `path`, `component_path`, `icon`, `sort`, `status`, `is_visible`, `views`, `type`, `remark`)
SELECT
@oa_pid,
'通知公告',
'/apps/oa/notice',
'/apps/oa/notice/index.vue',
'Bell',
7,
1,
1,
'[2]',
2,
'通知公告发布与管理'
FROM DUAL
WHERE NOT EXISTS (
SELECT 1
FROM (SELECT * FROM `yz_system_menu`) AS t
WHERE t.`path` = '/apps/oa/notice'
);
-- 修正历史或手工新增菜单的动态组件路径及基础属性。
UPDATE `yz_system_menu`
SET
`pid` = @oa_pid,
`title` = '通知公告',
`component_path` = '/apps/oa/notice/index.vue',
`icon` = 'Bell',
`sort` = 7,
`status` = 1,
`is_visible` = 1,
`views` = '[2]',
`type` = 2,
`remark` = '通知公告发布与管理'
WHERE `path` = '/apps/oa/notice';