docs(sql): add miniprogram CRM product webview menus and role bind.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
2f72c29ee7
commit
d3a7e3d3fd
1 file changed
+60
@@ -0,0 +1,60 @@
|
||||
-- 小程序:CRM管理 → 产品管理(WebView)
|
||||
-- 给已有 Web 产品管理菜单 CRM00000000000000000000000000003(crm:product:list)的角色自动补绑
|
||||
SET NAMES utf8mb4;
|
||||
|
||||
INSERT INTO `sys_menu` (
|
||||
`id`, `menu_name`, `parent_id`, `menu_type`, `path`, `component`, `perms`,
|
||||
`is_frame`, `visible`, `status`, `tenant_no`, `order_num`, `remark`,
|
||||
`create_by`, `create_dept_id`, `create_time`, `update_by`, `update_time`, `del_flag`
|
||||
)
|
||||
SELECT
|
||||
'MINI_CRM_ROOT', 'CRM管理', '1', 'M', '/mini/crm', NULL, NULL,
|
||||
1, '1', '1', 'shanxia2.0', 2, '小程序CRM管理',
|
||||
'system', '', NOW(), NULL, NOW(), 0
|
||||
FROM DUAL
|
||||
WHERE NOT EXISTS (
|
||||
SELECT 1 FROM `sys_menu` WHERE `id` = 'MINI_CRM_ROOT' AND `del_flag` = 0
|
||||
);
|
||||
|
||||
INSERT INTO `sys_menu` (
|
||||
`id`, `menu_name`, `parent_id`, `menu_type`, `path`, `component`, `perms`,
|
||||
`is_frame`, `visible`, `status`, `tenant_no`, `order_num`, `remark`,
|
||||
`create_by`, `create_dept_id`, `create_time`, `update_by`, `update_time`, `del_flag`
|
||||
)
|
||||
SELECT
|
||||
'MINI_CRM_PRODUCT', '产品管理', 'MINI_CRM_ROOT', 'C', 'mp-webview', NULL,
|
||||
'mini:crm:product:list',
|
||||
1, '1', '1', 'shanxia2.0', 1, '小程序 WebView CRM 产品管理',
|
||||
'system', '', NOW(), NULL, NOW(), 0
|
||||
FROM DUAL
|
||||
WHERE NOT EXISTS (
|
||||
SELECT 1 FROM `sys_menu` WHERE `id` = 'MINI_CRM_PRODUCT' AND `del_flag` = 0
|
||||
);
|
||||
|
||||
INSERT INTO `sys_role_menu` (
|
||||
`id`, `role_id`, `menu_id`, `tenant_no`, `order_num`, `remark`,
|
||||
`create_by`, `create_dept_id`, `create_time`, `update_by`, `update_time`, `del_flag`
|
||||
)
|
||||
SELECT
|
||||
MD5(CONCAT(r.id, '|', m.menu_id, '|mini-crm-product-webview|v1')),
|
||||
r.id,
|
||||
m.menu_id,
|
||||
IFNULL(NULLIF(r.tenant_no, ''), 'shanxia2.0'),
|
||||
0,
|
||||
'小程序CRM产品管理:随 Web 产品权限补绑',
|
||||
'system', '', NOW(), NULL, NOW(), 0
|
||||
FROM `sys_role` r
|
||||
JOIN `sys_role_menu` web
|
||||
ON web.role_id = r.id
|
||||
AND web.menu_id = 'CRM00000000000000000000000000003'
|
||||
AND web.del_flag = 0
|
||||
JOIN (
|
||||
SELECT '1' AS menu_id UNION ALL
|
||||
SELECT 'MINI_CRM_ROOT' UNION ALL
|
||||
SELECT 'MINI_CRM_PRODUCT'
|
||||
) m
|
||||
WHERE r.del_flag = 0
|
||||
AND NOT EXISTS (
|
||||
SELECT 1 FROM `sys_role_menu` x
|
||||
WHERE x.role_id = r.id AND x.menu_id = m.menu_id AND x.del_flag = 0
|
||||
);
|
||||
Reference in new issue
Block a user