IUAP平台新增菜单存储过程

Posted xiaoxiong2015

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了IUAP平台新增菜单存储过程相关的知识,希望对你有一定的参考价值。

DROP PROCEDURE apps
DELIMITER $$
CREATE PROCEDURE apps(IN appCode VARCHAR ( 20 ))
BEGIN
 DECLARE stopflag INT DEFAULT 0;
 DECLARE tenantCode VARCHAR(100);
 DECLARE tenantId VARCHAR(100);
 DECLARE appsid VARCHAR(100);
 DECLARE appsapp_name VARCHAR(100);
 DECLARE appsgroup_id VARCHAR(100);
 DECLARE appsdomain_id VARCHAR(100);
 DECLARE appsurl VARCHAR(100);
 DECLARE appsapp_code VARCHAR(100);
 DECLARE username_cur CURSOR FOR SELECT REPLACE(id,"R001",""),tenant_id FROM ieop_role WHERE  role_code = admin AND tenant_id NOT IN (super,ifckxwyk,tyq4gj2z);
 DECLARE CONTINUE HANDLER FOR NOT FOUND SET stopflag=1;
 SELECT t.id, t.app_name ,t.group_id,t.domain_id,t.url,t.app_code INTO appsid,appsapp_name,appsgroup_id,appsdomain_id,appsurl,appsapp_code FROM wb_app_apps t WHERE t.app_code = appCode AND t.tenant_id = tyq4gj2z;  
 OPEN username_cur;
 FETCH username_cur INTO tenantCode,tenantId;  
 WHILE(stopflag=0) DO
 
 INSERT INTO `wb_app_apps` (`id`, `app_name`, `app_index`, 
 `group_id`, 
 `domain_id`, 
 `url`, `app_chinese`, `app_desc`, `app_icon`, `app_groupcode`, 
 `app_code`, `dyna_url`, `tenant_id`, `urltype`, `version`, `system`, `label`, `showway`,
 `creator`, `reviser`, `create_date`, `modify_date`, `app_name2`, `app_name3`, `app_name4`, `app_name5`, `app_name6`) 
 VALUES(REPLACE(CONCAT(tenantCode,appsid),ztegystest2,‘‘),appsapp_name,NULL,
 REPLACE(CONCAT(tenantCode,appsgroup_id),ztegystest2,‘‘),
 REPLACE(CONCAT(tenantCode,appsdomain_id),ztegystest2,‘‘),
 appsurl,NULL,
 NULL,grey iconfont icon-appicon,NULL,
 appsapp_code,NULL,tenantId,url,0,wbalone,NULL,apparea,IUAPxxx,
 NULL,NOW(),NULL,NULL,NULL,NULL,NULL,NULL);
 
 FETCH username_cur INTO tenantCode,tenantId; 
 END WHILE; 
 CLOSE username_cur;
END $$;
DROP PROCEDURE label 
DELIMITER $$
CREATE PROCEDURE label(IN funcId VARCHAR ( 20 ))
BEGIN
 DECLARE stopflag INT DEFAULT 0;
 DECLARE tenantCode VARCHAR(100);
 DECLARE tenantId VARCHAR(100);
 DECLARE buisourceId VARCHAR(100);
 DECLARE syssourceId VARCHAR(100);
 DECLARE mgrsourceId VARCHAR(100);
 DECLARE labelsourcecode VARCHAR(100);
 DECLARE labelsourceid VARCHAR(100);
 DECLARE username_cur CURSOR FOR SELECT REPLACE(id,"R001",""),tenant_id FROM ieop_role WHERE  role_code = admin AND tenant_id NOT IN (super,ifckxwyk,tyq4gj2z);
 DECLARE CONTINUE HANDLER FOR NOT FOUND SET stopflag=1;
 SELECT t.id,t.sourcecode,t.sourceid ,t2.id AS t2id,t3.id AS t3id INTO buisourceId,labelsourcecode,labelsourceid,syssourceId,mgrsourceId FROM wb_label_relation t
 INNER JOIN (SELECT t.id FROM wb_label_relation t WHERE labelcode = syssource AND t.sourcecode = funcId AND t.tenant_id = tyq4gj2z) t2  
 INNER JOIN (SELECT t.id  FROM wb_label_relation t WHERE labelcode = mgrsource AND t.sourcecode = funcId AND t.tenant_id = tyq4gj2z) t3  
 WHERE t.labelcode = buisource AND t.sourcecode = funcId AND t.tenant_id = tyq4gj2z;  
 OPEN username_cur;
 FETCH username_cur INTO tenantCode,tenantId;  
 WHILE(stopflag=0) DO
 
 INSERT INTO `wb_label_relation` (`id`, `labelcode`, `sourcecode`, `create_date`, `tenant_id`, `system`, `lableid`, `sourceid`, `type`) 
 VALUES(REPLACE(CONCAT(tenantCode,buisourceId),ztegystest2,‘‘),buisource,labelsourcecode,NOW(),tenantId,NULL,NULL,CONCAT(tenantCode,labelsourceid),app);
 INSERT INTO `wb_label_relation` (`id`, `labelcode`, `sourcecode`, `create_date`, `tenant_id`, `system`, `lableid`, `sourceid`, `type`) 
 VALUES(REPLACE(CONCAT(tenantCode,syssourceId),ztegystest2,‘‘),mgrsource,labelsourcecode,NOW(),tenantId,NULL,NULL,CONCAT(tenantCode,labelsourceid),app);
 INSERT INTO `wb_label_relation` (`id`, `labelcode`, `sourcecode`, `create_date`, `tenant_id`, `system`, `lableid`, `sourceid`, `type`) 
 VALUES(REPLACE(CONCAT(tenantCode,mgrsourceId),ztegystest2,‘‘),syssource,labelsourcecode,NOW(),tenantId,NULL,NULL,CONCAT(tenantCode,labelsourceid),app);
 
 FETCH username_cur INTO tenantCode,tenantId; 
 END WHILE; 
 CLOSE username_cur;
END $$;
DROP PROCEDURE permission
DELIMITER $$
CREATE PROCEDURE permission(IN funcId VARCHAR ( 20 ))
BEGIN
 DECLARE stopflag INT DEFAULT 0;
 DECLARE tenantCode VARCHAR(100);
 DECLARE tenantId VARCHAR(100);
 DECLARE pid VARCHAR(100);
 DECLARE ppermission_id VARCHAR(100);
 DECLARE pcode VARCHAR(100);
 DECLARE username_cur CURSOR FOR SELECT REPLACE(id,"R001",""),tenant_id FROM ieop_role WHERE  role_code = admin AND tenant_id NOT IN (super,ifckxwyk,tyq4gj2z);
 DECLARE CONTINUE HANDLER FOR NOT FOUND SET stopflag=1;
 SELECT t.id,t.permission_id,permission_code INTO pid,ppermission_id,pcode FROM ieop_role_permission t WHERE t.permission_code = funcId AND t.tenant_id = tyq4gj2z; 
 OPEN username_cur;
 FETCH username_cur INTO tenantCode,tenantId;  
 WHILE(stopflag=0) DO
 
 INSERT INTO `ieop_role_permission` (`id`, `role_id`, `role_code`, `permission_id`, `permission_code`, `permission_type`, `tenant_id`, `sys_id`)
 VALUES (REPLACE(CONCAT(tenantCode,pid),ztegystest2,‘‘), CONCAT(tenantCode,R001), admin, 
 REPLACE(CONCAT(tenantCode,ppermission_id),ztegystest2,‘‘), pcode, 1, tenantId, NULL);
 
 FETCH username_cur INTO tenantCode,tenantId; 
 END WHILE; 
 CLOSE username_cur;
END $$;
DROP PROCEDURE menu
DELIMITER $$
CREATE PROCEDURE menu(IN funcId VARCHAR ( 20 ))
BEGIN
 DECLARE stopflag INT DEFAULT 0;
 DECLARE tenantCode VARCHAR(100);
 DECLARE tenantId VARCHAR(100);
 DECLARE menuid VARCHAR(100);
 DECLARE menufuncid VARCHAR(100);
 DECLARE menuparentid VARCHAR(100);
 DECLARE menusort VARCHAR(100);
 DECLARE menuname VARCHAR(100);
 DECLARE username_cur CURSOR FOR SELECT REPLACE(id,"R001",""),tenant_id FROM ieop_role WHERE  role_code = admin AND tenant_id NOT IN (super,ifckxwyk,tyq4gj2z);
 DECLARE CONTINUE HANDLER FOR NOT FOUND SET stopflag=1; 
 SELECT t.id, t.func_id ,t.parent_id,t.sort,t.name INTO menuid, menufuncid,menuparentid,menusort,menuname FROM wb_app_menu t WHERE t.func_id = funcId AND t.tenant_id = tyq4gj2z;  
 
 OPEN username_cur;
 FETCH username_cur INTO tenantCode,tenantId;
 WHILE(stopflag=0) DO
 INSERT INTO  `wb_app_menu` (`id`, `func_id`, `icon`, `isenable`, `isvisible`, `is_virtual_node`, 
 `parent_id`, `classify`, `layout_id`, `sort`, `create_time`, `name`, `tenant_id`, `version`, `label`, `ts`, `dr`, `openview`, `name2`, `name3`, `name4`, `name5`, `name6`) 
 VALUES (REPLACE(CONCAT(tenantCode,menuid),ztegystest2,‘‘), menufuncid, grey iconfont icon-appicon, Y, Y, N, 
 REPLACE(CONCAT(tenantCode,menuparentid),ztegystest2,‘‘), NULL, menufuncid, menusort, NOW(), menuname, 
 tenantId, 1, NULL, NULL, NULL, curnpage, NULL, NULL, ‘‘, ‘‘, ‘‘);
 
 FETCH username_cur INTO tenantCode,tenantId; 
 END WHILE; 
 CLOSE username_cur;
END $$;

 

以上是关于IUAP平台新增菜单存储过程的主要内容,如果未能解决你的问题,请参考以下文章

用友iuap云运维平台支持基于K8s的微服务架构

iUAP云运维平台v3.0全面支持基于K8s的微服务架构

IUAP--单点登录

sublimetext3中保存代码片段

新增API数据源支持,支持透视表组件,DataEase开源数据可视化分析平台v1.8.0发布

平台搜集汇总