CREATE TABLE IF NOT EXISTS `gy_jifenshangcheng_order`.`t_charge_order` (
	`order_number` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT '订单号',
	`order_type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '订单类型',
	`charge_type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '充电方式',
	`phone` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '充电用户（手机号）',
	`begin_time` datetime DEFAULT NULL COMMENT '开始时间',
	`end_time` datetime DEFAULT NULL COMMENT '结束时间',
	`charging_duration` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '充电时长',
	`charging_capacity` decimal(10, 3) DEFAULT NULL COMMENT '充电电量（度）',
	`power_station_operator` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '电站运营商',
	`city` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '城市名称',
	`charging_station` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '充电场站',
	`power_station_id` int DEFAULT NULL COMMENT '电站id',
	`terminal_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '充电终端',
	`plate_number` varchar(255) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '车牌号',
	`electricity_amount` decimal(10, 2) DEFAULT NULL COMMENT '电站价电费金额',
	`service_amount` decimal(10, 2) DEFAULT NULL COMMENT '电站价服务费金额',
	`total_amount` decimal(10, 2) DEFAULT NULL COMMENT '电站价总金额',
	`point` int DEFAULT NULL COMMENT '获得积分',
	PRIMARY KEY (`order_number`)
) ENGINE = InnoDB CHARSET = utf8mb4 COLLATE = utf8mb4_bin;

CREATE TABLE IF NOT EXISTS `gy_jifenshangcheng_order`.`t_order` (
	`id` bigint NOT NULL,
	`app_user_id` bigint DEFAULT NULL COMMENT '用户id',
	`num` int NOT NULL COMMENT '商品数量',
	`good_pics` text CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT '商品封面（多张逗号隔开，最多三张））',
	`good_name` text CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT '商品名称（多个名称逗号隔开））',
	`order_type` int DEFAULT NULL COMMENT '订单类型1服务单2商品',
	`order_status` int DEFAULT NULL COMMENT '1待发货2待收货3待使用4已完成5已取消6已退款7售后中8已评价',
	`old_order_status` int DEFAULT NULL COMMENT '1待发货2待收货3待使用4已完成5已取消6已退款7售后中8已评价',
	`is_commission` int DEFAULT '0' COMMENT '是否已分佣 0-否 1-是',
	`end_time` datetime DEFAULT NULL COMMENT '核销时间',
	`canceller_app_user_id` bigint DEFAULT NULL COMMENT '核销人id',
	`after_sale_time` datetime DEFAULT NULL COMMENT '售后截止日期',
	`technician_id` int DEFAULT NULL COMMENT '技师id',
	`order_number` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '订单编号',
	`total_amount` decimal(10, 2) DEFAULT NULL COMMENT '订单总金额',
	`full_reduction_amount` decimal(10, 2) DEFAULT NULL COMMENT '满减金额',
	`money_amount` decimal(10, 2) DEFAULT NULL COMMENT '代金券抵扣金额',
	`discount_amount` decimal(10, 2) DEFAULT NULL COMMENT '折扣券抵扣金额',
	`good_amount` decimal(10, 2) DEFAULT NULL COMMENT '商品券抵扣总金额',
	`user_coupon_id` bigint DEFAULT NULL COMMENT '用户优惠券id',
	`activity_amount` decimal(10, 2) DEFAULT NULL COMMENT '活动优惠金额',
	`discount_total_amount` decimal(10, 2) DEFAULT NULL COMMENT '优惠总金额',
	`payment_amount` decimal(10, 2) DEFAULT NULL COMMENT '实际支付价格',
	`point` int DEFAULT NULL COMMENT '使用积分',
	`pay_method` int DEFAULT NULL COMMENT '1微信，2账户余额，3积分，4组合支付',
	`coupon_json` text CHARACTER SET utf8mb4 COLLATE utf8mb4_bin COMMENT '使用的优惠劵json',
	`activity_json` text CHARACTER SET utf8mb4 COLLATE utf8mb4_bin COMMENT '订单优惠活动的json快照',
	`express_amount` decimal(10, 2) DEFAULT NULL COMMENT '运费',
	`express_pay_method` int DEFAULT NULL COMMENT '运费支付方式，1微信，2账户余额',
	`express_json` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT 'NULL' COMMENT '第三方快递信息',
	`express_result` text CHARACTER SET utf8mb4 COLLATE utf8mb4_bin COMMENT '第三方快递结果',
	`distribution_mode` int DEFAULT NULL COMMENT '配送方式（1=自提，2=快递）',
	`deliver_province` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '发货省名称',
	`deliver_province_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '发货省编号',
	`deliver_city` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '发货市名称',
	`deliver_city_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '发货市编号',
	`deliver_district` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '发货区名称',
	`deliver_district_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '发货区编号',
	`share_amount` decimal(10, 2) DEFAULT NULL COMMENT '平台分佣',
	`get_point` int DEFAULT NULL COMMENT '本单获取的积分',
	`serial_number` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '微信支付号',
	`pay_status` int DEFAULT NULL COMMENT '1待支付2已支付',
	`shop_id` int DEFAULT NULL COMMENT '对应门店id',
	`del_flag` int DEFAULT '0' COMMENT '删除标志（0=否，1=是）',
	`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '添加时间',
	`address_json` text CHARACTER SET utf8mb4 COLLATE utf8mb4_bin COMMENT '地址json',
	`expected_delivery_time` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '预计提货时间',
	`refund_status` int DEFAULT NULL COMMENT '退款状态（1=退款中，2=已退款）',
	`refund_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '退款流水号',
	`refund_time` datetime DEFAULT NULL COMMENT '退款时间',
	`point_deduction_amount` decimal(10, 2) DEFAULT NULL COMMENT '积分兑换金额',
	PRIMARY KEY USING BTREE (`id`)
) ENGINE = InnoDB CHARSET = utf8mb4 COLLATE = utf8mb4_bin ROW_FORMAT = DYNAMIC COMMENT '订单表';

CREATE TABLE IF NOT EXISTS `gy_jifenshangcheng_order`.`t_order_balance_payment` (
	`id` bigint NOT NULL COMMENT '主键',
	`order_id` bigint DEFAULT NULL COMMENT '订单金额',
	`red_packet_amount` decimal(10, 2) DEFAULT NULL COMMENT '红包支付金额',
	`distribution_amount` decimal(10, 2) DEFAULT NULL COMMENT '分销金额支付金额',
	PRIMARY KEY (`id`)
) ENGINE = InnoDB CHARSET = utf8mb4 COLLATE = utf8mb4_bin COMMENT '余额支付订单明细';

CREATE TABLE IF NOT EXISTS `gy_jifenshangcheng_order`.`t_order_good` (
	`id` bigint NOT NULL AUTO_INCREMENT,
	`goods_id` int DEFAULT NULL COMMENT '商品id',
	`order_id` bigint DEFAULT NULL COMMENT '订单id',
	`good_amount` decimal(10, 2) DEFAULT NULL COMMENT '商品券抵扣金额',
	`seckill_json` text COLLATE utf8mb4_bin COMMENT '秒杀活动的json快照',
	`good_json` text CHARACTER SET utf8mb4 COLLATE utf8mb4_bin COMMENT '购买商品的json快照',
	`num` int DEFAULT NULL COMMENT '数量',
	`del_flag` tinyint DEFAULT '0' COMMENT '删除标志（0=否，1=是）',
	`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '添加时间',
	`earn_spending_points` int DEFAULT '0' COMMENT '可获得消费积分',
	`superior_subcommission` decimal(10, 2) DEFAULT '0.00' COMMENT '上级获得分佣金额',
	`superior_rebate_points` int DEFAULT '0' COMMENT '上级获得返佣积分',
	`superior_type` varchar(100) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '获取返佣积分上级类型（1=直推上级，2=直帮上级）',
	`superior_price_type` varchar(100) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '获取分佣金额上级类型（1=直推上级，2=直帮上级）',
	`servuce_shop_charges` decimal(10, 2) DEFAULT '0.00' COMMENT '核销门店可获得服务费',
	`servuce_shop_points` int DEFAULT '0' COMMENT '核销门店可获得服务积分',
	`technician_points` int DEFAULT '0' COMMENT '技师可获得服务积分',
	`bound_shop_charges` decimal(10, 2) DEFAULT '0.00' COMMENT '绑定门店可获得分佣金额',
	`bound_shop_points` int DEFAULT NULL COMMENT '绑定门店可获得返佣积分',
	`bound_shop_superiors_charges` decimal(10, 2) DEFAULT '0.00' COMMENT '绑定门店上级门店可获得分佣金额',
	`bound_shop_superiors_points` int DEFAULT '0' COMMENT '绑定门店上级门店可获得返佣积分',
	`type` int DEFAULT NULL COMMENT '购买类型（1=普通商品，2=秒杀商品）',
	`cash_payment` int DEFAULT NULL COMMENT '现金支付（0=否，1=是）',
	`point_payment` int DEFAULT NULL COMMENT '积分支付（0=否，1=是）',
	`selling_price` decimal(10, 2) DEFAULT NULL COMMENT '基础售价',
	`integral` int DEFAULT NULL COMMENT '基础积分',
	PRIMARY KEY (`id`)
) ENGINE = InnoDB AUTO_INCREMENT = 1062097391416512589 CHARSET = utf8mb4 COLLATE = utf8mb4_bin COMMENT '订单表—关联商品信息';

