zoukankan      html  css  js  c++  java
  • IUAP平台新增菜单存储过程

    功能管理表wb_app_apps

    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 $$;

    标签表wb_label_relation

    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 $$;

    角色表ieop_role_permission

    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 $$;

    菜单表wb_app_menu

    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 $$;
  • 相关阅读:
    程序员保持快乐活跃的6个好习惯(转)
    Spring MVC Hello World Example(转)
    Oracle定时执行存储过程(转)
    各种常见数据库分页实现(转)
    Linux SSH常用总结(转)
    让人深思......
    void及void指针含义的深刻解析
    UVa 11988
    网络编程学习小结
    Deep Learning(深度学习) 学习笔记(四)
  • 原文地址:https://www.cnblogs.com/xiaoxiong2015/p/12675114.html
Copyright © 2011-2022 走看看