
-- 广西才执行
INSERT INTO `sys_dict` ( `isActive`, `updateTime`, `updateflag`, `codeType`, `tableName`, `description`, `codeValue`, `label`, `seq`)
VALUES ( '1', '2020-09-14 10:10:27', '', 'businessType', NULL, '业务类型', '015', '保安员证核发', '15');

-- 菜单 SQL
INSERT INTO `module_menu`(`id`, `active`, `createTime`, `updateTime`, `updateBy`, `location`, `name`, `parentId`, `seq`, `menuType`,  `permission`, `parentIds`, `uniqueId`, `intranetFlag`, `superAdmin`, `platform`, `rankAuth`)
VALUES ('1014831080562282496',true, now(), now(), 'system', '/perCerGrant/list/index.do', '保安员证核发', '694550061249462272', '1000','0', NULL, '694538890723196928/694550061249462272/1014831080562282496/', 'perCerGrantList', '2', '0', '1', '1'),
       ('1014831080570671104', true, now(), now(), 'system', NULL, '保安员证核发查询', '1014831080562282496', '1', '1','perCerGrant:view', '694538890723196928/694550061249462272/1014831080562282496/1014831080570671104/', NULL, '2', '0', '1', '1');


insert into module_permission(active,updateflag,create_time,update_time,update_by,roleId,moduleMenuId)
select DISTINCT 1,0,now(),now(),'system',roleId,'1014831080562282496' from module_permission where moduleMenuId='694547922036981760';

insert into module_permission(active,updateflag,create_time,update_time,update_by,roleId,moduleMenuId)
select DISTINCT 1,0,now(),now(),'system',roleId,'1014831080570671104' from module_permission where moduleMenuId='694547922036981760';


insert into approve_temp(id,`active`, `create_time`, `update_time`, `update_by`, `tempName`, `tempCode`, `iconUrl`, `approveType`, `effectTime`, `failureTime`, `approveSetStatus`, `noticeTemp`, `repulseExplain`, `seq`, `approveGroupId`, `policeId`, `parentPoliceId`, `parentTempId`)
select 100,`active`, now(), now(), `update_by`, '保安员证核发', REPLACE(`tempCode`,'activitisponsorlicenseapprovalProcess','activitiPerCerGrantapprovalProcess'), `iconUrl`, `approveType`, null, null, 0, `noticeTemp`, `repulseExplain`, `seq`, `approveGroupId`, `policeId`, `parentPoliceId`, null
from approve_temp where tempCode like 'activitisponsorlicenseapprovalProcess' and active=1;


insert into approve_temp(`active`, `create_time`, `update_time`, `update_by`, `tempName`, `tempCode`, `iconUrl`, `approveType`, `effectTime`, `failureTime`, `approveSetStatus`, `noticeTemp`, `repulseExplain`, `seq`, `approveGroupId`, `policeId`, `parentPoliceId`, `parentTempId`)
select `active`, now(), now(), `update_by`, '保安员证核发', REPLACE(`tempCode`,'activitisponsorlicenseapprovalProcess','activitiPerCerGrantapprovalProcess'), `iconUrl`, `approveType`, null, null, 0, `noticeTemp`, `repulseExplain`, `seq`, `approveGroupId`, `policeId`, `parentPoliceId`, 100
from approve_temp where tempCode like 'activitisponsorlicenseapprovalProcess-%' and active=1;


INSERT INTO approve_temp_link_rela (create_time, active, updateflag, approveLinkId, approveTempId, seq, createType )
select now(),1,1,2,id,1,0 from approve_temp t1 where tempCode like 'activitiPerCerGrantapprovalProcess'
                                                 and not EXISTS( select 1 from approve_temp_link_rela t2 where t2.approveTempId = t1.id and active=1 )
;
