chore(seed): include customer analysis permission mapping

This commit is contained in:
2026-03-03 16:46:14 +08:00
parent 7486bf272e
commit d7d55e9908

View File

@@ -124,12 +124,13 @@ WHERE
"Portal" = 1
AND ("Name" = 'CustomerAnalysis' OR "Component" = '/customer/analysis/index');
-- 3) 给角色模板补齐客户列表与画像权限(按订单列表权限映射)
-- 说明:本轮映射 list(view/manage)+profile(view)analysis 不做角色映射
-- 3) 给角色模板补齐客户管理权限(按订单列表权限映射)
-- 说明:本轮映射 list(view/manage)+profile(view)+analysis(view)
WITH code_mapping(source_code, target_code) AS (
VALUES
('tenant:order:list:view', 'tenant:customer:list:view'),
('tenant:order:list:view', 'tenant:customer:profile:view'),
('tenant:order:list:view', 'tenant:customer:analysis:view'),
('tenant:order:list:update', 'tenant:customer:list:manage')
),
candidates AS (
@@ -180,6 +181,7 @@ WITH code_mapping(source_code, target_code) AS (
VALUES
('tenant:order:list:view', 'tenant:customer:list:view'),
('tenant:order:list:view', 'tenant:customer:profile:view'),
('tenant:order:list:view', 'tenant:customer:analysis:view'),
('tenant:order:list:update', 'tenant:customer:list:manage')
)
UPDATE public.role_template_permissions target
@@ -194,12 +196,13 @@ WHERE
source."RoleTemplateId" = target."RoleTemplateId"
AND target."PermissionCode" = mapping.target_code;
-- 4) 给租户角色补齐客户列表与画像权限(按订单列表权限映射)
-- 说明:本轮映射 list(view/manage)+profile(view)analysis 不做角色映射
-- 4) 给租户角色补齐客户管理权限(按订单列表权限映射)
-- 说明:本轮映射 list(view/manage)+profile(view)+analysis(view)
WITH code_mapping(source_code, target_code) AS (
VALUES
('tenant:order:list:view', 'tenant:customer:list:view'),
('tenant:order:list:view', 'tenant:customer:profile:view'),
('tenant:order:list:view', 'tenant:customer:analysis:view'),
('tenant:order:list:update', 'tenant:customer:list:manage')
),
source_rows AS (
@@ -274,6 +277,7 @@ WITH code_mapping(source_code, target_code) AS (
VALUES
('tenant:order:list:view', 'tenant:customer:list:view'),
('tenant:order:list:view', 'tenant:customer:profile:view'),
('tenant:order:list:view', 'tenant:customer:analysis:view'),
('tenant:order:list:update', 'tenant:customer:list:manage')
)
UPDATE public.role_permissions target