优化
This commit is contained in:
@@ -31,7 +31,20 @@ ON DUPLICATE KEY UPDATE
|
||||
UPDATE iam_permission
|
||||
SET status='INACTIVE', deleted=1
|
||||
WHERE tenant_id=0 AND app_code='PLATFORM'
|
||||
AND permission_code IN ('platform:overseas-storage-fee:create','platform:overseas-storage-fee:delete');
|
||||
AND permission_code IN (
|
||||
'platform:overseas-storage-fee:create','platform:overseas-storage-fee:delete',
|
||||
'platform:finance:bill:view','platform:finance:account:view',
|
||||
'platform:finance:fee-source:view','platform:finance:settlement-ar:view',
|
||||
'platform:finance:settlement-ap:view');
|
||||
|
||||
DELETE rp
|
||||
FROM iam_role_permission rp
|
||||
JOIN iam_permission p ON p.id=rp.permission_id AND p.tenant_id=rp.tenant_id
|
||||
WHERE p.tenant_id=0 AND p.app_code='PLATFORM'
|
||||
AND p.permission_code IN (
|
||||
'platform:finance:bill:view','platform:finance:account:view',
|
||||
'platform:finance:fee-source:view','platform:finance:settlement-ar:view',
|
||||
'platform:finance:settlement-ap:view');
|
||||
|
||||
INSERT IGNORE INTO iam_role_permission (tenant_id, role_id, permission_id, created_at)
|
||||
SELECT 0, r.id, p.id, CURRENT_TIMESTAMP(3)
|
||||
@@ -60,9 +73,7 @@ UPDATE iam_permission p
|
||||
WHERE p.tenant_id=0 AND p.app_code='PLATFORM';
|
||||
|
||||
UPDATE iam_permission p
|
||||
JOIN (SELECT 'platform:finance:account:view' code, 5105040 parent_id UNION ALL
|
||||
SELECT 'platform:finance:fee-source:view', 5105041 UNION ALL
|
||||
SELECT 'platform:finance:fee-source:review', 5105041 UNION ALL
|
||||
JOIN (SELECT 'platform:finance:fee-source:review' code, 5105041 parent_id UNION ALL
|
||||
SELECT 'platform:finance:fee-source:settlement', 5105041 UNION ALL
|
||||
SELECT 'platform:finance:reconciliation:create', 5105042 UNION ALL
|
||||
SELECT 'platform:finance:reconciliation:review', 5105042 UNION ALL
|
||||
@@ -70,9 +81,7 @@ UPDATE iam_permission p
|
||||
SELECT 'platform:finance:reconciliation:adjust', 5105042 UNION ALL
|
||||
SELECT 'platform:finance:reconciliation:void', 5105042 UNION ALL
|
||||
SELECT 'platform:finance:settlement-ar:create', 5105043 UNION ALL
|
||||
SELECT 'platform:finance:settlement-ar:view', 5105043 UNION ALL
|
||||
SELECT 'platform:finance:settlement-ap:create', 5105044 UNION ALL
|
||||
SELECT 'platform:finance:settlement-ap:view', 5105044 UNION ALL
|
||||
SELECT 'platform:finance:payment:create', 5105044) mapping
|
||||
ON mapping.code=p.permission_code
|
||||
SET p.parent_id=mapping.parent_id
|
||||
|
||||
@@ -11,16 +11,12 @@ BEGIN
|
||||
SELECT 1
|
||||
FROM iam_permission
|
||||
WHERE (id = 5105000 AND permission_code <> 'platform:finance')
|
||||
OR (id = 5105022 AND permission_code <> 'platform:finance:account:view')
|
||||
OR (id = 5105023 AND permission_code <> 'platform:finance:fee-source:view')
|
||||
OR (id = 5105024 AND permission_code <> 'platform:finance:fee-source:review')
|
||||
OR (id = 5105025 AND permission_code <> 'platform:finance:fee-source:settlement')
|
||||
OR (permission_code = 'platform:finance' AND id <> 5105000)
|
||||
OR (permission_code = 'platform:finance:account:view' AND id <> 5105022)
|
||||
OR (permission_code = 'platform:finance:fee-source:view' AND id <> 5105023)
|
||||
OR (permission_code = 'platform:finance:fee-source:review' AND id <> 5105024)
|
||||
OR (permission_code = 'platform:finance:fee-source:settlement' AND id <> 5105025)
|
||||
OR (id IN (5105000, 5105022, 5105023, 5105024, 5105025)
|
||||
OR (id IN (5105000, 5105024, 5105025)
|
||||
AND (tenant_id <> 0 OR app_code <> 'PLATFORM'))
|
||||
) THEN
|
||||
SIGNAL SQLSTATE '45000'
|
||||
@@ -33,10 +29,6 @@ BEGIN
|
||||
VALUES
|
||||
(5105000, 0, 'PLATFORM', 'MENU', 0, 'platform:finance',
|
||||
'财务管理', '/finance', NULL, 60, 'ACTIVE', 1, 0),
|
||||
(5105022, 0, 'PLATFORM', 'BUTTON', 5105000, 'platform:finance:account:view',
|
||||
'查看客户财务账户及流水', NULL, 'GET', 130, 'ACTIVE', 1, 0),
|
||||
(5105023, 0, 'PLATFORM', 'BUTTON', 5105000, 'platform:finance:fee-source:view',
|
||||
'查看财务费用来源', NULL, 'GET', 140, 'ACTIVE', 1, 0),
|
||||
(5105024, 0, 'PLATFORM', 'BUTTON', 5105000, 'platform:finance:fee-source:review',
|
||||
'审核财务费用来源', NULL, 'POST', 150, 'ACTIVE', 1, 0),
|
||||
(5105025, 0, 'PLATFORM', 'BUTTON', 5105000, 'platform:finance:fee-source:settlement',
|
||||
@@ -47,6 +39,11 @@ BEGIN
|
||||
http_method = VALUES(http_method), sort_no = VALUES(sort_no),
|
||||
status = 'ACTIVE', built_in = 1, deleted = 0;
|
||||
|
||||
DELETE rp FROM iam_role_permission rp JOIN iam_permission p ON p.id=rp.permission_id AND p.tenant_id=rp.tenant_id
|
||||
WHERE p.tenant_id=0 AND p.app_code='PLATFORM' AND p.permission_code IN ('platform:finance:account:view','platform:finance:fee-source:view');
|
||||
UPDATE iam_permission SET status='INACTIVE', deleted=1
|
||||
WHERE tenant_id=0 AND app_code='PLATFORM' AND permission_code IN ('platform:finance:account:view','platform:finance:fee-source:view');
|
||||
|
||||
IF (SELECT COUNT(*)
|
||||
FROM iam_permission
|
||||
WHERE tenant_id = 0
|
||||
@@ -57,10 +54,8 @@ BEGIN
|
||||
AND built_in = 1
|
||||
AND deleted = 0
|
||||
AND permission_code IN (
|
||||
'platform:finance:account:view',
|
||||
'platform:finance:fee-source:view',
|
||||
'platform:finance:fee-source:review',
|
||||
'platform:finance:fee-source:settlement')) <> 4 THEN
|
||||
'platform:finance:fee-source:settlement')) <> 2 THEN
|
||||
SIGNAL SQLSTATE '45000'
|
||||
SET MESSAGE_TEXT = 'finance G1/G2 permission catalog is incomplete';
|
||||
END IF;
|
||||
|
||||
@@ -17,8 +17,6 @@ IF EXISTS (
|
||||
OR (id = 5105030 AND permission_code <> 'platform:finance:reconciliation:void')
|
||||
OR (id = 5105031 AND permission_code <> 'platform:finance:settlement-ar:create')
|
||||
OR (id = 5105032 AND permission_code <> 'platform:finance:settlement-ap:create')
|
||||
OR (id = 5105033 AND permission_code <> 'platform:finance:settlement-ar:view')
|
||||
OR (id = 5105034 AND permission_code <> 'platform:finance:settlement-ap:view')
|
||||
OR (id = 5105035 AND permission_code <> 'platform:finance:payment:create')
|
||||
OR (permission_code = 'platform:finance:reconciliation:create' AND id <> 5105026)
|
||||
OR (permission_code = 'platform:finance:reconciliation:review' AND id <> 5105027)
|
||||
@@ -27,8 +25,6 @@ IF EXISTS (
|
||||
OR (permission_code = 'platform:finance:reconciliation:void' AND id <> 5105030)
|
||||
OR (permission_code = 'platform:finance:settlement-ar:create' AND id <> 5105031)
|
||||
OR (permission_code = 'platform:finance:settlement-ap:create' AND id <> 5105032)
|
||||
OR (permission_code = 'platform:finance:settlement-ar:view' AND id <> 5105033)
|
||||
OR (permission_code = 'platform:finance:settlement-ap:view' AND id <> 5105034)
|
||||
OR (permission_code = 'platform:finance:payment:create' AND id <> 5105035)
|
||||
OR (id BETWEEN 5105026 AND 5105035 AND (tenant_id <> 0 OR app_code <> 'PLATFORM'))
|
||||
) THEN
|
||||
@@ -46,8 +42,6 @@ VALUES
|
||||
(5105030, 0, 'PLATFORM', 'BUTTON', 5105000, 'platform:finance:reconciliation:void', '作废或重开客户对账单', NULL, 'POST', 210, 'ACTIVE', 1, 0),
|
||||
(5105031, 0, 'PLATFORM', 'BUTTON', 5105000, 'platform:finance:settlement-ar:create', '生成应收结算单', NULL, 'POST', 220, 'ACTIVE', 1, 0),
|
||||
(5105032, 0, 'PLATFORM', 'BUTTON', 5105000, 'platform:finance:settlement-ap:create', '生成应付结算单', NULL, 'POST', 230, 'ACTIVE', 1, 0),
|
||||
(5105033, 0, 'PLATFORM', 'BUTTON', 5105000, 'platform:finance:settlement-ar:view', '查看应收结算单', NULL, 'GET', 240, 'ACTIVE', 1, 0),
|
||||
(5105034, 0, 'PLATFORM', 'BUTTON', 5105000, 'platform:finance:settlement-ap:view', '查看应付结算单', NULL, 'GET', 250, 'ACTIVE', 1, 0),
|
||||
(5105035, 0, 'PLATFORM', 'BUTTON', 5105000, 'platform:finance:payment:create', '登记应付付款', NULL, 'POST', 260, 'ACTIVE', 1, 0)
|
||||
ON DUPLICATE KEY UPDATE
|
||||
permission_type = VALUES(permission_type), parent_id = VALUES(parent_id),
|
||||
@@ -55,13 +49,24 @@ ON DUPLICATE KEY UPDATE
|
||||
http_method = VALUES(http_method), sort_no = VALUES(sort_no),
|
||||
status = 'ACTIVE', built_in = 1, deleted = 0;
|
||||
|
||||
DELETE rp
|
||||
FROM iam_role_permission rp
|
||||
JOIN iam_permission p ON p.id=rp.permission_id AND p.tenant_id=rp.tenant_id
|
||||
WHERE p.tenant_id=0 AND p.app_code='PLATFORM'
|
||||
AND p.permission_code IN ('platform:finance:settlement-ar:view','platform:finance:settlement-ap:view');
|
||||
|
||||
UPDATE iam_permission
|
||||
SET status='INACTIVE', deleted=1
|
||||
WHERE tenant_id=0 AND app_code='PLATFORM'
|
||||
AND permission_code IN ('platform:finance:settlement-ar:view','platform:finance:settlement-ap:view');
|
||||
|
||||
IF (SELECT COUNT(*) FROM iam_permission
|
||||
WHERE tenant_id=0 AND app_code='PLATFORM' AND parent_id=5105000
|
||||
AND permission_code IN ('platform:finance:reconciliation:create','platform:finance:reconciliation:review',
|
||||
'platform:finance:reconciliation:issue','platform:finance:reconciliation:adjust','platform:finance:reconciliation:void',
|
||||
'platform:finance:settlement-ar:create','platform:finance:settlement-ap:create',
|
||||
'platform:finance:settlement-ar:view','platform:finance:settlement-ap:view','platform:finance:payment:create')
|
||||
AND status='ACTIVE' AND deleted=0) <> 10 THEN
|
||||
'platform:finance:payment:create')
|
||||
AND status='ACTIVE' AND deleted=0) <> 8 THEN
|
||||
SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT='finance G3/G4 permission catalog is incomplete';
|
||||
END IF;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user