ALTER TABLE `itax_base`.`sys_user` ADD COLUMN `user_type` int(10) NULL DEFAULT NULL COMMENT '用户类型 1 超管 2 普通用户 3 管理员' AFTER `user_source`;

ALTER TABLE `itax_base`.`sys_user` ADD COLUMN `tenant_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '客户ID' AFTER `user_type`;

ALTER TABLE `itax_base`.`sys_user` ADD COLUMN `distributor_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '渠道ID' AFTER `tenant_id`;

ALTER TABLE `itax_base`.`sys_user` ADD COLUMN `omp_dept_id` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL AFTER `distributor_id`;



ALTER TABLE `itax_base`.`sys_role_menu` MODIFY COLUMN `menu_id` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '菜单ID' AFTER `role_id`;

ALTER TABLE `itax_base`.`sys_role` ADD COLUMN `omp_dept_id` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '映射部门id' AFTER `role_type`;

ALTER TABLE `itax_base`.`sys_role` ADD COLUMN `tenant_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '客户ID' AFTER `omp_dept_id`;

ALTER TABLE `itax_base`.`sys_menu` ADD COLUMN `tenant_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '客户ID' AFTER `puser_id`;

ALTER TABLE `itax_base`.`sys_menu` ADD COLUMN `remark` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注' AFTER `tenant_id`;

ALTER TABLE `itax_base`.`sys_manager_info` ADD COLUMN `tenant_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '客户ID' AFTER `cascade_flag`;

ALTER TABLE `itax_base`.`sys_dept` MODIFY COLUMN `parent_id` bigint(20) NULL DEFAULT 0 COMMENT '上级部门ID，一级部门为0' AFTER `dept_id`;

ALTER TABLE `itax_base`.`sys_dept` MODIFY COLUMN `taxpayer_code` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '纳税人税号' AFTER `level`;

ALTER TABLE `itax_base`.`sys_dept` ADD COLUMN `source_id` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '渠道信息' AFTER `invoice_nsrsbh`;

ALTER TABLE `itax_base`.`sys_dept` ADD COLUMN `tenant_id` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '1' COMMENT '租户id' AFTER `source_id`;

ALTER TABLE `itax_base`.`sys_dept` ADD COLUMN `omp_dept_id` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '中台企业id' AFTER `tenant_id`;

ALTER TABLE `itax_base`.`sys_dept` ADD COLUMN `omp_parent_id` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '中台父级企业id' AFTER `omp_dept_id`;

ALTER TABLE `itax_base`.`area_code` MODIFY COLUMN `area_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '地区名称' AFTER `area_code`;

ALTER TABLE `itax_base`.`area_code` MODIFY COLUMN `area_region` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '区' AFTER `remark`;



UPDATE `itax_base`.`sys_user` SET user_type = '3',tenant_id = '1',distributor_id = '1',omp_dept_id = '1' WHERE	ifnull(manager_id,'') ='';
UPDATE `itax_base`.`sys_user` SET user_type = '2',tenant_id = '1',distributor_id = '1',omp_dept_id = '1' WHERE	ifnull(manager_id,'') <>'';
UPDATE `itax_base`.`sys_user` SET user_type = '2',tenant_id = '1',distributor_id = '1',omp_dept_id = '1' WHERE	user_id =1
update `itax_base`.`sys_role` set tenant_id='1',omp_dept_id='1' ;
update `itax_base`.`sys_dept` set source_id='1',tenant_id='1',omp_dept_id='1' ,omp_parent_id='1';
update `itax_base`.`sys_manager_info` set tenant_id='1';
update `itax_base`.`sys_menu` set tenant_id='1';


update  sys_menu set url = REPLACE(url,'http://itax-pre.ele-cloud.com:10000/itax-base/#','http://itax-pre.ele-cloud.com:10000/itax-base/index.html#') where url is not null