修复:收紧托盘业务权限与数据契约
This commit is contained in:
@@ -400,6 +400,102 @@ create table if not exists biz_pallet_inventory (
|
||||
|
||||
-- ==================== DML:清理旧 seed 并写入托盘业务菜单 ====================
|
||||
|
||||
-- 删除前校验固定 ID 仍属于原始 AI/外链 seed;任一 ID 被自定义数据复用时,
|
||||
-- 临时表唯一键冲突会在所有永久 DML 之前中止补丁,避免误删角色、菜单或字典数据。
|
||||
drop temporary table if exists pallet_workflow_legacy_seed_guard;
|
||||
create temporary table pallet_workflow_legacy_seed_guard (
|
||||
guard_token varchar(64) not null,
|
||||
primary key (guard_token)
|
||||
);
|
||||
|
||||
insert into pallet_workflow_legacy_seed_guard (guard_token)
|
||||
select guard_token
|
||||
from (
|
||||
select 'legacy-seed-conflict' as guard_token
|
||||
union all
|
||||
select if(
|
||||
not exists (
|
||||
select 1
|
||||
from sys_menu
|
||||
where menu_id in (4, 99, 118, 119, 1061, 1062, 1063, 1064)
|
||||
and not (
|
||||
(menu_id = 4
|
||||
and menu_name <=> 'AI 管理'
|
||||
and parent_id <=> 0
|
||||
and path <=> 'ai'
|
||||
and component <=> null
|
||||
and perms <=> ''
|
||||
and menu_type <=> 'M')
|
||||
or (menu_id = 99
|
||||
and menu_name <=> '施尔丰仓库'
|
||||
and parent_id <=> 0
|
||||
and path <=> 'https://git.yujiangrubber.cn/niuniu/ShiErFeng'
|
||||
and component <=> null
|
||||
and perms <=> ''
|
||||
and menu_type <=> 'M')
|
||||
or (menu_id = 118
|
||||
and menu_name <=> '模型管理'
|
||||
and parent_id <=> 4
|
||||
and path <=> 'model'
|
||||
and component <=> 'ai/model/index'
|
||||
and perms <=> 'ai:model:list'
|
||||
and menu_type <=> 'C')
|
||||
or (menu_id = 119
|
||||
and menu_name <=> 'AI 对话'
|
||||
and parent_id <=> 4
|
||||
and path <=> 'chat'
|
||||
and component <=> 'ai/chat/index'
|
||||
and perms <=> 'ai:chat:list'
|
||||
and menu_type <=> 'C')
|
||||
or (menu_id = 1061
|
||||
and menu_name <=> '模型查询'
|
||||
and parent_id <=> 118
|
||||
and path <=> '#'
|
||||
and component <=> ''
|
||||
and perms <=> 'ai:model:query'
|
||||
and menu_type <=> 'F')
|
||||
or (menu_id = 1062
|
||||
and menu_name <=> '模型新增'
|
||||
and parent_id <=> 118
|
||||
and path <=> '#'
|
||||
and component <=> ''
|
||||
and perms <=> 'ai:model:add'
|
||||
and menu_type <=> 'F')
|
||||
or (menu_id = 1063
|
||||
and menu_name <=> '模型修改'
|
||||
and parent_id <=> 118
|
||||
and path <=> '#'
|
||||
and component <=> ''
|
||||
and perms <=> 'ai:model:edit'
|
||||
and menu_type <=> 'F')
|
||||
or (menu_id = 1064
|
||||
and menu_name <=> '模型删除'
|
||||
and parent_id <=> 118
|
||||
and path <=> '#'
|
||||
and component <=> ''
|
||||
and perms <=> 'ai:model:remove'
|
||||
and menu_type <=> 'F')
|
||||
)
|
||||
)
|
||||
and not exists (
|
||||
select 1
|
||||
from sys_dict_data
|
||||
where dict_code between 33 and 69
|
||||
and not (dict_type <=> 'ai_provider_type')
|
||||
)
|
||||
and not exists (
|
||||
select 1
|
||||
from sys_dict_type
|
||||
where dict_id = 12
|
||||
and not (dict_type <=> 'ai_provider_type')
|
||||
),
|
||||
'legacy-seed-verified',
|
||||
'legacy-seed-conflict'
|
||||
) as guard_token
|
||||
) as legacy_seed_guard_rows;
|
||||
|
||||
drop temporary table pallet_workflow_legacy_seed_guard;
|
||||
|
||||
-- 先解除所有待清理菜单的历史角色关联。
|
||||
delete from sys_role_menu
|
||||
where menu_id in (4, 99, 118, 119, 1061, 1062, 1063, 1064);
|
||||
@@ -410,11 +506,18 @@ where menu_id in (4, 118, 119, 1061, 1062, 1063, 1064);
|
||||
|
||||
delete from sys_dict_data
|
||||
where dict_code between 33 and 69
|
||||
or dict_type = 'ai_provider_type';
|
||||
and dict_type = 'ai_provider_type';
|
||||
|
||||
-- 同时清理后续可能追加、但仍明确属于 AI provider 字典的扩展项。
|
||||
delete from sys_dict_data
|
||||
where dict_type = 'ai_provider_type';
|
||||
|
||||
delete from sys_dict_type
|
||||
where dict_id = 12
|
||||
or dict_type = 'ai_provider_type';
|
||||
and dict_type = 'ai_provider_type';
|
||||
|
||||
delete from sys_dict_type
|
||||
where dict_type = 'ai_provider_type';
|
||||
|
||||
delete from sys_menu
|
||||
where menu_id = 99;
|
||||
|
||||
Reference in New Issue
Block a user