码迷,mamicode.com
首页 > 其他好文 > 详细

IUAP平台新增菜单存储过程

时间:2020-04-10 18:32:58      阅读:79      评论:0      收藏:0      [点我收藏+]

标签:int   menus   close   insert   concat   sys   mgr   sel   span   

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平台新增菜单存储过程

标签:int   menus   close   insert   concat   sys   mgr   sel   span   

原文地址:https://www.cnblogs.com/xiaoxiong2015/p/12675114.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!