docs: 更新部署初始化脚本
author刘洪青 <hongqing.liu@supwisdom.com>
Tue, 31 Aug 2021 02:58:23 +0000 (10:58 +0800)
committer刘洪青 <hongqing.liu@supwisdom.com>
Tue, 31 Aug 2021 02:58:23 +0000 (10:58 +0800)
deploy-manifests/k8s-rancher/1.authx-service/10.0.init.sql

index 0ab59fa..cb4edee 100644 (file)
@@ -74,6 +74,8 @@ use admin_center;
 
 -- 管理接口路由
 
+delete from TB_MGT_ROUTE where ID in ('20', '40');
+
 insert into TB_MGT_ROUTE (ID, DELETED, CODE, NAME, STATUS, PATH_PREFIX, URL, STRIP_PREFIX) 
 values ('20', 0, 'authx-service-user-api', '认证授权 - 用户接口', '1', '/api/v1/base', 'https://localhost:8022', 0);
 
@@ -91,8 +93,8 @@ update TB_MGT_ROUTE set URL='http://user-data-service-goa-svc.user-data-service.
 
 update TB_MGT_ROUTE set URL='http://personal-security-center-bff-svc.personal-security-center.svc.cluster.local:8080/api/v1' where ID='40';
 
-update TB_MGT_ROUTE set URL='http://authx-service-bff.authx-service.svc.cluster.local:8080' where ID='21';
-update TB_MGT_ROUTE set URL='http://authx-service-bff.authx-service.svc.cluster.local:8080' where ID='22';
+update TB_MGT_ROUTE set URL='http://authx-service-bff-svc.authx-service.svc.cluster.local:8080' where ID='21';
+update TB_MGT_ROUTE set URL='http://authx-service-bff-svc.authx-service.svc.cluster.local:8080' where ID='22';
 
 commit;
 
@@ -105,6 +107,14 @@ values ('10', 0, '10', '用户授权', '1');
 commit;
 
 
+update TB_MGT_PERMISSION
+set APPLICATION_ID='10'
+where (ID like '2____' or ID like '3____' or ID like '4____')
+;
+
+commit;
+
+
 -- 菜单
 
 /*
@@ -247,21 +257,24 @@ insert into TB_MGT_ROLE_PERMISSION (ID, DELETED, ROLE_ID, PERMISSION_ID)
 
 select CONCAT('20_', ID) as ID, 0 as DELETED, '20' as ROLE_ID, ID as PERMISSION_ID 
 from TB_MGT_PERMISSION
-where ID like '2____' or ID='1'
+where (ID like '2____' or ID='1')
+  and CONCAT('20_', ID) not in (select ID from TB_MGT_ROLE_PERMISSION)
 ;
 
 insert into TB_MGT_ROLE_PERMISSION (ID, DELETED, ROLE_ID, PERMISSION_ID) 
 
 select CONCAT('30_', ID) as ID, 0 as DELETED, '30' as ROLE_ID, ID as PERMISSION_ID 
 from TB_MGT_PERMISSION
-where ID like '3____' or ID='1'
+where (ID like '3____' or ID='1')
+  and CONCAT('30_', ID) not in (select ID from TB_MGT_ROLE_PERMISSION)
 ;
 
 insert into TB_MGT_ROLE_PERMISSION (ID, DELETED, ROLE_ID, PERMISSION_ID) 
 
 select CONCAT('40_', ID) as ID, 0 as DELETED, '40' as ROLE_ID, ID as PERMISSION_ID 
 from TB_MGT_PERMISSION
-where ID like '4____' or ID='1'
+where (ID like '4____' or ID='1')
+  and CONCAT('40_', ID) not in (select ID from TB_MGT_ROLE_PERMISSION)
 ;
 
 
@@ -269,7 +282,8 @@ insert into TB_MGT_ROLE_PERMISSION (ID, DELETED, ROLE_ID, PERMISSION_ID)
 
 select CONCAT('41_', ID) as ID, 0 as DELETED, '41' as ROLE_ID, ID as PERMISSION_ID 
 from TB_MGT_PERMISSION
-where ID in ('40000', '40100', '40300', '40400', '40500') or ID='1'
+where (ID in ('40000', '40100', '40300', '40400', '40500') or ID='1')
+  and CONCAT('41_', ID) not in (select ID from TB_MGT_ROLE_PERMISSION)
 ;
 
 
@@ -277,7 +291,8 @@ insert into TB_MGT_ROLE_PERMISSION (ID, DELETED, ROLE_ID, PERMISSION_ID)
 
 select CONCAT('42_', ID) as ID, 0 as DELETED, '41' as ROLE_ID, ID as PERMISSION_ID 
 from TB_MGT_PERMISSION
-where ID in ('40000', '40900') or ID='1'
+where (ID in ('40000', '40900') or ID='1')
+  and CONCAT('42_', ID) not in (select ID from TB_MGT_ROLE_PERMISSION)
 ;
 
 commit;