Files
yunzerwebsiteallinone/sql/seed_oa_compensation_menu.sql
T
2026-08-29 22:06:00 +08:00

70 lines
2.1 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/compensation',
'/apps/oa/compensation/index.vue',
'Money',
6,
1,
1,
'[2]',
2,
'员工薪资档案与月度工资核算'
FROM DUAL
WHERE NOT EXISTS (
SELECT 1
FROM (SELECT * FROM `yz_system_menu`) AS t
WHERE t.`path` = '/apps/oa/compensation'
);
-- 修正历史或手工新增菜单的动态组件路径及基础属性。
UPDATE `yz_system_menu`
SET
`pid` = @oa_pid,
`title` = '薪酬管理',
`component_path` = '/apps/oa/compensation/index.vue',
`icon` = 'Money',
`sort` = 6,
`status` = 1,
`is_visible` = 1,
`views` = '[2]',
`type` = 2,
`remark` = '员工薪资档案与月度工资核算'
WHERE `path` = '/apps/oa/compensation';