--  等级证权限
delete from module where id =206;
delete  from  operation where module_id =206;
INSERT INTO `module` (`id`, `native_code`, `code`, `name`, `url`, `seq`, `index`, `shortcut`, `class`, `action`, `active`, `create_time`, `update_time`, `update_by`, `moduletype`, `p_id`) VALUES ('206', '3502', 'gradeManager', '等级证管理', '', '99', '\0', '\0', '', '', '', '2017-06-30 18:00:19', '2017-06-30 18:00:21', 'system', '1', '142');
INSERT INTO `operation` (`id`, `native_code`, `code`, `name`, `module_id`, `active`, `create_time`, `update_time`, `update_by`) VALUES ('415', '3502', 'query', '查询', '206', '', '2017-06-30 17:53:18', '2017-06-30 17:53:20', 'system');
INSERT INTO `operation` (`id`, `native_code`, `code`, `name`, `module_id`, `active`, `create_time`, `update_time`, `update_by`) VALUES ('416', '3502', 'export', '导出', '206', '', '2017-06-30 17:53:18', '2017-06-30 17:53:20', 'system');
-- 等级证全部授权
INSERT INTO`permission` (`native_code`, `role_id`, `module_id`, `operation_id`, `roletype`)
select '61',pr.id,o.module_id,o.id,'2' from police_role pr,police p,operation o
where pr.active=true
and p.active=TRUE
and o.active=TRUE
and pr.orgid=p.id
and o.id  in (415,416);


-- 更新人员信息表
update  security_person a ,grade_certificate b  set
a.profession_level = b.appraisalGrade,
a.credential =  b.certificateNo,
a.traincompanyname =  b.trainOrgName
 where a.id = b.personId ;


delete from `sys_dict` where `codeType`='appraisalGrade';
INSERT INTO `sys_dict` (`sysDictId`, `isActive`, `codeType`, `tableName`, `description`, `codeValue`, `label`, `seq`) VALUES (null, '1', 'appraisalGrade', NULL, '保安员等级', '1', '初级保安员', '1');
INSERT INTO `sys_dict` (`sysDictId`, `isActive`, `codeType`, `tableName`, `description`, `codeValue`, `label`, `seq`) VALUES (null, '1', 'appraisalGrade', NULL, '保安员等级', '2', '中级保安员', '2');
INSERT INTO `sys_dict` (`sysDictId`, `isActive`, `codeType`, `tableName`, `description`, `codeValue`, `label`, `seq`) VALUES (null, '1', 'appraisalGrade', NULL, '保安员等级', '3', '高级保安员', '3');
INSERT INTO `sys_dict` (`sysDictId`, `isActive`, `codeType`, `tableName`, `description`, `codeValue`, `label`, `seq`) VALUES (null, '1', 'appraisalGrade', NULL, '保安员等级', '4', '保安师', '4');
