ALTER TABLE `mallink`.`wx_rent_contract` 
ADD COLUMN `revenue_ratio` int(1) NOT NULL DEFAULT 1 COMMENT '是否设置保底营业额,1-设置 0-不设置' AFTER `revenue`;

ALTER TABLE `mallink`.`wx_rent_contract` 
ADD COLUMN `revenue_year` JSON  COMMENT '每年保底营业额' AFTER `revenue_ratio`;

ALTER TABLE `mallink`.`wx_rent_contract` 
ADD COLUMN `revenue_ratio_way` int(1)  COMMENT '联营扣点调整方式1按比例2按金额（仅联营面积取高时用）' AFTER `adjust_ratio_way`;

ALTER TABLE `mallink`.`wx_rent_contract` 
ADD COLUMN `revenue_ratio_set` JSON  COMMENT '联营扣点调整比率（仅联营面积取高时用）' AFTER `revenue_ratio_way`;

ALTER TABLE `mallink`.`wx_rent_contract` 
ADD COLUMN `end_contract_time` datetime  COMMENT '终止时间';

ALTER TABLE `mallink`.`wx_property_contract` 
ADD COLUMN `end_contract_time` datetime  COMMENT '终止时间';

ALTER TABLE `mallink`.`wx_rent_contract` 
ADD COLUMN `bussiness_management_fee` bigint(12)  COMMENT '商业管理费';

ALTER TABLE `mallink`.`wx_rent_contract` 
ADD COLUMN `bussiness_management_fee_ratio_way` int(1)  COMMENT '商业管理费调整方式1按比例2按金额';

ALTER TABLE `mallink`.`wx_rent_contract` 
ADD COLUMN `bussiness_management_fee_ratio` JSON  COMMENT '商业管理费调整比率' ;

ALTER TABLE `mallink`.`wx_rent_contract` 
ADD COLUMN `operating_management_fee` bigint(12)  COMMENT '营业管理费';

ALTER TABLE `mallink`.`wx_rent_contract` 
ADD COLUMN `operating_management_fee_ratio_way` int(1)  COMMENT '营业管理费调整方式1按比例2按金额';

ALTER TABLE `mallink`.`wx_rent_contract` 
ADD COLUMN `operating_management_fee_ratio` JSON  COMMENT '营业管理费调整比率' ;

ALTER TABLE `mallink`.`wx_rent_contract` 
ADD COLUMN `out_date_notify_days` INT(3) NOT NULL DEFAULT 0 COMMENT '到期提醒提前天数' ;

ALTER TABLE `mallink`.`wx_rent_contract` 
ADD COLUMN `out_date_notify_phone` varchar(30)  COMMENT '到期提醒手机号' ;


ALTER TABLE `mallink`.`wx_bill_rent` 
ADD COLUMN `bussiness_manage_fee_need_pay` bigint(12)  COMMENT '商业管理费应收'  AFTER `need_pay`;

ALTER TABLE `mallink`.`wx_bill_rent` 
ADD COLUMN `operating_manage_fee_need_pay` bigint(12)  COMMENT '营业管理费应收'  AFTER `need_pay`;

#CREATE TABLE `wx_msg_validationcode_model_tenant` (
#  `id` bigint(20) NOT NULL COMMENT '主键ID',
#  `tenant_id` varchar(5) COLLATE utf8mb4_unicode_ci NOT NULL,
#  `parent_tenant_id` varchar(5) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
#  `model_id` bigint(20) NOT NULL COMMENT '关联的模板编号',
#  `signature` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '签名',
#  `model_code` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '模版code',
#  `content` text COLLATE utf8mb4_unicode_ci COMMENT '如内容有修改，可设置',
#  `sms_channel` int(1) NOT NULL COMMENT '发短信通道EnumSMSChannel',
#  PRIMARY KEY (`id`),
#  UNIQUE KEY `id_UNIQUE` (`id`),
#  UNIQUE KEY `UNIQUE_T_T` (`tenant_id`,`model_id`)
#) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC COMMENT='短信模板';
//金茂的短信加入到这个表记录中

delete from wx_msg_validationcode_model where tenant_id != '789';
ALTER TABLE wx_msg_validationcode_model DROP COLUMN tenant_id; 
ALTER TABLE wx_msg_validationcode_model DROP COLUMN parent_tenant_id;
ALTER TABLE wx_msg_validationcode_model DROP COLUMN model_id;

ALTER TABLE wx_msg_model DROP COLUMN model_id;


ALTER TABLE `mallink`.`wx_property_contract` 
ADD COLUMN `out_date_notify_days` INT(3) NOT NULL DEFAULT 0 COMMENT '到期提醒提前天数' ;

ALTER TABLE `mallink`.`wx_property_contract` 
ADD COLUMN `out_date_notify_phone` varchar(30)  COMMENT '到期提醒手机号' ;


CREATE TABLE `wx_bill_rent_manage` (
  `id` bigint(20) NOT NULL COMMENT '主键ID',
  `rent_contract_id` bigint(20) DEFAULT NULL COMMENT '租金合同ID',
  `receive_pay` bigint(12) NOT NULL DEFAULT '0' COMMENT '实际应收',
  `pay` bigint(12) NOT NULL DEFAULT '0' COMMENT '已付',
  `receive_date` datetime DEFAULT NULL COMMENT '收款日期',
  `pay_date` datetime DEFAULT NULL COMMENT '到账日期',
  `createtime` datetime DEFAULT NULL COMMENT '创建时间',
  `expired_day` int(5) DEFAULT NULL COMMENT '逾期天数',
  `tenant_id` varchar(5) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '租户ID',
  `parent_tenant_id` varchar(5) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '父租户ID',
  `owe` bigint(12) NOT NULL DEFAULT '0' COMMENT '欠缴',
  `status` smallint(2) DEFAULT '4' COMMENT '账单状态1欠缴2待缴3已结清4未到期5已退还6失效',
  `is_del` smallint(2) DEFAULT NULL COMMENT '是否删除 是1否0 未到期不显示',
  `need_pay` bigint(12) NOT NULL DEFAULT '0' COMMENT '应收',
  `merchant_id` bigint(20) DEFAULT NULL COMMENT '商户ID',
  `user_id` bigint(20) DEFAULT NULL COMMENT '账号ID',
  `shop_id` bigint(20) DEFAULT NULL COMMENT '商铺ID',
  `updatetime` datetime DEFAULT NULL COMMENT '更新时间',
  `starttime` datetime DEFAULT NULL COMMENT '账单开始日期',
  `endtime` datetime DEFAULT NULL COMMENT '账单结束日期',
  `rent_shop_type` smallint(2) DEFAULT '1' COMMENT '租赁店铺类型1店铺2点位',
  `late_pay_ratio` int(10) DEFAULT '0' COMMENT '滞纳金费率',
  `late_pay_time` datetime DEFAULT NULL COMMENT '滞纳金时间',
  `late_pay_price` bigint(12) DEFAULT NULL,
  `period` int(10) DEFAULT '0' COMMENT '账期',
  `apply_status` smallint(1) DEFAULT '0' COMMENT '审核状态0未审核1审核中2审核完成3驳回4合同作废5撤回',
  `pay_way` smallint(2) DEFAULT '-1',
  `late_pay_status` smallint(2) DEFAULT '2' COMMENT '滞纳金状态(使用账单的状态)',
  `freeze` smallint(1) DEFAULT '0' COMMENT '0正常1冻结',
  `service_charge_pay` bigint(12) DEFAULT '0' COMMENT '手续费费',
  `apply_pay_img` varchar(1000) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '付款截图',
  `apply_update_time` datetime DEFAULT NULL COMMENT '审核更新时间',
  `shop_info` json DEFAULT NULL COMMENT '商铺信息',
  `manage_fee_type` int(1) NOT NULL COMMENT '管理费类型,EnumRentManageFeeType',
  PRIMARY KEY (`id`),
  KEY `st` (`rent_shop_type`),
  KEY `sta` (`status`),
  KEY `m` (`merchant_id`),
  KEY `s_e` (`starttime`,`endtime`),
  KEY `t_p_r_s_c` (`tenant_id`,`rent_shop_type`,`status`,`createtime`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC COMMENT='租金账单';

