#保安员所任职公司历史记录
CREATE TABLE `company_person_log` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `active` bit(1) DEFAULT NULL COMMENT '是否可用',
  `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  `update_time` datetime DEFAULT NULL COMMENT '修改时间',
  `update_by` varchar(255) DEFAULT NULL COMMENT '修改者',
  `company_name` varchar(255) DEFAULT NULL COMMENT '公司名称',
  `company_id` varchar(50) DEFAULT NULL COMMENT '公司id',
  `person_id` varchar(50) DEFAULT NULL COMMENT '保安员ID',
  `idnum` varchar(50) DEFAULT NULL COMMENT '身份证号',  
  PRIMARY KEY (`id`),
  KEY `ak_companypersonlog_key` (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT;

ALTER TABLE `security_person`
ADD COLUMN `incumbencyStatus`  varchar(5) NULL COMMENT '在职状态--- 0离职 1在职' AFTER `socialSecurity`;

update security_person sp,security_company_person scp set sp.incumbencyStatus='0'
where sp.id=scp.person_id and scp.active=0;


update security_person sp,security_company_person scp set sp.incumbencyStatus='1'
where sp.id=scp.person_id and scp.active=1;

ALTER TABLE `problemperson`
MODIFY COLUMN `sex`  varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '性别' AFTER `phone`;

ALTER TABLE `person_experience`
ADD COLUMN `idNum`  varchar(20) NULL COMMENT '身份证号' AFTER `can_del`,
ADD COLUMN `company_id`  int(11) NULL COMMENT '所属公司id' AFTER `idNum`;

