

UPDATE `module_menu` SET `rankAuth`='0';
UPDATE `module_menu` SET `rankAuth`='1' where parentIds like '%694575557966299136%';
UPDATE `module_menu` SET `rankAuth`='1' where parentIds like '%694575945264136192%';
UPDATE `module_menu` SET `rankAuth`='1' where parentIds like '%732608716993462272%';
UPDATE `module_menu` SET `rankAuth`='1' where parentIds like '%732608974628585472%';

UPDATE `module_menu` SET `rankAuth`='1' where parentIds like '%732611466363928576%';
UPDATE `module_menu` SET `rankAuth`='1' where parentIds like '%732611562472210432%';
UPDATE `module_menu` SET `rankAuth`='1' where parentIds like '%732611660618924032%';

UPDATE `module_menu` SET `rankAuth`='1' where parentIds like '%694539045811781632%';
UPDATE `module_menu` SET `rankAuth`='1' where parentIds like '%732615561946595328%';
UPDATE `module_menu` SET `rankAuth`='1' where parentIds like '%694539243342528512%';

TRUNCATE module_permission;


INSERT INTO `module_permission` (`active`, `updateflag`, `create_time`, `update_time`, `update_by`, `roleId`, `moduleMenuId`) 
select DISTINCT true,false,now(),now(),'system',t3.id,t1.id 
from module_menu t1,police t2,police_role t3 ,config t4
where t1.active=true 
and t4.`key`='police' 
and (t1.intranetFlag = t4.`value` or t1.intranetFlag = '2')
and t1.platform=1
and t1.superAdmin=0
and t2.active=true 
and t2.id = t3.orgid 
and t3.active=TRUE
and t2.orgtype in (1,2);

INSERT INTO `module_permission` (`active`, `updateflag`, `create_time`, `update_time`, `update_by`, `roleId`, `moduleMenuId`) 
select DISTINCT true,false,now(),now(),'system',t3.id,t1.id 
from module_menu t1,police t2,police_role t3 ,config t4
where t1.active=true 
and t4.`key`='police' 
and (t1.intranetFlag = t4.`value` or t1.intranetFlag = '2')
and t1.platform=1
and t1.superAdmin=0
and t2.active=true 
and t2.id = t3.orgid 
and t3.active=TRUE
and t1.parentIds not like '%694549704108670976%'
and t1.parentIds not like '%732603140909563904%'
and t1.parentIds not like '%732604919269294080%'
and t1.parentIds not like '%732605543444643840%'
and t1.parentIds not like '%694538360022106112%'
and t1.parentIds not like '%694548934000902144%'
and t1.parentIds not like '%694549704108670976%'
and t1.parentIds not like '%753301142326214656%'
and t1.parentIds not like '%732614255123103744%'
and t1.parentIds not like '%732614372093853696%'
and t1.parentIds not like '%732614036025245696%'
and t1.parentIds not like '%732613511464615936%'
and t1.parentIds not like '%732612942565998592%'
and t1.parentIds not like '%732611769683410944%'
and t1.parentIds not like '%732611335413563392%'
and t1.parentIds not like '%732610528425279488%'
and t1.parentIds not like '%732609928857911296%'
and t1.parentIds not like '%732608284715909120%'
and t1.parentIds not like '%694571326551097344%'
and t1.parentIds not like '%694572699673952256%'
and t1.parentIds not like '%732606485191720960%'
and t1.parentIds not like '%732603140909563904%'
and t2.orgtype in (3);

INSERT INTO `module_permission` (`active`, `updateflag`, `create_time`, `update_time`, `update_by`, `roleId`, `moduleMenuId`) 
select DISTINCT true,false,now(),now(),'system',t3.id,t1.id 
from module_menu t1,police t2,police_role t3 ,config t4
where t1.active=true 
and t4.`key`='police' 
and (t1.intranetFlag = t4.`value` or t1.intranetFlag = '2')
and t1.platform=1
and t1.superAdmin=0
and t2.active=true 
and t2.id = t3.orgid 
and t3.active=TRUE
and t1.parentIds not like '%694539977853239296%'
and t1.parentIds not like '%694549704108670976%'
and t1.parentIds not like '%732603140909563904%'
and t1.parentIds not like '%732604919269294080%'
and t1.parentIds not like '%732605543444643840%'
and t1.parentIds not like '%694538360022106112%'
and t1.parentIds not like '%694548934000902144%'
and t1.parentIds not like '%694549704108670976%'
and t1.parentIds not like '%753301142326214656%'
and t1.parentIds not like '%732614255123103744%'
and t1.parentIds not like '%732614372093853696%'
and t1.parentIds not like '%732614036025245696%'
and t1.parentIds not like '%732613511464615936%'
and t1.parentIds not like '%732612942565998592%'
and t1.parentIds not like '%732611769683410944%'
and t1.parentIds not like '%732611335413563392%'
and t1.parentIds not like '%732610528425279488%'
and t1.parentIds not like '%732609928857911296%'
and t1.parentIds not like '%732608284715909120%'
and t1.parentIds not like '%694571326551097344%'
and t1.parentIds not like '%694572699673952256%'
and t1.parentIds not like '%732606485191720960%'
and t1.parentIds not like '%694540043481513984%'
and t1.parentIds not like '%694538254522777600%'
and t1.parentIds not like '%694538360022106112%'
and t1.parentIds not like '%694538754991325184%'
and t1.parentIds not like '%732603140909563904%'
and t1.parentIds not like '%694538890723196928%'
and t1.parentIds not like '%732611466363928576%'
and t1.parentIds not like '%732611562472210432%'
and t1.parentIds not like '%732611660618924032%'
and t1.parentIds not like '%694539161234833408%'
and t1.parentIds not like '%694539243342528512%'
and t1.parentIds not like '%732616784246472704%'
and t1.parentIds not like '%732617080624381952%'
and t2.orgtype in (4);

INSERT INTO `module_permission` (`active`, `updateflag`, `create_time`, `update_time`, `update_by`, `roleId`, `moduleMenuId`) 
select DISTINCT true,false,now(),now(),'system',t3.id,t1.id 
from module_menu t1,police t2,police_role t3 ,config t4
where t1.active=true 
and t4.`key`='police' 
and (t1.intranetFlag = t4.`value` or t1.intranetFlag = '2')
and t1.platform=1
and t1.superAdmin=0
and t2.active=true 
and t2.id = t3.orgid 
and t3.active=TRUE
and t1.id in (733352406724640768,733352410600177664)
and t2.orgtype in (3);


