-- 商户充值:为超级管理员角色补全权限(可重复执行)
|
-- 执行后请重新登录以刷新 Redis 中的权限缓存
|
|
INSERT INTO `SYSTEM_ROLE_PERMISSION` (`ROLE_ID`, `PERMISSION_ID`, `CREATE_TIME`, `UPDATE_TIME`, `CREATE_USER`, `UPDATE_USER`, `DELETED`)
|
SELECT r.`ID`, p.`ID`, CURRENT_TIMESTAMP, NULL, 1, NULL, 0
|
FROM `SYSTEM_ROLE` r
|
INNER JOIN `SYSTEM_PERMISSION` p ON p.`CODE` IN (
|
'business:ywcustomerrecharge:query',
|
'business:ywcustomerrecharge:exportExcel',
|
'business:ywcustomerrecharge:bindDevice',
|
'business:ywcustomerrecharge:recharge',
|
'business:ywcustomerrechargerecord:query',
|
'business:ywcustomerrechargerecord:exportExcel',
|
'business:ywcustomerrechargerecord:retry',
|
'business:ywcustomerrechargerecord:syncStatus'
|
) AND p.`DELETED` = 0
|
WHERE r.`DELETED` = 0 AND (r.`CODE` = 'admin' OR r.`NAME` IN ('超级管理员', '管理员'))
|
AND NOT EXISTS (
|
SELECT 1 FROM `SYSTEM_ROLE_PERMISSION` rp
|
WHERE rp.`ROLE_ID` = r.`ID` AND rp.`PERMISSION_ID` = p.`ID` AND rp.`DELETED` = 0
|
);
|
|
INSERT INTO `SYSTEM_ROLE_MENU` (`ROLE_ID`, `MENU_ID`, `CREATE_TIME`, `UPDATE_TIME`, `CREATE_USER`, `UPDATE_USER`, `DELETED`)
|
SELECT r.`ID`, menu.`ID`, CURRENT_TIMESTAMP, NULL, 1, NULL, 0
|
FROM `SYSTEM_ROLE` r
|
INNER JOIN `SYSTEM_MENU` menu ON menu.`DELETED` = 0 AND (
|
(menu.`NAME` = '商户充值' AND (menu.`PATH` IS NULL OR menu.`PATH` = ''))
|
OR menu.`PATH` IN ('/business/ywcustomerrecharge', '/business/ywcustomerrechargerecord')
|
)
|
WHERE r.`DELETED` = 0 AND (r.`CODE` = 'admin' OR r.`NAME` IN ('超级管理员', '管理员'))
|
AND NOT EXISTS (
|
SELECT 1 FROM `SYSTEM_ROLE_MENU` rm
|
WHERE rm.`ROLE_ID` = r.`ID` AND rm.`MENU_ID` = menu.`ID` AND rm.`DELETED` = 0
|
);
|