
#20200716

update module_menu set active=true;
#建议管理
update `module_menu` SET active = false where parentIds like '%732616410378797056%';
#保安员资格证考试报名
update `module_menu` SET active = false where parentIds like '%733352748115820544%';
update `module_menu` SET active = false where parentIds like '%764133525577269248%';
#保安员数据查询
update module_menu set active=false where id=732609308805562368;
#保安服务公司保安员信息
update module_menu set active=false where id=732608465016455168;
update module_menu set active=false where parentIds like '%732608465016455168%';
#保安服务公司保安员信息 end

UPDATE `module_menu` SET `rankAuth`='0';
#资格证学员考培信息
UPDATE `module_menu` SET `rankAuth`='0' WHERE (`id`='694547779166404608');
#保安员资格证打印
UPDATE `module_menu` SET `rankAuth`='0' WHERE (`id`='694547922036981760');

#保安培训机构许可证打印
update module_menu t1,config t2
set t1.location='iframe/certificate/train/list.jsp'
where t1.uniqueId='trainCertificate'
and t2.`key`='current_native'
and t2.`value` not in ('11','45');

update module_menu t1,config t2
set t1.location='trainCertificate/toQueryPage.do'
where t1.uniqueId='trainCertificate'
and t2.`key`='current_native'
and t2.`value` in ('11','45');
#保安培训机构许可证打印 end

#保安服务公司许可证打印
update module_menu t1,config t2
set t1.location='iframe/certificate/company/list.jsp'
where t1.uniqueId='comCertificate'
and t2.`key`='current_native'
and t2.`value` not in ('11','45');

update module_menu t1,config t2
set t1.location='companyCertificate/list/index.do'
where t1.uniqueId='comCertificate'
and t2.`key`='current_native'
and t2.`value` in ('11','45');
#保安服务公司许可证打印 end

#本市保安服务公司设立分公司备案
update module_menu t1,config t2
set t1.`name` = t2.`value`
where t1.uniqueId='subsidiaryList'
and t2.`key`='subsidiaryTitle';

#外省保安跨区服务设立分公司备案
update module_menu t1,config t2
set t1.`name` = t2.`value`
where t1.uniqueId='crosscompanyList'
and t2.`key`='crosscompanyTitle';

#保安服务（培训）许可证项目变更审核
update module_menu t1,config t2
set t1.`name` = t2.`value`
where t1.uniqueId='legalchangeList'
and t2.`key`='legalchangeTile';

#资格证 录入成绩
update module_menu t1,config t2
set t1.active=FALSE
where permission in('personcertificate:examPersonMark')
and t2.`key`='current_native'
and t2.`value` not in ('64','61');

#保安员资格证打印记录 领取 查询 导出
update module_menu t1,config t2
set t1.active=FALSE
where permission in('certificatePrintLogManager:query','certificatePrintLogManager:exprot','personcertificatePrint:receive')
and t2.`key`='current_native'
and t2.`value` not in ('11');

#获取指纹卡号 缴费确认
update module_menu t1,config t2
set t1.active=FALSE
where permission in('personcertificate:fingerprint','personcertificate:payConfirm')
and t2.`key`='current_native'
and t2.`value` not in ('45','61');

#考试安排 补考人员 批量审批通过 录入指纹
update module_menu t1,config t2
set t1.active=FALSE
where permission in('examinationarrange:query','personmakeup:query','todoList:batchApproval','personcertificate:enterFingerprint')
and t2.`key`='current_native'
and t2.`value` not in ('45');

#疫情防控信息动态
update module_menu t1,config t2
set t1.active=FALSE
where uniqueId='epidemicManager'
and t2.`key`='current_native'
and t2.`value` not in ('11');

#好差评管理
update module_menu t1,config t2
set t1.active=FALSE
where parentIds like '%772822184108982272%'
and t2.`key`='current_native'
and t2.`value` not in ('11');

#自招单位状态变更日志
update module_menu t1,config t2
set t1.active=FALSE
where parentIds like '%773599869612068864%'
and t2.`key`='current_native'
and t2.`value` not in ('11');

#从事武装守护押运服务的保安员的枪支培训机构备案
update module_menu t1,config t2
set t1.active=FALSE
where parentIds like '%764133525577269248%'
and t2.`key`='current_native'
and t2.`value` in ('11');

#保安员职业技能等级管理
update module_menu t1,config t2
set t1.active=FALSE
where parentIds like '%694538754991325184%'
and t2.`key`='current_native'
and t2.`value` not in ('11');

#保安员资格证考试报名
update module_menu t1,config t2
set t1.active=true
where parentIds like '%733352748115820544%'
and t2.`key`='current_native'
and t2.`value` not in ('11');

#保安服务公司设立分公司备案
update module_menu t1,config t2
set t1.active=false
where parentIds like '%733352748933709824%'
and t2.`key`='current_native'
and t2.`value` not in ('11');

#枪支培训备案
update module_menu t1,config t2
set t1.active=false
where parentIds like '%732606871369678848%'
and t2.`key`='current_native'
and t2.`value` not in ('61');

update module_menu t1,config t2
set t1.active=false
where parentIds like '%733352600161746944%'
and t2.`key`='current_native'
and t2.`value` not in ('61');
#枪支培训备案 end

#补贴申请管理
update module_menu t1,config t2
set t1.active=FALSE
where parentIds like '%732603140909563904%'
and t2.`key`='current_native'
and t2.`value` not in ('11');

#保安师管理
update module_menu t1,config t2
set t1.active=FALSE
where parentIds like '%732611466363928576%'
and t2.`key`='current_native'
and t2.`value` not in ('11');

#旧系统数据查询
update module_menu t1,config t2
set t1.active=FALSE
where parentIds like '%694539243342528512%'
and t2.`key`='current_native'
and t2.`value` not in ('11');

#会议管理
update module_menu t1,config t2
set t1.active=FALSE
where parentIds like '%694539104691421184%'
and t2.`key`='current_native'
and t2.`value` not in ('11');

#比对人员申诉
update module_menu t1,config t2
set t1.active=FALSE
where parentIds like '%694539977853239296%'
and t2.`key`='current_native'
and t2.`value` not in ('11');

#等级证管理
update module_menu t1,config t2
set t1.active=FALSE
where parentIds like '%732611562472210432%'
and t2.`key`='current_native'
and t2.`value` not in ('11');

#比对人员
update module_menu t1,config t2
set t1.active=FALSE
where parentIds like '%732611660618924032%'
and t2.`key`='current_native'
and t2.`value` not in ('11');

#好差评管理
update module_menu t1,config t2
set t1.active=FALSE
where parentIds like '%772822184108982272%'
and t2.`key`='current_native'
and t2.`value` not in ('11');

#超管企业端
update module_menu t1,config t2
set t1.active=FALSE
where parentIds like '%732620811784945664%'
and t2.`key`='current_native'
and t2.`value` not in ('11');

#保安员证联名卡换发查询
update module_menu t1,config t2
set t1.active=FALSE
where parentIds like '%737302384471965696%'
and t2.`key`='current_native'
and t2.`value` not in ('11');

#资格证学习记录查询
update module_menu t1,config t2
set t1.active=FALSE
where parentIds like '%753300887044096000%'
and t2.`key`='current_native'
and t2.`value` not in ('11');

#等级证学习记录查询
update module_menu t1,config t2
set t1.active=FALSE
where parentIds like '%753301142326214656%'
and t2.`key`='current_native'
and t2.`value` not in ('11');

#保安员分析
update module_menu t1,config t2
set t1.active=FALSE
where parentIds like '%732609106451365888%'
and t2.`key`='current_native'
and t2.`value` in ('11');

#保安服务公司设立分公司备案
update module_menu t1,config t2
set t1.active=FALSE
where parentIds like '%733352598991536128%'
and t2.`key`='current_native'
and t2.`value` in ('61');

#资格证 上传头像
update module_menu t1,config t2
set t1.active=FALSE
where permission='personcertificatePrint:uploadImg'
and t2.`key`='current_native'
and t2.`value` in ('11');

#资格证学员考培信息 保安员资格证打印
update module_menu t1,config t2
set t1.rankAuth='1'
where t1.id in(694547779166404608,694547922036981760)
and t2.`key`='current_native'
and t2.`value` in ('11');

#确认成绩 录入成绩
update module_menu t1,config t2
set t1.intranetFlag=0
where permission in('personcertificate:scoreConfirm','personcertificate:examPersonMark')
and t2.`key`='current_native'
and t2.`value` in ('61');

update module_menu t1,config t2
set t1.intranetFlag=1
where permission in('personcertificate:scoreConfirm','personcertificate:examPersonMark')
and t2.`key`='current_native'
and t2.`value` in ('64');

update module_menu t1,config t2
set t1.active=FALSE
where permission in('personcertificate:scoreConfirm','personcertificate:examPersonMark')
and t2.`key`='current_native'
and t2.`value` in ('45','11');
#确认成绩 录入成绩 end

#资格证打回
update module_menu t1,config t2
set t1.active=FALSE
where permission in('personcertificate:repulse')
and t2.`key`='current_native'
and t2.`value` in ('11');


INSERT INTO `module_permission` (`active`, `updateflag`, `create_time`, `update_time`, `update_by`, `roleId`, `moduleMenuId`)
select DISTINCT true,false,now(),now(),'system',t2.role_id,t1.id from module_menu t1,
(
select t3.*,CONCAT(t1.`code`,':',t2.`code`) as permission from module t1,operation t2,permission t3
where t1.active=true
and t1.id = t2.module_id
and t2.active=TRUE
and t2.id = t3.operation_id
)t2
where t1.active=true
and t1.menuType=1
and t1.permission = t2.permission
;


INSERT INTO `module_permission` (`active`, `updateflag`, `create_time`, `update_time`, `update_by`, `roleId`, `moduleMenuId`)
select DISTINCT true,false,now(),now(),'system',t2.roleId,substr(t1.parentIds,1,18)
from module_menu t1,module_permission t2
where t1.active=true and t1.id = t2.moduleMenuId
and t2.active=true
and substr(t1.parentIds,1,18) !=''
and substr(t1.parentIds,1,18) != t1.id
;

INSERT INTO `module_permission` (`active`, `updateflag`, `create_time`, `update_time`, `update_by`, `roleId`, `moduleMenuId`)
select DISTINCT true,false,now(),now(),'system',t2.roleId,substr(t1.parentIds,20,18)
from module_menu t1,module_permission t2
where t1.active=true and t1.id = t2.moduleMenuId
and t2.active=true
and substr(t1.parentIds,20,18) !=''
and substr(t1.parentIds,20,18) != t1.id
;

INSERT INTO `module_permission` (`active`, `updateflag`, `create_time`, `update_time`, `update_by`, `roleId`, `moduleMenuId`)
select DISTINCT true,false,now(),now(),'system',t2.roleId,substr(t1.parentIds,39,18)
from module_menu t1,module_permission t2
where t1.active=true and t1.id = t2.moduleMenuId
and t2.active=true
and substr(t1.parentIds,39,18) !=''
and substr(t1.parentIds,39,18) != t1.id
;

update module_permission t1,(SELECT roleId,moduleMenuId,MAX(id) as id,COUNT(1) as num from module_permission where active=true group by roleId,moduleMenuId HAVING count(1)>1) t2
set t1.active=false
where t1.roleId = t2.roleId and t1.moduleMenuId = t2.moduleMenuId and t1.id != t2.id
and t1.active=true
;

delete from module_permission where active=false;


#20200716 end

#20200805 start

update person_black_list t1,police t2
set t1.areaCode = t2.areacode
where t1.orgId = t2.id;

#20200805 end
