SET FOREIGN_KEY_CHECKS=0;

ALTER TABLE `reductionservice`.`charging_discount_park_info` AUTO_INCREMENT = 44;

ALTER TABLE `reductionservice`.`charging_discount_thirdparty_info` AUTO_INCREMENT = 1;

ALTER TABLE `reductionservice`.`charging_info_star` AUTO_INCREMENT = 46;

ALTER TABLE `reductionservice`.`charging_info_xj` AUTO_INCREMENT = 51;

ALTER TABLE `reductionservice`.`charging_info_xj` DROP INDEX `idx_car_in_id`;

ALTER TABLE `reductionservice`.`charging_info_xj` ADD INDEX `idx_car_in_d`(`car_in_id` ASC) USING BTREE;

ALTER TABLE `reductionservice`.`charging_reduction_info` AUTO_INCREMENT = 139;

CREATE TABLE `reductionservice`.`rd_activity_print`  (
  `id` bigint NOT NULL COMMENT 'ID',
  `activity_code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '活动编号',
  `reduction_number` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '打印序号',
  `startDate` datetime NULL DEFAULT NULL COMMENT '有效开始时间',
  `exDate` datetime NULL DEFAULT NULL COMMENT '有效结束时间',
  `createTime` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `isdelete` int NULL DEFAULT NULL COMMENT '删除标识',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '物业减免方案打印明细' ROW_FORMAT = DYNAMIC;

CREATE TABLE `reductionservice`.`rd_customer_activity`  (
  `id` bigint(20) UNSIGNED ZEROFILL NOT NULL AUTO_INCREMENT COMMENT '主键',
  `project_no` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '项目编号',
  `park_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '车场Id',
  `activity_code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '活动编号',
  `activity_name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '活动名称',
  `total_number` int NULL DEFAULT NULL COMMENT '活动数量',
  `used_number` int NULL DEFAULT NULL COMMENT '使用数量',
  `print_number` int NULL DEFAULT NULL COMMENT '打印数量',
  `activity_status` int NULL DEFAULT NULL COMMENT '活动状态  0|启用，1|未启用，2|已到期',
  `delete_flag` int NULL DEFAULT NULL COMMENT '删除状态，0|正常，1|删除',
  `starttime` datetime NULL DEFAULT NULL COMMENT '开始时间',
  `endtime` datetime NULL DEFAULT NULL COMMENT '结束时间',
  `qrcode_flash_time` int NULL DEFAULT NULL COMMENT '动态二维码刷新时间',
  `create_user` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建用户',
  `createdate` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `update_user` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '修改用户',
  `update_date` datetime NULL DEFAULT NULL COMMENT '修改时间',
  `reduction_code` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '减免方案编号',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '客户端：物业减免活动信息' ROW_FORMAT = DYNAMIC;

ALTER TABLE `reductionservice`.`rd_customer_reduction` MODIFY COLUMN `allow_outsite_get` int NULL DEFAULT 0 COMMENT '是否允许场外领取优惠券' AFTER `intra_day_flag`;

ALTER TABLE `reductionservice`.`rd_merchant` AUTO_INCREMENT = 356;

ALTER TABLE `reductionservice`.`rd_merchant` DROP INDEX `idx_project_no_park_id_createtime`;

ALTER TABLE `reductionservice`.`rd_merchant` MODIFY COLUMN `merchant_type` int NOT NULL DEFAULT (0) COMMENT '商户类型 0-普通商户 1-物业' AFTER `user_id`;

ALTER TABLE `reductionservice`.`rd_merchant` MODIFY COLUMN `enable_freeze` int NULL DEFAULT 0 COMMENT '是否启用账户余额冻结功能；0-否，1-是；' AFTER `freeze_credit`;

CREATE TABLE `reductionservice`.`rd_merchant_pay_order_record`  (
  `id` bigint NOT NULL,
  `project_no` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '项目ID',
  `park_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '车场ID',
  `park_name` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '车场名称',
  `merchant_code` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '商家编号',
  `biz_type` int NOT NULL COMMENT '业务类型(1-商户充值)',
  `biz_id` bigint NOT NULL COMMENT '业务ID',
  `payment_order_id` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '支付订单id',
  `merchant_order_id` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '商户订单id',
  `member_id` bigint NOT NULL COMMENT '移动端会员ID',
  `should_payment` bigint NOT NULL COMMENT '应付金额 单位/分',
  `actual_payment` bigint NOT NULL COMMENT '实际金额 单位/分',
  `create_time` datetime NOT NULL COMMENT '创建时间',
  `pay_callback_time` datetime NULL DEFAULT NULL COMMENT '支付回调时间',
  `pay_way_code` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '支付方式',
  `payment_status` int NOT NULL DEFAULT 0 COMMENT '支付状态(0-待付费/1-成功/2-失败)',
  `remark` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注',
  `extend_json` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '扩展json字段',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `IX_paymentOrderId`(`payment_order_id` ASC) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '减免商户支付订单记录表' ROW_FORMAT = Dynamic;

ALTER TABLE `reductionservice`.`rd_merchant_present_record` AUTO_INCREMENT = 0;

ALTER TABLE `reductionservice`.`rd_merchant_present_record` MODIFY COLUMN `id` bigint NOT NULL COMMENT '主键id' FIRST;

ALTER TABLE `reductionservice`.`rd_merchant_reduction` AUTO_INCREMENT = 657;

ALTER TABLE `reductionservice`.`rd_merchant_reduction` DROP INDEX `idx_project_no_createtime`;

ALTER TABLE `reductionservice`.`rd_merchant_reduction` ADD INDEX `idx_project_no_createtime`(`project_no` ASC, `create_time` DESC) USING BTREE;

ALTER TABLE `reductionservice`.`rd_merchant_timing_present_rule` AUTO_INCREMENT = 0;

ALTER TABLE `reductionservice`.`rd_merchant_timing_present_rule` ADD COLUMN `last_send_time` datetime NULL DEFAULT '2000-01-01 00:00:00' COMMENT '最后执行赠送时间；默认为2000-01-01' AFTER `expired_day`;

ALTER TABLE `reductionservice`.`rd_merchant_timing_present_rule` MODIFY COLUMN `id` bigint NOT NULL COMMENT '主键id' FIRST;

ALTER TABLE `reductionservice`.`rd_owner_unverified` AUTO_INCREMENT = 2084846658463465473;

ALTER TABLE `reductionservice`.`rd_reduction_activity` AUTO_INCREMENT = 2080227010895986689;

ALTER TABLE `reductionservice`.`rd_reduction_activity` DROP INDEX `idx_merchant_code_createtime`;

ALTER TABLE `reductionservice`.`rd_reduction_activity` ADD INDEX `idx_merchant_code_createtime`(`merchant_code` ASC, `create_time` DESC) USING BTREE;

ALTER TABLE `reductionservice`.`star_park_charge_result` AUTO_INCREMENT = 1;

ALTER TABLE `reductionservice`.`tld_reduction` AUTO_INCREMENT = 48;

SET FOREIGN_KEY_CHECKS=1;