CREATE TABLE `xhpc_user_login`
(
    `user_login_id` bigint(20) NOT NULL AUTO_INCREMENT,
    `app_user_id`   bigint(20) DEFAULT NULL COMMENT '用户id',
    `account`       varchar(50)  DEFAULT NULL COMMENT '账号',
    `user_type`     int(4) NOT NULL COMMENT '用户类型 0 C端用户 1 流量方用户 2社区用户 3B端用户）',
    `open_id`       varchar(50)  DEFAULT NULL COMMENT 'openid',
    `type`          int(4) DEFAULT '0' COMMENT '1 微信 2支付宝',
    `status`        int(4) DEFAULT '1' COMMENT '0退出 1登录',
    `del_flag`      int(1) DEFAULT '0' COMMENT '删除标志（0代表存在 2代表删除）',
    `create_by`     varchar(64)  DEFAULT '' COMMENT '创建者',
    `create_time`   datetime     DEFAULT NULL COMMENT '创建时间',
    `update_by`     varchar(64)  DEFAULT '' COMMENT '更新者',
    `update_time`   datetime     DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
    `remark`        varchar(500) DEFAULT NULL COMMENT '备注',
    PRIMARY KEY (`user_login_id`)
) ENGINE = InnoDB
  DEFAULT CHARSET = utf8mb4 COMMENT ='小程序用户最后一次登录记录';

CREATE TABLE `xhpc_tenant` (
                               `tenant_id` varchar(12) NOT NULL DEFAULT '000000' COMMENT '租户ID',
                               `tenant_name` varchar(50) NOT NULL COMMENT '租户名称',
                               `domain` varchar(255) DEFAULT NULL COMMENT '域名地址',
                               `background_url` varchar(1000) DEFAULT NULL COMMENT '系统背景',
                               `linkman` varchar(20) DEFAULT NULL COMMENT '联系人',
                               `contact_number` varchar(20) DEFAULT NULL COMMENT '联系电话',
                               `address` varchar(255) DEFAULT NULL COMMENT '联系地址',
                               `station_quote` int(11) DEFAULT '-1' COMMENT '场站限额',
                               `station_pile_quote` int(11) DEFAULT '-1' COMMENT '每站桩限额',
                               `expire_time` datetime DEFAULT NULL COMMENT '过期时间',
                               `create_user` bigint(64) DEFAULT NULL COMMENT '创建人',
                               `create_dept` bigint(64) DEFAULT NULL COMMENT '创建部门',
                               `create_time` datetime DEFAULT NULL COMMENT '创建时间',
                               `update_user` bigint(64) DEFAULT NULL COMMENT '修改人',
                               `update_time` datetime DEFAULT NULL COMMENT '修改时间',
                               `status` int(2) DEFAULT '0' COMMENT '状态(0-未启用，1-正常，2-停用)',
                               `is_deleted` int(2) DEFAULT '0' COMMENT '是否已删除（0-正常，2-已删除）',
                               PRIMARY KEY (`tenant_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC COMMENT='租户表';

CREATE TABLE `xhpc_device_message`
(
    `device_message_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '消息id',
    `type`              varchar(50)                    DEFAULT NULL COMMENT '设备类型（PILE-充电桩，TERMINAL-终端）',
    `serial_number`     varchar(32)                    DEFAULT NULL COMMENT '设备流水号',
    `content`           text CHARACTER SET utf8 COMMENT '报文16进制原文',
    `charge_order_no`   varchar(50)                    default null COMMENT '充电订单号',
    `status`            int(10) DEFAULT '0' COMMENT '状态（0正常 1停用）',
    `create_time`       datetime                       DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '创建时间',
    `create_by`         varchar(30) CHARACTER SET utf8 DEFAULT NULL COMMENT '创建者',
    `update_time`       datetime                       DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
    `update_by`         varchar(30) CHARACTER SET utf8 DEFAULT NULL COMMENT '更新者',
    `remark`            text CHARACTER SET utf8 COMMENT '备注',
    `tenant_id`         varchar(12)                    DEFAULT '000000' COMMENT '租户id',
    PRIMARY KEY (`device_message_id`) USING BTREE
) ENGINE=InnoDB
    COMMENT = '设备运行信息表'
    AUTO_INCREMENT=1
    DEFAULT CHARSET=utf8mb4
    COLLATE='utf8mb4_general_ci'
    ROW_FORMAT=DYNAMIC;



CREATE TABLE `xhpc_station_device`
(
    `device_id`        bigint(20) NOT NULL AUTO_INCREMENT COMMENT '设备ID',
    `device_name`      varchar(100) DEFAULT NULL COMMENT '设备名称',
    `device_type`      varchar(32)  DEFAULT NULL COMMENT '设备类型',
    `current_type`     varchar(32)  DEFAULT NULL COMMENT '充电电流类型（直流，交流）',
    `station_id`       bigint(20) DEFAULT NULL COMMENT '所属场站',
    `brand_model`      varchar(100) DEFAULT NULL COMMENT '品牌型号',
    `parent_device_id` bigint(20) DEFAULT NULL COMMENT '上级设备ID',
    `serial_number`    varchar(50)  DEFAULT NULL COMMENT '设备编码',
    `sorted`           smallint(4) DEFAULT 0 COMMENT '排序',
    `status`           smallint(4) DEFAULT NULL COMMENT '设备状态（0-未启用，1-正常，2-异常，3-维修中，4-待检测）',
    `del_flag`         smallint(2) DEFAULT NULL COMMENT '是否删除（0-正常，2-删除）',
    `create_time`      datetime     DEFAULT NULL COMMENT '创建时间',
    `create_by`        varchar(50)  DEFAULT NULL COMMENT '创建人',
    `update_time`      datetime     DEFAULT NULL COMMENT '更新时间',
    `update_by`        varchar(50)  DEFAULT NULL COMMENT '更新人',
    PRIMARY KEY (`device_id`)
) ENGINE=InnoDB
    COMMENT = '场站设备信息表'
    AUTO_INCREMENT=1
    DEFAULT CHARSET=utf8mb4
    COLLATE='utf8mb4_general_ci'
    ROW_FORMAT=DYNAMIC;

CREATE TABLE `xhpc_work_dept`
(
    `work_dept_id`   bigint(20) NOT NULL AUTO_INCREMENT COMMENT '部门ID',
    `dept_name`      varchar(100) DEFAULT NULL COMMENT '部门名称',
    `code`           varchar(16)  DEFAULT NULL COMMENT '部门编码',
    `sort`           smallint(4) DEFAULT NULL COMMENT '排序',
    `parent_dept_id` bigint(20) DEFAULT NULL COMMENT '上级部门ID',
    `status`         smallint(2) DEFAULT NULL COMMENT '状态（0-未启用，1-已启用）',
    `del_flag`       smallint(2) DEFAULT NULL COMMENT '删除（0-正常，2-删除）',
    `tenant_id`      varchar(16)  DEFAULT '000000' COMMENT '租户ID',
    `create_time`    datetime     DEFAULT NULL COMMENT '创建时间',
    `create_by`      varchar(50)  DEFAULT NULL COMMENT '创建人',
    `update_time`    datetime     DEFAULT NULL COMMENT '更新时间',
    `update_by`      varchar(50)  DEFAULT NULL COMMENT '更新人',
    PRIMARY KEY (`work_dept_id`)
) ENGINE=InnoDB
    COMMENT = '工单部门表'
    AUTO_INCREMENT=1
    DEFAULT CHARSET=utf8mb4
    COLLATE='utf8mb4_general_ci'
    ROW_FORMAT=DYNAMIC;

CREATE TABLE `xhpc_work_order`
(
    `work_order_id`   bigint(20) NOT NULL AUTO_INCREMENT COMMENT '工单ID',
    `type`            smallint(4) DEFAULT NULL COMMENT '工单类型',
    `title`           varchar(100)  DEFAULT NULL COMMENT '工单标题',
    `content`         varchar(1000) DEFAULT NULL COMMENT '工单内容描述',
    `fault_time`      datetime      DEFAULT NULL COMMENT '故障时间',
    `device_type`     varchar(32)   DEFAULT NULL COMMENT '设备类型',
    `serial_number`   varchar(100)  DEFAULT NULL COMMENT '设备编码',
    `reason`          varchar(200)  DEFAULT NULL COMMENT '故障原因',
    `disposal_method` varchar(500)  DEFAULT NULL COMMENT '详细处理描述',
    `status`          smallint(4) DEFAULT NULL COMMENT '状态, 0-编辑，1-派发处理，2-处理完成',
    `del_flag`        smallint(2) DEFAULT NULL COMMENT '是否删除（0-正常，2-删除）',
    `tenant_id`       varchar(50)   DEFAULT '000000' COMMENT '租户ID',
    `create_time`     datetime      DEFAULT NULL COMMENT '创建时间',
    `create_by`       varchar(100)  DEFAULT NULL COMMENT '创建人',
    `update_time`     datetime      DEFAULT NULL COMMENT '更新时间',
    `update_by`       varchar(100)  DEFAULT NULL COMMENT '更新人',
    `remark` text COMMENT '备注',
    PRIMARY KEY (`work_order_id`)
) ENGINE=InnoDB
    COMMENT = '工单详情表'
    AUTO_INCREMENT=1
    DEFAULT CHARSET=utf8mb4
    COLLATE='utf8mb4_general_ci'
    ROW_FORMAT=DYNAMIC;

CREATE TABLE `xhpc_work_order_user` (
                                        `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '分派ID',
                                        `order_id` bigint(20) NOT NULL COMMENT '工单ID',
                                        `user_id` bigint(20) NOT NULL COMMENT '分配人ID',
                                        PRIMARY KEY (`id`)
) ENGINE=InnoDB
    COMMENT = '工单派单表'
    AUTO_INCREMENT=1
    DEFAULT CHARSET=utf8mb4
    COLLATE='utf8mb4_general_ci'
    ROW_FORMAT=DYNAMIC;


CREATE TABLE `xhpc_work_order_image`
(
    `order_image_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '图片ID',
    `order_id`       bigint(20) DEFAULT NULL COMMENT '工单ID',
    `file_name`      varchar(100) DEFAULT NULL COMMENT '文件名称',
    `url`            varchar(200) DEFAULT NULL COMMENT '文件地址',
    `type`           smallint(2) DEFAULT NULL COMMENT '文件类型（1-问题展示图片，2-处理反馈图片）',
    `del_flag`       smallint(2) DEFAULT NULL COMMENT '删除标记（0-正常，2-已删除）',
    `create_time`    datetime     DEFAULT NULL COMMENT '创建时间',
    `create_by`      varchar(50)  DEFAULT NULL COMMENT '创建人',
    PRIMARY KEY (`order_image_id`)
) ENGINE=InnoDB
    COMMENT = '工单文件表'
    AUTO_INCREMENT=1
    DEFAULT CHARSET=utf8mb4
    COLLATE='utf8mb4_general_ci'
    ROW_FORMAT=DYNAMIC;


CREATE TABLE `xhpc_work_order_push_message`
(
    `order_push_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '消息推送ID',
    `target`        varchar(64)  DEFAULT NULL COMMENT '接收方（邮箱、手机号、openID等）',
    `type`          smallint(2) DEFAULT NULL COMMENT '推送方式（1-手机短信，2-电子邮件，3-微信公众号，4-微信小程序，5-支付宝小程序，6-其他）',
    `content`       varchar(255) DEFAULT NULL COMMENT '推送内容',
    `status`        smallint(2) DEFAULT NULL COMMENT '推送状态标志（0-创建，1-成功，2-推送失败）',
    `fail_msg`      varchar(200) DEFAULT NULL COMMENT '推送失败详细信息',
    `remark`        varchar(255) DEFAULT NULL COMMENT '备注',
    `create_time`   datetime     DEFAULT NULL COMMENT '创建时间',
    `create_by`     varchar(50)  DEFAULT NULL COMMENT '创建人',
    `update_time`   datetime     DEFAULT NULL COMMENT '更新时间',
    `update_by`     varchar(50)  DEFAULT NULL COMMENT '更新人',
    PRIMARY KEY (`order_push_id`)
) ENGINE=InnoDB
    COMMENT = '工单消息推送表'
    AUTO_INCREMENT=1
    DEFAULT CHARSET=utf8mb4
    COLLATE='utf8mb4_general_ci'
    ROW_FORMAT=DYNAMIC;


CREATE TABLE `xhpc_work_station`
(
    `work_station_id`       bigint(20) NOT NULL AUTO_INCREMENT COMMENT '电站id',
    `name`                  varchar(30) CHARACTER SET utf8  DEFAULT NULL COMMENT '名称',
    `operator_id`           bigint(20) DEFAULT NULL COMMENT '运营商id',
    `type`                  int(2) DEFAULT NULL COMMENT '电站位置(地上电站、地下电站)',
    `construction_site`     smallint(6) DEFAULT NULL COMMENT '建设场所',
    `service_facilities`    text CHARACTER SET utf8 COMMENT '服务设施',
    `periphery_facilities`  text CHARACTER SET utf8 COMMENT '周边设施',
    `address`               varchar(50) CHARACTER SET utf8  DEFAULT NULL COMMENT '电站地址',
    `detailed_address`      varchar(50) CHARACTER SET utf8  DEFAULT NULL COMMENT '详细地址',
    `longitude`             varchar(30) CHARACTER SET utf8  DEFAULT NULL COMMENT '经度',
    `latitude`              varchar(30) CHARACTER SET utf8  DEFAULT NULL COMMENT '维度',
    `parking_instructions`  varchar(255) CHARACTER SET utf8 DEFAULT NULL COMMENT '停车说明',
    `serial_number`         varchar(50) CHARACTER SET utf8  DEFAULT NULL COMMENT '编号',
    `status`                int(10) DEFAULT '0' COMMENT '状态（0启用 1停用）',
    `del_flag`              int(2) DEFAULT '0' COMMENT '删除标志（0代表存在 2代表删除）',
    `create_time`           datetime                        DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '创建时间',
    `create_by`             varchar(30) CHARACTER SET utf8  DEFAULT '' COMMENT '创建者',
    `update_time`           datetime                        DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
    `update_by`             varchar(30) CHARACTER SET utf8  DEFAULT NULL COMMENT '更新者',
    `remark`                varchar(255) CHARACTER SET utf8 DEFAULT NULL COMMENT '备注',
    `business_instructions` varchar(255)                    DEFAULT NULL COMMENT '营业说明',
    `reminder_instructions` varchar(255)                    DEFAULT NULL COMMENT '温馨提示',
    `img_id`                varchar(500)                    DEFAULT NULL COMMENT '图片集合',
    `station_type`          smallint(6) DEFAULT NULL COMMENT '电站类型',
    `service_tel`           varchar(20)                     DEFAULT NULL COMMENT '站点电话',
    `park_nums`             mediumint(9) DEFAULT NULL COMMENT '侧位数量',
    `tenant_id`             varchar(12)                     DEFAULT '000000' COMMENT '租户id',
    PRIMARY KEY (`work_station_id`) USING BTREE
) ENGINE=InnoDB
    COMMENT = '工单场站信息表'
    AUTO_INCREMENT=1
    DEFAULT CHARSET=utf8mb4
    COLLATE='utf8mb4_general_ci'
    ROW_FORMAT=DYNAMIC;


CREATE TABLE `xhpc_work_user`
(
    `work_user_id`  bigint(20) NOT NULL AUTO_INCREMENT COMMENT '人员ID',
    `user_name`     varchar(64) DEFAULT NULL COMMENT '人员姓名',
    `dept_id`       bigint(20) DEFAULT NULL COMMENT '所属部门ID',
    `post_name`     varchar(64) DEFAULT NULL COMMENT '岗位名称',
    `phone`         varchar(16) DEFAULT NULL COMMENT '联系电话',
    `email`         varchar(64) DEFAULT NULL COMMENT '邮箱地址',
    `wechat_openid` varchar(64) DEFAULT NULL COMMENT '微信OPENID',
    `is_leader`     smallint(2) DEFAULT NULL COMMENT '是否部门负责人',
    `status`        smallint(2) DEFAULT NULL COMMENT '状态（0-未启用，1-正常）',
    `del_flag`      smallint(2) DEFAULT NULL COMMENT '删除（0-正常，2-删除）',
    `create_time`   datetime    DEFAULT NULL COMMENT '创建时间',
    `create_by`     varchar(50) DEFAULT NULL COMMENT '创建人',
    `update_time`   datetime    DEFAULT NULL COMMENT '更新时间',
    `update_by`     varchar(50) DEFAULT NULL COMMENT '更新人',
    PRIMARY KEY (`work_user_id`)
) ENGINE=InnoDB
    COMMENT = '工单人员信息表'
    AUTO_INCREMENT=1
    DEFAULT CHARSET=utf8mb4
    COLLATE='utf8mb4_general_ci'
    ROW_FORMAT=DYNAMIC;


ALTER TABLE `et_auth_sec_token`
    ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
ALTER TABLE `et_charge_order_info`
    ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
ALTER TABLE `et_common_operator_info`
    ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
ALTER TABLE `et_common_station_info`
    ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
ALTER TABLE `et_connector_status_info`
    ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
ALTER TABLE `et_dispute_orders`
    ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
ALTER TABLE `et_equip_charge_status_info`
    ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';

ALTER TABLE `gen_table`
    ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
ALTER TABLE `gen_table_column`
    ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
ALTER TABLE `hibernate_sequence`
    ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';


ALTER TABLE `service_field`
    ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
ALTER TABLE `sys_config`
    ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
ALTER TABLE `sys_dept`
    ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
ALTER TABLE `sys_dict_data`
    ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
ALTER TABLE `sys_dict_type`
    ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
ALTER TABLE `sys_job`
    ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
ALTER TABLE `sys_job_log`
    ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
ALTER TABLE `sys_logininfor`
    ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
ALTER TABLE `sys_menu`
    ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
ALTER TABLE `sys_notice`
    ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
ALTER TABLE `sys_oper_log`
    ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
ALTER TABLE `sys_post`
    ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
ALTER TABLE `sys_role`
    ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
ALTER TABLE `sys_role_dept`
    ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
ALTER TABLE `sys_role_menu`
    ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
ALTER TABLE `sys_user`
    ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
ALTER TABLE `sys_user_post`
    ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
ALTER TABLE `sys_user_role`
    ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
ALTER TABLE `xhpc_agreement`
    ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
ALTER TABLE `xhpc_app_user`
    ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
ALTER TABLE `xhpc_area`
    ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';


ALTER TABLE `xhpc_charge_order_current`
    ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
ALTER TABLE `xhpc_charge_order_soc`
    ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
ALTER TABLE `xhpc_charge_order_status`
    ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
ALTER TABLE `xhpc_charge_order_voltage`
    ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';

ALTER TABLE `xhpc_charging_station_push_status`
    ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';

ALTER TABLE `xhpc_data_dimension`
    ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
ALTER TABLE `xhpc_dict_biz`
    ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
ALTER TABLE `xhpc_help`
    ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
ALTER TABLE `xhpc_history_order_reconciliation_status`
    ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
ALTER TABLE `xhpc_history_order_sorting_status`
    ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
ALTER TABLE `xhpc_img`
    ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';

ALTER TABLE `xhpc_invoice`
    ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
ALTER TABLE `xhpc_invoice_map_history_order`
    ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
ALTER TABLE `xhpc_mechanism`
    ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
ALTER TABLE `xhpc_message`
    ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
ALTER TABLE `xhpc_notice_read`
    ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
ALTER TABLE `xhpc_operator`
    ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
ALTER TABLE `xhpc_operator_internet_blacklist`
    ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
ALTER TABLE `xhpc_order_redis_record`
    ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
ALTER TABLE `xhpc_promotion`
    ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
ALTER TABLE `xhpc_promotion_coupon`
    ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
ALTER TABLE `xhpc_promotion_platform`
    ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
ALTER TABLE `xhpc_promotion_station`
    ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
ALTER TABLE `xhpc_rate`
    ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
ALTER TABLE `xhpc_rate_model`
    ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
ALTER TABLE `xhpc_rate_time`
    ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
ALTER TABLE `xhpc_real_time_order`
    ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
ALTER TABLE `xhpc_recharge_order`
    ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
ALTER TABLE `xhpc_refund_audit`
    ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
ALTER TABLE `xhpc_refund_order`
    ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
ALTER TABLE `xhpc_sms`
    ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';

ALTER TABLE `xhpc_statistics_station`
    ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
ALTER TABLE `xhpc_statistics_time_interval`
    ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';

ALTER TABLE `xhpc_tradebill_internet_check_record`
    ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
ALTER TABLE `xhpc_tradebill_payment_check_record`
    ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';


ALTER TABLE `xhpc_user_account_statement`
    ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
ALTER TABLE `xhpc_user_login`
    ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
ALTER TABLE `xhpc_user_privilege`
    ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
ALTER TABLE `xhpc_vin_blacklist`
    ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';

ALTER TABLE `xhpc_app_user`
    ADD COLUMN `soc_protect` INT(4) NULL DEFAULT '0' COMMENT '是否开启电池保护 0 未开启 1开启' AFTER `tenant_id`;

CREATE TABLE `xhpc_setting_config` (
                                       `setting_config_id` bigint(20) NOT NULL AUTO_INCREMENT,
                                       `wx_app_id` varchar(50) DEFAULT NULL COMMENT '微信小程序id',
                                       `wx_app_secret` varchar(50) DEFAULT NULL COMMENT '微信小程序密钥',
                                       `wx_mch_id` varchar(20) DEFAULT NULL COMMENT '微信商户id',
                                       `wx_mch_key` varchar(50) DEFAULT NULL COMMENT '微信商户平台Key',
                                       `wx_payment_url` varchar(255) DEFAULT NULL COMMENT '微信小程序支付地址',
                                       `wx_callback_url` varchar(255) DEFAULT NULL COMMENT '微信回调地址',
                                       `wx_transfers_url` varchar(255) DEFAULT NULL COMMENT '向微信用户个人付款地址',
                                       `wx_apiclient_cert_pem` varchar(255) DEFAULT NULL COMMENT '微信支付证书',
                                       `wx_apiclient_key_pem` varchar(255) DEFAULT NULL COMMENT '微信支付证书密钥',
                                       `wx_app_cert_public_key` varchar(255) DEFAULT NULL COMMENT '微信证书',
                                       `zfb_app_id` varchar(50) DEFAULT NULL COMMENT '支付宝appid',
                                       `zfb_private_key` text COMMENT '支付宝应用私钥',
                                       `zfb_callback_url` varchar(255) DEFAULT NULL COMMENT '支付宝回调地址',
                                       `zfb_app_cert_public_key` varchar(255) DEFAULT NULL COMMENT '支付宝应用公钥证书路径',
                                       `zfb_alipay_cert_public_key_rsa` varchar(255) DEFAULT NULL COMMENT '支付宝公钥证书路径',
                                       `zfb_alipay_root_cert` varchar(255) DEFAULT NULL COMMENT '支付宝根证书路径',
                                       `zhb_server_url` varchar(255) DEFAULT NULL COMMENT '支付宝网管',
                                       `status` int(4) DEFAULT '0' COMMENT '1微信 2支付宝',
                                       `del_flag` int(1) DEFAULT '0' COMMENT '删除标志（0代表存在 1代表删除）',
                                       `create_by` varchar(64) DEFAULT '' COMMENT '创建者',
                                       `create_time` datetime DEFAULT NULL COMMENT '创建时间',
                                       `update_by` varchar(64) DEFAULT '' COMMENT '更新者',
                                       `update_time` datetime DEFAULT NULL COMMENT '更新时间',
                                       `remark` varchar(500) DEFAULT NULL COMMENT '备注',
                                       `tenant_id` varchar(12) DEFAULT '000000' COMMENT '租户id',
                                       PRIMARY KEY (`setting_config_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb4 ROW_FORMAT=COMPACT;

-- ICCard
ALTER TABLE `xhpc_operator`
    ADD COLUMN `corp_no` VARCHAR(30) NULL DEFAULT NULL COMMENT '运营商代码,用于桩编号前缀,如80836代表翔桦' AFTER `name`;
ALTER TABLE `xhpc_operator`
    ADD COLUMN `corp_type` TINYINT NULL DEFAULT NULL COMMENT '运营商类型1:平台2:合作运营商' AFTER `corp_no`;
CREATE TABLE `t_iccard_client_users`
(
    `usersID`     INT(11)      NOT NULL AUTO_INCREMENT,
    `usersName`   VARCHAR(100) NULL     DEFAULT NULL COMMENT '命名规则:字母数字组合' COLLATE 'utf8mb4_unicode_ci',
    `usersPwd`    VARCHAR(100) NULL     DEFAULT NULL COMMENT '用户密码' COLLATE 'utf8_general_ci',
    `usersPhone`  VARCHAR(50)  NULL     DEFAULT NULL COMMENT '用户电话' COLLATE 'utf8_general_ci',
    `usersEmail`  VARCHAR(50)  NULL     DEFAULT NULL COMMENT '用户Email' COLLATE 'utf8_general_ci',
    `usersAdress` VARCHAR(300) NULL     DEFAULT NULL COMMENT '用户地址' COLLATE 'utf8_general_ci',
    `usersLevel`  TINYINT(4)   NOT NULL DEFAULT '1' COMMENT '用户级别  3.运营商管理员  4.平台管理员',
    `usersCorp`   INT(11)      NOT NULL DEFAULT '0' COMMENT '所属运营商id,对应xhpc_operator.operator_id',
    `corpNo`      VARCHAR(10)  NOT NULL DEFAULT '0' COMMENT '所属运营商前缀' COLLATE 'utf8mb4_bin',
    `corpName`    VARCHAR(50)  NOT NULL DEFAULT '0' COMMENT '所属运营商名称' COLLATE 'utf8mb4_bin',
    `usersTime`   DATETIME     NULL     DEFAULT NULL COMMENT '添加日期',
    PRIMARY KEY (`usersID`),
    UNIQUE INDEX `usersName` (`usersName`)
)
    COMMENT ='发卡客户端用户表'
    COLLATE = 'utf8mb4_bin'
    ENGINE = InnoDB
    AUTO_INCREMENT = 1
;


CREATE TABLE `xhpc_message_board`
(
    `message_id`        bigint(30) NOT NULL AUTO_INCREMENT COMMENT '消息id',
    `sender_type`       tinyint(2)  DEFAULT NULL COMMENT '用户类型用户类型（0 C端用户 1 流量方用户 2社区用户 3B端用户）',
    `sender_account`    varchar(30) DEFAULT NULL COMMENT '用户账号',
    `send_message_time` datetime    DEFAULT NULL COMMENT '发送消息的时间',
    `message_content`   text COMMENT '消息内容',
    `tenant_type`       tinyint(2)  DEFAULT NULL COMMENT '租户类型',
    `tenant_id`         varchar(30) DEFAULT NULL COMMENT '租户id（平台id）',
    `have_new_info`     tinyint(1)  DEFAULT NULL COMMENT '租户发送的消息，用户是否已读，默认为null，0表示未读，1表示已读',
    `del_flag`          tinyint(1)  DEFAULT NULL COMMENT '逻辑删除字段',
    `sender`            tinyint(1)  DEFAULT NULL COMMENT '发送者（0，用户，1，时间，2，平台（租户））',
    PRIMARY KEY (`message_id`)
) ENGINE = InnoDB
  AUTO_INCREMENT = 2920
  DEFAULT CHARSET = utf8mb4;



ALTER TABLE `xhpc_statistics_station`
    ADD COLUMN `source` INT(4) NULL COMMENT '订单来源（0 C端用户 1 流量方用户 2社区用户 3B端用户）' AFTER `tenant_id`;

ALTER TABLE `xhpc_operator`
    CHANGE COLUMN `corp_no` `corp_no` VARCHAR(30) NULL COMMENT '运营商代码,用于桩编号前缀,如80836代表翔桦' AFTER `name`,
    ADD UNIQUE INDEX `corp_no` (`corp_no`);

ALTER TABLE `t_iccard_client_users`
    ADD COLUMN `tenant_id` VARCHAR(50) NULL COMMENT '租户id' AFTER `usersTime`;

ALTER TABLE `xhpc_real_time_order` ADD COLUMN `source`  int(10) NULL DEFAULT NULL COMMENT '订单来源（0 C端用户 1 流量方用户 2社区用户 3B端用户）' AFTER `tenant_id`;


SET FOREIGN_KEY_CHECKS=0;
ALTER TABLE `et_order_mapping` MODIFY COLUMN `tenant_id`  varchar(12) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '000000' COMMENT '租户id' AFTER `update_time`;
CREATE TABLE `oder_test` (
                             `recharge_order_number`  varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL ,
                             `alipay_number`  varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL ,
                             `tenant_id`  varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '000000' COMMENT '租户id'
)
    ENGINE=InnoDB
DEFAULT CHARACTER SET=utf8mb4 COLLATE=utf8mb4_general_ci
ROW_FORMAT=Dynamic
;
CREATE TABLE `qrtz_blob_triggers` (
                                      `sched_name`  varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL ,
                                      `trigger_name`  varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL ,
                                      `trigger_group`  varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL ,
                                      `blob_data`  blob NULL ,
                                      PRIMARY KEY (`sched_name`, `trigger_name`, `trigger_group`),
                                      CONSTRAINT `QRTZ_BLOB_TRIGGERS_ibfk_1` FOREIGN KEY (`sched_name`, `trigger_name`, `trigger_group`) REFERENCES `qrtz_triggers` (`sched_name`, `trigger_name`, `trigger_group`) ON DELETE RESTRICT ON UPDATE RESTRICT
)
    ENGINE=InnoDB
DEFAULT CHARACTER SET=utf8mb4 COLLATE=utf8mb4_general_ci
ROW_FORMAT=Dynamic
;
CREATE TABLE `qrtz_calendars` (
                                  `sched_name`  varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL ,
                                  `calendar_name`  varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL ,
                                  `calendar`  blob NOT NULL ,
                                  PRIMARY KEY (`sched_name`, `calendar_name`)
)
    ENGINE=InnoDB
DEFAULT CHARACTER SET=utf8mb4 COLLATE=utf8mb4_general_ci
ROW_FORMAT=Dynamic
;
CREATE TABLE `qrtz_cron_triggers` (
                                      `sched_name`  varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL ,
                                      `trigger_name`  varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL ,
                                      `trigger_group`  varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL ,
                                      `cron_expression`  varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL ,
                                      `time_zone_id`  varchar(80) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL ,
                                      PRIMARY KEY (`sched_name`, `trigger_name`, `trigger_group`),
                                      CONSTRAINT `QRTZ_CRON_TRIGGERS_ibfk_1` FOREIGN KEY (`sched_name`, `trigger_name`, `trigger_group`) REFERENCES `qrtz_triggers` (`sched_name`, `trigger_name`, `trigger_group`) ON DELETE RESTRICT ON UPDATE RESTRICT
)
    ENGINE=InnoDB
DEFAULT CHARACTER SET=utf8mb4 COLLATE=utf8mb4_general_ci
ROW_FORMAT=Dynamic
;
CREATE TABLE `qrtz_fired_triggers` (
                                       `sched_name`  varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL ,
                                       `entry_id`  varchar(95) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL ,
                                       `trigger_name`  varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL ,
                                       `trigger_group`  varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL ,
                                       `instance_name`  varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL ,
                                       `fired_time`  bigint(13) NOT NULL ,
                                       `sched_time`  bigint(13) NOT NULL ,
                                       `priority`  int(11) NOT NULL ,
                                       `state`  varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL ,
                                       `job_name`  varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL ,
                                       `job_group`  varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL ,
                                       `is_nonconcurrent`  varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL ,
                                       `requests_recovery`  varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL ,
                                       PRIMARY KEY (`sched_name`, `entry_id`)
)
    ENGINE=InnoDB
DEFAULT CHARACTER SET=utf8mb4 COLLATE=utf8mb4_general_ci
ROW_FORMAT=Dynamic
;
CREATE TABLE `qrtz_job_details` (
                                    `sched_name`  varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL ,
                                    `job_name`  varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL ,
                                    `job_group`  varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL ,
                                    `description`  varchar(250) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL ,
                                    `job_class_name`  varchar(250) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL ,
                                    `is_durable`  varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL ,
                                    `is_nonconcurrent`  varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL ,
                                    `is_update_data`  varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL ,
                                    `requests_recovery`  varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL ,
                                    `job_data`  blob NULL ,
                                    PRIMARY KEY (`sched_name`, `job_name`, `job_group`)
)
    ENGINE=InnoDB
DEFAULT CHARACTER SET=utf8mb4 COLLATE=utf8mb4_general_ci
ROW_FORMAT=Dynamic
;
CREATE TABLE `qrtz_locks` (
                              `sched_name`  varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL ,
                              `lock_name`  varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL ,
                              PRIMARY KEY (`sched_name`, `lock_name`)
)
    ENGINE=InnoDB
DEFAULT CHARACTER SET=utf8mb4 COLLATE=utf8mb4_general_ci
ROW_FORMAT=Dynamic
;
CREATE TABLE `qrtz_paused_trigger_grps` (
                                            `sched_name`  varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL ,
                                            `trigger_group`  varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL ,
                                            PRIMARY KEY (`sched_name`, `trigger_group`)
)
    ENGINE=InnoDB
DEFAULT CHARACTER SET=utf8mb4 COLLATE=utf8mb4_general_ci
ROW_FORMAT=Dynamic
;
CREATE TABLE `qrtz_scheduler_state` (
                                        `sched_name`  varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL ,
                                        `instance_name`  varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL ,
                                        `last_checkin_time`  bigint(13) NOT NULL ,
                                        `checkin_interval`  bigint(13) NOT NULL ,
                                        PRIMARY KEY (`sched_name`, `instance_name`)
)
    ENGINE=InnoDB
DEFAULT CHARACTER SET=utf8mb4 COLLATE=utf8mb4_general_ci
ROW_FORMAT=Dynamic
;
CREATE TABLE `qrtz_simple_triggers` (
                                        `sched_name`  varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL ,
                                        `trigger_name`  varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL ,
                                        `trigger_group`  varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL ,
                                        `repeat_count`  bigint(7) NOT NULL ,
                                        `repeat_interval`  bigint(12) NOT NULL ,
                                        `times_triggered`  bigint(10) NOT NULL ,
                                        PRIMARY KEY (`sched_name`, `trigger_name`, `trigger_group`),
                                        CONSTRAINT `QRTZ_SIMPLE_TRIGGERS_ibfk_1` FOREIGN KEY (`sched_name`, `trigger_name`, `trigger_group`) REFERENCES `qrtz_triggers` (`sched_name`, `trigger_name`, `trigger_group`) ON DELETE RESTRICT ON UPDATE RESTRICT
)
    ENGINE=InnoDB
DEFAULT CHARACTER SET=utf8mb4 COLLATE=utf8mb4_general_ci
ROW_FORMAT=Dynamic
;
CREATE TABLE `qrtz_simprop_triggers` (
                                         `sched_name`  varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL ,
                                         `trigger_name`  varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL ,
                                         `trigger_group`  varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL ,
                                         `str_prop_1`  varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL ,
                                         `str_prop_2`  varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL ,
                                         `str_prop_3`  varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL ,
                                         `int_prop_1`  int(11) NULL DEFAULT NULL ,
                                         `int_prop_2`  int(11) NULL DEFAULT NULL ,
                                         `long_prop_1`  bigint(20) NULL DEFAULT NULL ,
                                         `long_prop_2`  bigint(20) NULL DEFAULT NULL ,
                                         `dec_prop_1`  decimal(13,4) NULL DEFAULT NULL ,
                                         `dec_prop_2`  decimal(13,4) NULL DEFAULT NULL ,
                                         `bool_prop_1`  varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL ,
                                         `bool_prop_2`  varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL ,
                                         PRIMARY KEY (`sched_name`, `trigger_name`, `trigger_group`),
                                         CONSTRAINT `QRTZ_SIMPROP_TRIGGERS_ibfk_1` FOREIGN KEY (`sched_name`, `trigger_name`, `trigger_group`) REFERENCES `qrtz_triggers` (`sched_name`, `trigger_name`, `trigger_group`) ON DELETE RESTRICT ON UPDATE RESTRICT
)
    ENGINE=InnoDB
DEFAULT CHARACTER SET=utf8mb4 COLLATE=utf8mb4_general_ci
ROW_FORMAT=Dynamic
;
CREATE TABLE `qrtz_triggers` (
                                 `sched_name`  varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL ,
                                 `trigger_name`  varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL ,
                                 `trigger_group`  varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL ,
                                 `job_name`  varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL ,
                                 `job_group`  varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL ,
                                 `description`  varchar(250) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL ,
                                 `next_fire_time`  bigint(13) NULL DEFAULT NULL ,
                                 `prev_fire_time`  bigint(13) NULL DEFAULT NULL ,
                                 `priority`  int(11) NULL DEFAULT NULL ,
                                 `trigger_state`  varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL ,
                                 `trigger_type`  varchar(8) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL ,
                                 `start_time`  bigint(13) NOT NULL ,
                                 `end_time`  bigint(13) NULL DEFAULT NULL ,
                                 `calendar_name`  varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL ,
                                 `misfire_instr`  smallint(2) NULL DEFAULT NULL ,
                                 `job_data`  blob NULL ,
                                 PRIMARY KEY (`sched_name`, `trigger_name`, `trigger_group`),
                                 CONSTRAINT `QRTZ_TRIGGERS_ibfk_1` FOREIGN KEY (`sched_name`, `job_name`, `job_group`) REFERENCES `qrtz_job_details` (`sched_name`, `job_name`, `job_group`) ON DELETE RESTRICT ON UPDATE RESTRICT,
                                 INDEX `sched_name` (`sched_name`, `job_name`, `job_group`) USING BTREE
)
    ENGINE=InnoDB
DEFAULT CHARACTER SET=utf8mb4 COLLATE=utf8mb4_general_ci
ROW_FORMAT=Dynamic
;
CREATE TABLE `t_corp` (
                          `corpID`  int(11) NOT NULL AUTO_INCREMENT ,
                          `corpNo`  varchar(300) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '企业编码' ,
                          `corpName`  varchar(300) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '企业名称' ,
                          `corpPhone`  varchar(300) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '企业电话' ,
                          `corpEmail`  varchar(300) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '企业Email' ,
                          `corpContact`  varchar(300) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '企业联系人' ,
                          `corpAdress`  varchar(300) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '企业地址' ,
                          `corpType`  tinyint(4) NULL DEFAULT 1 COMMENT '1.企业  2. 园区  3. 合作伙伴' ,
                          `corpFlag`  tinyint(4) NULL DEFAULT 0 COMMENT '是否删除' ,
                          `corpTime`  datetime NULL DEFAULT NULL COMMENT '添加日期' ,
                          `corpLogo`  varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '企业logo' ,
                          `corpServiceTime`  varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '服务时间' ,
                          `corpServiceTel`  varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '服务电话' ,
                          `tenant_id`  varchar(12) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '000000' COMMENT '租户id' ,
                          PRIMARY KEY (`corpID`)
)
    ENGINE=InnoDB
DEFAULT CHARACTER SET=utf8 COLLATE=utf8_general_ci
ROW_FORMAT=Dynamic
;
ALTER TABLE `t_iccard_client_users` ADD COLUMN `del_flag`  tinyint(1) NULL DEFAULT 0 COMMENT '逻辑删除字段（0，存在，1为删除）' AFTER `tenant_id`;
ALTER TABLE `t_iccard_client_users` MODIFY COLUMN `tenant_id`  varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '租户id' AFTER `usersTime`;
CREATE TABLE `t_iccard_device` (
                                   `id`  int(11) NOT NULL AUTO_INCREMENT ,
                                   `devName`  varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '设备名称' ,
                                   `devType`  varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '设备型号' ,
                                   `serialNumber`  varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '卡读写器全球唯一编号' ,
                                   `corpIndex`  int(11) NOT NULL COMMENT '授权商前6位编码' ,
                                   `createTime`  datetime NULL DEFAULT NULL COMMENT '添加日期' ,
                                   `type`  tinyint(2) NOT NULL COMMENT '授权给谁（0，运营商，1平台）' ,
                                   `del_flag`  tinyint(2) NOT NULL DEFAULT 0 COMMENT '逻辑删除字段（0，未删除，1删除）' ,
                                   `tenant_id`  varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '000000' COMMENT '租户id（默认000000）' ,
                                   PRIMARY KEY (`id`),
                                   UNIQUE INDEX `serialNumber` (`serialNumber`) USING BTREE
)
    ENGINE=InnoDB
DEFAULT CHARACTER SET=utf8 COLLATE=utf8_general_ci
ROW_FORMAT=Dynamic
;
CREATE TABLE `t_iccard_encrypt_key` (
                                        `id`  int(11) NOT NULL AUTO_INCREMENT ,
                                        `corpIndex`  int(11) NOT NULL COMMENT '企业索引' ,
                                        `encryptKey`  varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '加密密钥' ,
                                        `createTime`  datetime NULL DEFAULT NULL COMMENT '添加日期' ,
                                        PRIMARY KEY (`id`)
)
    ENGINE=InnoDB
DEFAULT CHARACTER SET=utf8 COLLATE=utf8_general_ci
ROW_FORMAT=Dynamic
;
CREATE TABLE `t_iccard_info` (
                                 `id`  int(11) NOT NULL AUTO_INCREMENT ,
                                 `cardID`  varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '卡序列号' ,
                                 `cardNo`  varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '卡编号' ,
                                 `cardType`  tinyint(4) NULL DEFAULT 0 COMMENT '卡类型。0.离线卡; 1.联网卡' ,
                                 `is_platform`  tinyint(2) NULL DEFAULT NULL COMMENT '0表示平台，1表示运营商' ,
                                 `userIndex`  int(11) NULL DEFAULT NULL COMMENT '卡用户索引 (t_iccard_users 找用户的，没有表示没绑)' ,
                                 `password`  varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'password' ,
                                 `corpNo`  varchar(16) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '运营商站编号前6位（xhpc_operator）' ,
                                 `cashPledge`  int(11) NULL DEFAULT NULL COMMENT '押金' ,
                                 `balance`  int(11) NULL DEFAULT NULL COMMENT '余额' ,
                                 `status`  tinyint(4) NULL DEFAULT 0 COMMENT '0.初始化, 1.正常, 2.锁卡, 3.挂失, 4.作废，5,解绑' ,
                                 `createTime`  datetime NULL DEFAULT NULL COMMENT '添加日期' ,
                                 `tenant_id`  varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '000000' COMMENT '租户id' ,
                                 PRIMARY KEY (`id`),
                                 UNIQUE INDEX `cardID` (`cardID`) USING BTREE ,
                                 UNIQUE INDEX `cardNo` (`cardNo`) USING BTREE ,
                                 UNIQUE INDEX `userIndex` (`userIndex`) USING BTREE
)
    ENGINE=InnoDB
DEFAULT CHARACTER SET=utf8 COLLATE=utf8_general_ci
ROW_FORMAT=Dynamic
;
CREATE TABLE `t_iccard_invalid` (
                                    `id`  int(11) NOT NULL AUTO_INCREMENT ,
                                    `cardID`  varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '卡序列号' ,
                                    `cardNo`  varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '卡编号' ,
                                    `cardType`  tinyint(4) NULL DEFAULT 0 COMMENT '卡类型。0.单机卡; 1.联网卡' ,
                                    `password`  varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'password' ,
                                    `userIndex`  int(11) NULL DEFAULT NULL COMMENT '卡用户索引' ,
                                    `corpNo`  varchar(16) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '企业编码' ,
                                    `cashPledge`  int(11) NULL DEFAULT NULL COMMENT '押金' ,
                                    `balance`  int(11) NULL DEFAULT NULL COMMENT '余额' ,
                                    `status`  tinyint(4) NULL DEFAULT 0 COMMENT '4.作废' ,
                                    `createTime`  datetime NULL DEFAULT NULL COMMENT '添加日期' ,
                                    `tenant_id`  varchar(12) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '000000' COMMENT '租户id' ,
                                    PRIMARY KEY (`id`),
                                    UNIQUE INDEX `cardID` (`cardID`) USING BTREE ,
                                    UNIQUE INDEX `cardNo` (`cardNo`) USING BTREE
)
    ENGINE=InnoDB
DEFAULT CHARACTER SET=utf8 COLLATE=utf8_general_ci
ROW_FORMAT=Dynamic
;
CREATE TABLE `t_iccard_log` (
                                `id`  int(11) NOT NULL AUTO_INCREMENT ,
                                `uniqueID`  varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '卡序列号, 用户身份证号, 读写卡器序列号' ,
                                `type`  tinyint(4) NULL DEFAULT 0 COMMENT '日志类型：0.用户卡; 1.读写卡器' ,
                                `operate`  tinyint(4) NULL DEFAULT 0 COMMENT '操作。0.初始化, 1.发卡, 2.充值, 3.退费, 4.解锁, 5.挂失, 6.解除挂失, 7.重置密码, 8.作废卡, 9.添加读写卡器, 10.删除读写卡器，11解绑卡' ,
                                `operatorId`  int(11) NOT NULL COMMENT '操作员ID, 关联t_users usersID' ,
                                `log`  varchar(640) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '日志内容。操作的序列化' ,
                                `createTime`  datetime NULL DEFAULT NULL COMMENT '添加日期' ,
                                PRIMARY KEY (`id`)
)
    ENGINE=InnoDB
DEFAULT CHARACTER SET=utf8 COLLATE=utf8_general_ci
ROW_FORMAT=Dynamic
;
CREATE TABLE `t_iccard_operate` (
                                    `operate`  int(11) NOT NULL COMMENT '操作' ,
                                    `description`  varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '描述' ,
                                    PRIMARY KEY (`operate`)
)
    ENGINE=InnoDB
DEFAULT CHARACTER SET=utf8 COLLATE=utf8_general_ci
ROW_FORMAT=Dynamic
;
CREATE TABLE `t_iccard_status` (
                                   `status`  int(11) NOT NULL COMMENT '卡状态' ,
                                   `description`  varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '描述' ,
                                   PRIMARY KEY (`status`)
)
    ENGINE=InnoDB
DEFAULT CHARACTER SET=utf8 COLLATE=utf8_general_ci
ROW_FORMAT=Dynamic
;
CREATE TABLE `t_iccard_type` (
                                 `type`  int(11) NOT NULL COMMENT '卡类型' ,
                                 `description`  varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '描述' ,
                                 PRIMARY KEY (`type`)
)
    ENGINE=InnoDB
DEFAULT CHARACTER SET=utf8 COLLATE=utf8_general_ci
ROW_FORMAT=Dynamic
;
CREATE TABLE `t_iccard_users` (
                                  `id`  int(11) NOT NULL AUTO_INCREMENT ,
                                  `userName`  varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '用户姓名' ,
                                  `userAge`  tinyint(4) NULL DEFAULT 0 COMMENT '年龄' ,
                                  `userSex`  tinyint(4) NULL DEFAULT 0 COMMENT '性别(0男，1女)' ,
                                  `idNumber`  varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '身份证号码' ,
                                  `phone`  varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '电话号码' ,
                                  `licencePlate`  varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '车牌号码' ,
                                  `createTime`  datetime NULL DEFAULT NULL COMMENT '添加日期' ,
                                  `tenant_id`  varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '000000' COMMENT '租户id（默认为000000）' ,
                                  PRIMARY KEY (`id`),
                                  UNIQUE INDEX `idNumber` (`idNumber`) USING BTREE
)
    ENGINE=InnoDB
DEFAULT CHARACTER SET=utf8 COLLATE=utf8_general_ci
ROW_FORMAT=Dynamic
;
CREATE TABLE `xhpc_activity_cash` (
                                      `activity_id`  int(11) NOT NULL AUTO_INCREMENT COMMENT '活动ID' ,
                                      `start_time`  datetime NULL DEFAULT NULL COMMENT '开始时间' ,
                                      `end_time`  datetime NULL DEFAULT NULL COMMENT '结束时间' ,
                                      `amount`  decimal(4,2) NULL DEFAULT NULL COMMENT '红包金额' ,
                                      `app_user_list`  text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT 'C端用户ID（-1表示全部）' ,
                                      `com_user_list`  text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '社区用户ID列表（-1表示全部）' ,
                                      `b_user_list`  text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT 'B端用户ID列表（-1表示全部）' ,
                                      `tenant_id`  varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '000000' COMMENT '租户ID' ,
                                      `status`  smallint(4) NULL DEFAULT 0 COMMENT '状态（0-编辑，1-提交待审核，2-审核失败，3-审核通过，4-立即失效）' ,
                                      `del_flag`  smallint(2) NULL DEFAULT 0 COMMENT '删除标记（0-正常，2-已删除）' ,
                                      `create_by`  varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建人' ,
                                      `create_time`  datetime NULL DEFAULT NULL COMMENT '更新时间' ,
                                      `update_by`  varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新人' ,
                                      `update_time`  datetime NULL DEFAULT NULL COMMENT '更新时间' ,
                                      `check_by`  varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '审核人' ,
                                      `check_time`  datetime NULL DEFAULT NULL COMMENT '审核时间' ,
                                      PRIMARY KEY (`activity_id`)
)
    ENGINE=InnoDB
DEFAULT CHARACTER SET=utf8mb4 COLLATE=utf8mb4_general_ci
ROW_FORMAT=Dynamic
;
CREATE TABLE `xhpc_activity_discount` (
                                          `activity_id`  int(11) NOT NULL AUTO_INCREMENT COMMENT '活动ID' ,
                                          `app_user_list`  text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT 'C端用户列表(以逗号分隔，-1表示全部用户)' ,
                                          `com_user_list`  text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '社区用户列表(以逗号分隔，-1表示全部用户)' ,
                                          `b_user_list`  text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT 'B端用户列表(以逗号分隔，-1表示全部用户)' ,
                                          `station_list`  text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '场站列表' ,
                                          `tenant_id`  varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '租户ID' ,
                                          `status`  smallint(2) NULL DEFAULT NULL COMMENT '状态（0-编辑，1-提交待审核，2-审核失败，3-审核通过，4-立即失效）' ,
                                          `del_flag`  smallint(2) NULL DEFAULT NULL COMMENT '删除标识（0-正常，2-删除）' ,
                                          `create_by`  varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建人' ,
                                          `create_time`  datetime NULL DEFAULT NULL COMMENT '创建时间' ,
                                          `update_by`  varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新人' ,
                                          `update_time`  datetime NULL DEFAULT NULL COMMENT '更新时间' ,
                                          `check_by`  varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '审核人' ,
                                          `check_time`  datetime NULL DEFAULT NULL COMMENT '审核时间' ,
                                          PRIMARY KEY (`activity_id`)
)
    ENGINE=InnoDB
DEFAULT CHARACTER SET=utf8mb4 COLLATE=utf8mb4_general_ci
ROW_FORMAT=Dynamic
;
CREATE TABLE `xhpc_activity_img` (
                                     `activity_img_id`  bigint(20) NOT NULL AUTO_INCREMENT COMMENT '图片ID' ,
                                     `activity_type`  varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '活动类型（CASH, DISCOUNT）' ,
                                     `activity_id`  int(11) NULL DEFAULT NULL COMMENT '活动ID' ,
                                     `img_name`  varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '图片名称' ,
                                     `img_url`  varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '图片地址' ,
                                     `del_flag`  smallint(2) NULL DEFAULT NULL COMMENT '删除标志（0-正常，2-已删除）' ,
                                     `create_by`  varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建人' ,
                                     `create_time`  datetime NULL DEFAULT NULL COMMENT '创建时间' ,
                                     PRIMARY KEY (`activity_img_id`)
)
    ENGINE=InnoDB
DEFAULT CHARACTER SET=utf8mb4 COLLATE=utf8mb4_general_ci
ROW_FORMAT=Dynamic
;
CREATE TABLE `xhpc_activity_internet` (
                                          `activity_id`  int(11) NOT NULL AUTO_INCREMENT COMMENT '活动ID' ,
                                          `activity_name`  varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '活动名称' ,
                                          `internet_name`  varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '流量方名称' ,
                                          `compute_type`  smallint(4) NULL DEFAULT NULL COMMENT '计算类型（1-总金额，2-服务费，3-电量）' ,
                                          `compute_formula`  varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '计算公式' ,
                                          `start_time`  datetime NULL DEFAULT NULL COMMENT '开始时间' ,
                                          `end_time`  datetime NULL DEFAULT NULL COMMENT '结束时间' ,
                                          `station_list`  text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '参与场站列表' ,
                                          `tenant_id`  varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '000000' COMMENT '租户ID' ,
                                          `status`  smallint(4) NULL DEFAULT 0 COMMENT '状态（0-编辑，1-提交生效，2-停用）' ,
                                          `del_flag`  smallint(2) NULL DEFAULT 0 COMMENT '删除标志（0-正常，2-删除）' ,
                                          `create_by`  varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建人' ,
                                          `create_time`  datetime NULL DEFAULT NULL COMMENT '创建时间' ,
                                          `update_by`  varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新人' ,
                                          `update_time`  datetime NULL DEFAULT NULL COMMENT '更新时间' ,
                                          PRIMARY KEY (`activity_id`)
)
    ENGINE=InnoDB
DEFAULT CHARACTER SET=utf8mb4 COLLATE=utf8mb4_general_ci
ROW_FORMAT=Dynamic
;
CREATE TABLE `xhpc_activity_record` (
                                        `activity_record_id`  bigint(20) NOT NULL AUTO_INCREMENT COMMENT '活动参与记录ID' ,
                                        `activity_type`  varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '活动类型（CASH,DISCOUNT）' ,
                                        `activity_id`  int(11) NULL DEFAULT NULL COMMENT '活动ID' ,
                                        `source`  smallint(4) NULL DEFAULT NULL COMMENT '人员类型（0 C端用户 1 流量方用户 2社区用户 3B端用户）' ,
                                        `user_id`  varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '用户ID' ,
                                        `amount`  decimal(4,2) NULL DEFAULT NULL COMMENT '红包金额' ,
                                        `create_time`  datetime NULL DEFAULT NULL COMMENT '领取时间' ,
                                        PRIMARY KEY (`activity_record_id`)
)
    ENGINE=InnoDB
DEFAULT CHARACTER SET=utf8mb4 COLLATE=utf8mb4_general_ci
ROW_FORMAT=Dynamic
;
CREATE TABLE `xhpc_activity_template` (
                                          `activity_temlpate_id`  int(11) NOT NULL AUTO_INCREMENT COMMENT '模板ID' ,
                                          `template_name`  varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '模板名称' ,
                                          `discount_type`  smallint(2) NULL DEFAULT NULL COMMENT '优惠类型（1-总金额，2-服务费，3-电量）' ,
                                          `discount_rate`  decimal(4,2) NULL DEFAULT NULL COMMENT '优惠比率' ,
                                          `start_time`  datetime NULL DEFAULT NULL COMMENT '开始时间' ,
                                          `end_time`  datetime NULL DEFAULT NULL COMMENT '结束时间' ,
                                          `discount_count`  smallint(4) NULL DEFAULT NULL COMMENT '折扣次数' ,
                                          `mini_display`  smallint(2) NULL DEFAULT NULL COMMENT '小程序弹出次数' ,
                                          `backgroud_url`  varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '活动背景图' ,
                                          `status`  smallint(2) NULL DEFAULT 0 COMMENT '状态（0-编辑未发布,1-已发布，2-已失效）' ,
                                          `del_flag`  smallint(2) NULL DEFAULT 0 COMMENT '删除标识（0-正常，2-删除）' ,
                                          `tenant_id`  varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '000000' COMMENT '租户ID' ,
                                          `create_by`  varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建人' ,
                                          `create_time`  datetime NULL DEFAULT NULL COMMENT '创建时间' ,
                                          `update_by`  varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新人' ,
                                          `update_time`  datetime NULL DEFAULT NULL COMMENT '更新时间' ,
                                          PRIMARY KEY (`activity_temlpate_id`)
)
    ENGINE=InnoDB
DEFAULT CHARACTER SET=utf8mb4 COLLATE=utf8mb4_general_ci
ROW_FORMAT=Dynamic
;
ALTER TABLE `xhpc_charge_order` DROP INDEX `sn_idx`;
ALTER TABLE `xhpc_charge_order` DROP INDEX `isn_idx`;
ALTER TABLE `xhpc_charge_order_voltage` DROP INDEX `charge_order_id_di`;
ALTER TABLE `xhpc_charging_station` MODIFY COLUMN `tenant_id`  varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '000000' COMMENT '租户id' AFTER `park_nums`;
ALTER TABLE `xhpc_device_message` MODIFY COLUMN `status`  int(10) NULL DEFAULT 0 COMMENT '状态（0正常 1停用）' AFTER `content`;
ALTER TABLE `xhpc_device_message` MODIFY COLUMN `create_time`  datetime NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '创建时间' AFTER `status`;
ALTER TABLE `xhpc_device_message` MODIFY COLUMN `create_by`  varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '创建者' AFTER `create_time`;
ALTER TABLE `xhpc_device_message` MODIFY COLUMN `update_time`  datetime NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间' AFTER `create_by`;
ALTER TABLE `xhpc_device_message` MODIFY COLUMN `update_by`  varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '更新者' AFTER `update_time`;
ALTER TABLE `xhpc_device_message` MODIFY COLUMN `remark`  text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '备注' AFTER `update_by`;
ALTER TABLE `xhpc_device_message` MODIFY COLUMN `tenant_id`  varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '000000' COMMENT '租户id' AFTER `remark`;
ALTER TABLE `xhpc_history_order` DROP INDEX `isnidx`;
ALTER TABLE `xhpc_history_order` DROP INDEX `snidx`;
ALTER TABLE `xhpc_history_order` MODIFY COLUMN `platform_commission`  decimal(10,2) NULL DEFAULT 0.00 COMMENT '平台总金额抽成' AFTER `internet_svc_commission`;
ALTER TABLE `xhpc_history_order` MODIFY COLUMN `platform_svc_commisssion`  decimal(10,2) NULL DEFAULT 0.00 COMMENT '平台服务费抽成' AFTER `platform_commission`;
ALTER TABLE `xhpc_history_order` MODIFY COLUMN `operation_commission`  decimal(10,2) NULL DEFAULT 0.00 COMMENT '运维总抽成' AFTER `platform_svc_commisssion`;
ALTER TABLE `xhpc_history_order` MODIFY COLUMN `operation_svc_commission`  decimal(10,2) NULL DEFAULT 0.00 COMMENT '运维服务费抽成' AFTER `operation_commission`;
ALTER TABLE `xhpc_history_order` MODIFY COLUMN `start_soc`  varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '开始充电soc' AFTER `operation_svc_commission`;
ALTER TABLE `xhpc_history_order` MODIFY COLUMN `end_soc`  varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '结束时soc' AFTER `start_soc`;
ALTER TABLE `xhpc_history_order` MODIFY COLUMN `reconciliation_status`  int(10) NULL DEFAULT NULL COMMENT '对账状态（0待确认 1已确认，2待提交，3待审核）' AFTER `end_soc`;
ALTER TABLE `xhpc_history_order` MODIFY COLUMN `sorting_status`  int(10) NULL DEFAULT 0 COMMENT '清分状态（0待清分 1清分在途，2已提现，3待提交，4待审核）' AFTER `reconciliation_status`;
ALTER TABLE `xhpc_history_order` MODIFY COLUMN `type`  tinyint(2) NULL DEFAULT NULL COMMENT '1 自动结算 2 平台结算' AFTER `sorting_status`;
ALTER TABLE `xhpc_history_order` MODIFY COLUMN `status`  int(10) NULL DEFAULT 0 COMMENT '状态（0正常 1停用）' AFTER `type`;
ALTER TABLE `xhpc_history_order` MODIFY COLUMN `del_flag`  int(2) NULL DEFAULT 0 COMMENT '删除标志（0代表存在 2代表删除）' AFTER `status`;
ALTER TABLE `xhpc_history_order` MODIFY COLUMN `create_time`  datetime NULL DEFAULT NULL COMMENT '创建时间' AFTER `del_flag`;
ALTER TABLE `xhpc_history_order` MODIFY COLUMN `create_by`  varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '创建者' AFTER `create_time`;
ALTER TABLE `xhpc_history_order` MODIFY COLUMN `update_time`  datetime NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间' AFTER `create_by`;
ALTER TABLE `xhpc_history_order` MODIFY COLUMN `update_by`  varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '更新者' AFTER `update_time`;
ALTER TABLE `xhpc_history_order` MODIFY COLUMN `remark`  varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注' AFTER `update_by`;
ALTER TABLE `xhpc_history_order` MODIFY COLUMN `state`  int(2) NULL DEFAULT 0 COMMENT '0未统计 1小时统计 2 其他统计' AFTER `remark`;
ALTER TABLE `xhpc_history_order` MODIFY COLUMN `vin_normal`  varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'VIN 码' AFTER `state`;
ALTER TABLE `xhpc_history_order` MODIFY COLUMN `search_value`  varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL AFTER `vin_normal`;
ALTER TABLE `xhpc_history_order` MODIFY COLUMN `operator_id_evcs`  varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '运营商在EVCS分配的唯一OperatorID' AFTER `search_value`;
ALTER TABLE `xhpc_history_order` MODIFY COLUMN `charge_model_evcs`  int(11) NULL DEFAULT NULL COMMENT '终端客户开启充电方式' AFTER `operator_id_evcs`;
ALTER TABLE `xhpc_history_order` MODIFY COLUMN `connector_power_evcs`  double NULL DEFAULT NULL COMMENT '接口额定功率' AFTER `charge_model_evcs`;
ALTER TABLE `xhpc_history_order` MODIFY COLUMN `meter_value_end_evcs`  double NULL DEFAULT NULL COMMENT '电表总起值' AFTER `connector_power_evcs`;
ALTER TABLE `xhpc_history_order` MODIFY COLUMN `meter_value_start_evcs`  double NULL DEFAULT NULL COMMENT '电表总结束值' AFTER `meter_value_end_evcs`;
ALTER TABLE `xhpc_history_order` MODIFY COLUMN `operator_id3rdpty_evcs`  varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '流量方OperatorID' AFTER `meter_value_start_evcs`;
ALTER TABLE `xhpc_history_order` MODIFY COLUMN `start_time`  datetime NULL DEFAULT NULL AFTER `operator_id3rdpty_evcs`;
ALTER TABLE `xhpc_history_order` MODIFY COLUMN `end_time`  datetime NULL DEFAULT NULL COMMENT '结束时间' AFTER `start_time`;
ALTER TABLE `xhpc_history_order` MODIFY COLUMN `stop_reason_evcs`  int(11) NULL DEFAULT NULL AFTER `end_time`;
ALTER TABLE `xhpc_history_order` MODIFY COLUMN `total_power`  double(10,2) NULL DEFAULT NULL COMMENT '电量' AFTER `stop_reason_evcs`;
ALTER TABLE `xhpc_history_order` MODIFY COLUMN `user_name_evcs`  varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL AFTER `total_power`;
ALTER TABLE `xhpc_history_order` MODIFY COLUMN `phone`  varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL AFTER `user_name_evcs`;
ALTER TABLE `xhpc_history_order` MODIFY COLUMN `evcs_order_no`  varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '互联网订单流水号' AFTER `phone`;
ALTER TABLE `xhpc_history_order` MODIFY COLUMN `confirm_Result`  int(4) NULL DEFAULT '-1' COMMENT '-1:未推送/推送失败 0:成功 1:争议交易 2～99:自定义' AFTER `evcs_order_no`;
ALTER TABLE `xhpc_history_order` MODIFY COLUMN `rate_model_id`  bigint(20) NULL DEFAULT NULL AFTER `confirm_Result`;
ALTER TABLE `xhpc_history_order` MODIFY COLUMN `charging_mode`  varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '充电方式' AFTER `rate_model_id`;
ALTER TABLE `xhpc_history_order` MODIFY COLUMN `tenant_id`  varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '000000' COMMENT '租户id' AFTER `source`;

ALTER TABLE `xhpc_img` DROP COLUMN `tenant_id`;
ALTER TABLE `xhpc_internet_user` MODIFY COLUMN `commission_type`  int(10) NULL DEFAULT 0 COMMENT '提成类型（0总金额提成 1服务费提成 2电量提成）' AFTER `detailed_address`;
ALTER TABLE `xhpc_internet_user` MODIFY COLUMN `tenant_id`  varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '000000' COMMENT '租户id' AFTER `search_value`;
ALTER TABLE `xhpc_invoice` ADD COLUMN `invoice_type`  int(1) NULL DEFAULT 0 COMMENT '发票类型（0，票普，1，专票，默认开的都是普票）' AFTER `invoice_id`;
ALTER TABLE `xhpc_invoice` ADD COLUMN `is_read`  tinyint(1) NULL DEFAULT NULL COMMENT '该发票是否被用户阅读（默认为null），0，表示未阅读，1表示已经阅读' AFTER `update_time`;
ALTER TABLE `xhpc_invoice` MODIFY COLUMN `creator_type`  int(1) NOT NULL COMMENT '创建者类型0 C端用户 1 流量方用户 2社区用户 3B端用户）' AFTER `creator_id`;
ALTER TABLE `xhpc_invoice` MODIFY COLUMN `creator`  varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人（用户账号）' AFTER `creator_type`;
ALTER TABLE `xhpc_invoice_map_history_order` ADD COLUMN `history_serial_number`  varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '该发票所选中的历史订单订单编号' AFTER `history_user_type`;
ALTER TABLE `xhpc_invoice_map_history_order` MODIFY COLUMN `history_user_type`  bigint(5) NULL DEFAULT NULL COMMENT '该发票所选中的历史订单的用户类型（0 C端用户 1 流量方用户 2社区用户 3B端用户）' AFTER `history_user_id`;
ALTER TABLE `xhpc_invoice_map_history_order` DROP COLUMN `hisotry_serial_number`;
ALTER TABLE `xhpc_message` DROP COLUMN `code`;

ALTER TABLE `xhpc_notice_read` MODIFY COLUMN `tenant_id`  varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '000000' COMMENT '租户id' AFTER `remark`;
ALTER TABLE `xhpc_operator` DROP INDEX `corp_no`;
ALTER TABLE `xhpc_operator` MODIFY COLUMN `corp_no`  varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '运营商代码,用于桩编号前缀,如808360代表翔桦' AFTER `operator_id`;
ALTER TABLE `xhpc_operator` DROP COLUMN `corp_type`;
ALTER TABLE `xhpc_real_time_order` MODIFY COLUMN `real_time_order_id`  bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id' FIRST ;
ALTER TABLE `xhpc_recharge_order` MODIFY COLUMN `type`  int(10) NULL DEFAULT 1 COMMENT '充值渠道（1微信 2支付宝  3平台)' AFTER `amount`;
ALTER TABLE `xhpc_recharge_order` MODIFY COLUMN `source`  int(10) NULL DEFAULT 0 COMMENT '订单来源（0 C端用户 1 流量方用户 2社区用户 3B端用户）' AFTER `status`;
ALTER TABLE `xhpc_refund_order` MODIFY COLUMN `open_id`  varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '微信支付订单号' AFTER `user_id`;
ALTER TABLE `xhpc_refund_order` MODIFY COLUMN `alipay_id`  varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '支付宝订单编号' AFTER `open_id`;
ALTER TABLE `xhpc_refund_order` MODIFY COLUMN `create_time`  datetime NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '创建时间' AFTER `del_flag`;
ALTER TABLE `xhpc_refund_order` MODIFY COLUMN `remark`  varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注' AFTER `update_by`;
ALTER TABLE `xhpc_refund_order` MODIFY COLUMN `payment_time`  varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '付款成功时间' AFTER `payment_no`;
ALTER TABLE `xhpc_station_internet_blacklist` MODIFY COLUMN `tenant_id`  varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '000000' COMMENT '租户id' AFTER `operator_id_evcs`;
ALTER TABLE `xhpc_statistics_station` MODIFY COLUMN `platform_commission`  decimal(10,2) NULL DEFAULT 0.00 COMMENT '平台总金额抽成' AFTER `internet_svc_commission`;
ALTER TABLE `xhpc_statistics_station` MODIFY COLUMN `platform_svc_commisssion`  decimal(10,2) NULL DEFAULT 0.00 COMMENT '平台服务费抽成' AFTER `platform_commission`;
ALTER TABLE `xhpc_statistics_station` MODIFY COLUMN `operation_commission`  decimal(10,2) NULL DEFAULT 0.00 COMMENT '运维总抽成' AFTER `platform_svc_commisssion`;
ALTER TABLE `xhpc_statistics_station` MODIFY COLUMN `operation_svc_commission`  decimal(10,2) NULL DEFAULT 0.00 COMMENT '运维服务费抽成' AFTER `operation_commission`;
ALTER TABLE `xhpc_statistics_station` MODIFY COLUMN `operator_id`  bigint(20) NULL DEFAULT NULL COMMENT '运营商id' AFTER `operation_svc_commission`;
ALTER TABLE `xhpc_statistics_station` MODIFY COLUMN `internet_user_id`  bigint(20) NULL DEFAULT NULL COMMENT '流量方' AFTER `operator_id`;
ALTER TABLE `xhpc_statistics_station` MODIFY COLUMN `charging_pile_id`  bigint(20) NULL DEFAULT NULL COMMENT '电桩id' AFTER `internet_user_id`;
ALTER TABLE `xhpc_statistics_station` MODIFY COLUMN `del_flag`  int(2) NULL DEFAULT 0 COMMENT '删除标志（0代表存在 2代表删除）' AFTER `charging_pile_id`;
ALTER TABLE `xhpc_statistics_station` MODIFY COLUMN `create_time`  datetime NULL DEFAULT NULL COMMENT '创建时间' AFTER `del_flag`;
ALTER TABLE `xhpc_statistics_station` MODIFY COLUMN `create_by`  varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '创建者' AFTER `create_time`;
ALTER TABLE `xhpc_statistics_station` MODIFY COLUMN `update_time`  datetime NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间' AFTER `create_by`;
ALTER TABLE `xhpc_statistics_station` MODIFY COLUMN `update_by`  varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '更新者' AFTER `update_time`;
ALTER TABLE `xhpc_statistics_station` MODIFY COLUMN `remark`  varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注' AFTER `update_by`;
ALTER TABLE `xhpc_statistics_station` MODIFY COLUMN `charging_station_id`  bigint(20) NULL DEFAULT NULL COMMENT '场站id' AFTER `remark`;
ALTER TABLE `xhpc_statistics_station` MODIFY COLUMN `terminal_id`  bigint(20) NULL DEFAULT NULL COMMENT '终端id' AFTER `charging_station_id`;
ALTER TABLE `xhpc_statistics_station` MODIFY COLUMN `type`  int(4) NULL DEFAULT NULL COMMENT '1.日期 2.场站 3.桩' AFTER `terminal_id`;
ALTER TABLE `xhpc_statistics_station` MODIFY COLUMN `history_order_id`  bigint(20) NULL DEFAULT NULL COMMENT '历史订单id' AFTER `type`;
ALTER TABLE `xhpc_statistics_station` MODIFY COLUMN `charging_mode`  varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '充电方式' AFTER `history_order_id`;
ALTER TABLE `xhpc_statistics_time_interval` MODIFY COLUMN `platform_commission`  decimal(10,2) NULL DEFAULT 0.00 COMMENT '平台总金额抽成' AFTER `internet_svc_commission`;
ALTER TABLE `xhpc_statistics_time_interval` MODIFY COLUMN `platform_svc_commisssion`  decimal(10,2) NULL DEFAULT 0.00 COMMENT '平台服务费抽成' AFTER `platform_commission`;
ALTER TABLE `xhpc_statistics_time_interval` MODIFY COLUMN `operation_commission`  decimal(10,2) NULL DEFAULT 0.00 COMMENT '运维总抽成' AFTER `platform_svc_commisssion`;
ALTER TABLE `xhpc_statistics_time_interval` MODIFY COLUMN `operation_svc_commission`  decimal(10,2) NULL DEFAULT 0.00 COMMENT '运维服务费抽成' AFTER `operation_commission`;
ALTER TABLE `xhpc_statistics_time_interval` MODIFY COLUMN `operator_id`  bigint(20) NULL DEFAULT NULL COMMENT '运营商id' AFTER `operation_svc_commission`;
ALTER TABLE `xhpc_statistics_time_interval` MODIFY COLUMN `internet_user_id`  bigint(20) NULL DEFAULT NULL COMMENT '流量方' AFTER `operator_id`;
ALTER TABLE `xhpc_statistics_time_interval` MODIFY COLUMN `charging_station_id`  bigint(20) NULL DEFAULT NULL COMMENT '电站id' AFTER `internet_user_id`;
ALTER TABLE `xhpc_statistics_time_interval` MODIFY COLUMN `del_flag`  int(2) NULL DEFAULT 0 COMMENT '删除标志（0代表存在 2代表删除）' AFTER `charging_station_id`;
ALTER TABLE `xhpc_statistics_time_interval` MODIFY COLUMN `create_time`  datetime NULL DEFAULT NULL COMMENT '创建时间' AFTER `del_flag`;
ALTER TABLE `xhpc_statistics_time_interval` MODIFY COLUMN `create_by`  varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '创建者' AFTER `create_time`;
ALTER TABLE `xhpc_statistics_time_interval` MODIFY COLUMN `update_time`  datetime NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间' AFTER `create_by`;
ALTER TABLE `xhpc_statistics_time_interval` MODIFY COLUMN `update_by`  varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '更新者' AFTER `update_time`;
ALTER TABLE `xhpc_statistics_time_interval` MODIFY COLUMN `remark`  varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注' AFTER `update_by`;
ALTER TABLE `xhpc_statistics_time_interval` MODIFY COLUMN `terminal_id`  bigint(20) NULL DEFAULT NULL COMMENT '终端id' AFTER `remark`;
ALTER TABLE `xhpc_statistics_time_interval` MODIFY COLUMN `history_order_id`  bigint(20) NULL DEFAULT NULL COMMENT '历史订单id' AFTER `terminal_id`;
ALTER TABLE `xhpc_statistics_time_interval` MODIFY COLUMN `start_time_evcs`  varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'EVCS开始时间(格式:yyyy-MM-dd HH:mm:ss)' AFTER `history_order_id`;
ALTER TABLE `xhpc_statistics_time_interval` MODIFY COLUMN `end_time_evcs`  varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'EVCS结束时间(格式:yyyy-MM-dd HH:mm:ss)' AFTER `start_time_evcs`;
ALTER TABLE `xhpc_statistics_time_interval` MODIFY COLUMN `elec_price_evcs`  decimal(10,2) NULL DEFAULT NULL COMMENT 'EVCS时段电价(单价)' AFTER `end_time_evcs`;
ALTER TABLE `xhpc_statistics_time_interval` MODIFY COLUMN `service_price_evcs`  decimal(10,2) NULL DEFAULT NULL COMMENT 'EVCS时段服务费价格(单价)' AFTER `elec_price_evcs`;


ALTER TABLE `xhpc_tradebill_internet_check_record` MODIFY COLUMN `id`  int(11) NOT NULL AUTO_INCREMENT COMMENT 'ID' FIRST ;
ALTER TABLE `xhpc_tradebill_internet_check_record` MODIFY COLUMN `create_time`  datetime(6) NOT NULL COMMENT '创建时间' AFTER `id`;
ALTER TABLE `xhpc_tradebill_internet_check_record` MODIFY COLUMN `create_by`  varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '创建人' AFTER `create_time`;
ALTER TABLE `xhpc_tradebill_internet_check_record` MODIFY COLUMN `update_time`  datetime(6) NOT NULL COMMENT '更新时间' AFTER `create_by`;
ALTER TABLE `xhpc_tradebill_internet_check_record` MODIFY COLUMN `update_by`  varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '更新人' AFTER `update_time`;
ALTER TABLE `xhpc_tradebill_internet_check_record` MODIFY COLUMN `upload_id`  int(11) NOT NULL COMMENT '文件上传ID' AFTER `update_by`;
ALTER TABLE `xhpc_tradebill_internet_check_record` MODIFY COLUMN `history_order_no`  bigint(20) NULL DEFAULT NULL COMMENT '历史订单ID' AFTER `upload_id`;
ALTER TABLE `xhpc_tradebill_internet_check_record` MODIFY COLUMN `user_id`  varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '用户ID' AFTER `history_order_no`;
ALTER TABLE `xhpc_tradebill_internet_check_record` MODIFY COLUMN `internet_name`  varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '流量方' AFTER `user_id`;
ALTER TABLE `xhpc_tradebill_internet_check_record` MODIFY COLUMN `platform_internet_serial_number`  varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '平台-第三方订单号' AFTER `internet_name`;
ALTER TABLE `xhpc_tradebill_internet_check_record` MODIFY COLUMN `platform_serial_number`  varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '平台-订单号' AFTER `platform_internet_serial_number`;
ALTER TABLE `xhpc_tradebill_internet_check_record` MODIFY COLUMN `platform_charge_station`  varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '平台-场站名称' AFTER `platform_serial_number`;
ALTER TABLE `xhpc_tradebill_internet_check_record` MODIFY COLUMN `platform_start_soc`  varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '平台-开始SOC' AFTER `platform_charge_station`;
ALTER TABLE `xhpc_tradebill_internet_check_record` MODIFY COLUMN `platform_end_soc`  varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '平台-结束SOC' AFTER `platform_start_soc`;
ALTER TABLE `xhpc_tradebill_internet_check_record` MODIFY COLUMN `platform_charging_degree`  decimal(10,2) NULL DEFAULT NULL COMMENT '平台-充电电量' AFTER `platform_end_soc`;
ALTER TABLE `xhpc_tradebill_internet_check_record` MODIFY COLUMN `platform_charging_time`  varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '平台-充电时长' AFTER `platform_charging_degree`;
ALTER TABLE `xhpc_tradebill_internet_check_record` MODIFY COLUMN `platform_start_time`  datetime(6) NULL DEFAULT NULL COMMENT '平台-开始充电时间' AFTER `platform_charging_time`;
ALTER TABLE `xhpc_tradebill_internet_check_record` MODIFY COLUMN `platform_end_time`  datetime(6) NULL DEFAULT NULL COMMENT '平台-结束充电时间' AFTER `platform_start_time`;
ALTER TABLE `xhpc_tradebill_internet_check_record` MODIFY COLUMN `platform_order_amount`  decimal(10,2) NULL DEFAULT NULL COMMENT '平台-订单总金额' AFTER `platform_end_time`;
ALTER TABLE `xhpc_tradebill_internet_check_record` MODIFY COLUMN `platform_power_amount`  decimal(10,2) NULL DEFAULT NULL COMMENT '平台-电费' AFTER `platform_order_amount`;
ALTER TABLE `xhpc_tradebill_internet_check_record` MODIFY COLUMN `platform_server_amount`  decimal(10,2) NULL DEFAULT NULL COMMENT '平台-服务费' AFTER `platform_power_amount`;
ALTER TABLE `xhpc_tradebill_internet_check_record` MODIFY COLUMN `platform_discount_amount`  decimal(10,2) NULL DEFAULT NULL COMMENT '平台-折扣金额' AFTER `platform_server_amount`;
ALTER TABLE `xhpc_tradebill_internet_check_record` MODIFY COLUMN `platform_pay_amount`  decimal(10,2) NULL DEFAULT NULL COMMENT '平台-支付金额' AFTER `platform_discount_amount`;
ALTER TABLE `xhpc_tradebill_internet_check_record` MODIFY COLUMN `internet_serial_number`  varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '流量方-订单号' AFTER `platform_pay_amount`;
ALTER TABLE `xhpc_tradebill_internet_check_record` MODIFY COLUMN `internet_charge_station`  varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '流量方-场站名称' AFTER `internet_serial_number`;
ALTER TABLE `xhpc_tradebill_internet_check_record` MODIFY COLUMN `internet_start_soc`  varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '流量方-开始SOC' AFTER `internet_charge_station`;
ALTER TABLE `xhpc_tradebill_internet_check_record` MODIFY COLUMN `internet_end_soc`  varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '流量方-结束SOC' AFTER `internet_start_soc`;
ALTER TABLE `xhpc_tradebill_internet_check_record` MODIFY COLUMN `internet_charging_degree`  decimal(10,2) NULL DEFAULT NULL COMMENT '流量方-充电电量' AFTER `internet_end_soc`;
ALTER TABLE `xhpc_tradebill_internet_check_record` MODIFY COLUMN `internet_charging_time`  varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '流量方-充电时长（单位：分钟）' AFTER `internet_charging_degree`;
ALTER TABLE `xhpc_tradebill_internet_check_record` MODIFY COLUMN `internet_start_time`  datetime(6) NULL DEFAULT NULL COMMENT '流量方-开始充电时间' AFTER `internet_charging_time`;
ALTER TABLE `xhpc_tradebill_internet_check_record` MODIFY COLUMN `internet_end_time`  datetime(6) NULL DEFAULT NULL COMMENT '流量方-结束充电时间' AFTER `internet_start_time`;
ALTER TABLE `xhpc_tradebill_internet_check_record` MODIFY COLUMN `internet_order_amount`  decimal(10,2) NULL DEFAULT NULL COMMENT '流量方-订单总金额' AFTER `internet_end_time`;
ALTER TABLE `xhpc_tradebill_internet_check_record` MODIFY COLUMN `internet_power_amount`  decimal(10,2) NULL DEFAULT NULL COMMENT '流量方-电费' AFTER `internet_order_amount`;
ALTER TABLE `xhpc_tradebill_internet_check_record` MODIFY COLUMN `internet_server_amount`  decimal(10,2) NULL DEFAULT NULL COMMENT '流量方-服务费' AFTER `internet_power_amount`;
ALTER TABLE `xhpc_tradebill_internet_check_record` MODIFY COLUMN `internet_discount_amount`  decimal(10,2) NULL DEFAULT NULL COMMENT '流量方-折扣费' AFTER `internet_server_amount`;
ALTER TABLE `xhpc_tradebill_internet_check_record` MODIFY COLUMN `internet_pay_amount`  decimal(10,2) NULL DEFAULT NULL COMMENT '流量方-支付金额' AFTER `internet_discount_amount`;
ALTER TABLE `xhpc_tradebill_internet_check_record` MODIFY COLUMN `remark`  varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '备注' AFTER `internet_pay_amount`;
ALTER TABLE `xhpc_tradebill_internet_check_record` MODIFY COLUMN `status`  smallint(6) NOT NULL COMMENT '状态（0-待对账，1-对账异常，2-对账正常）' AFTER `remark`;
ALTER TABLE `xhpc_tradebill_payment_check_record` MODIFY COLUMN `id`  int(11) NOT NULL AUTO_INCREMENT COMMENT 'ID' FIRST ;
ALTER TABLE `xhpc_tradebill_payment_check_record` MODIFY COLUMN `create_time`  datetime(6) NOT NULL COMMENT '创建时间' AFTER `id`;
ALTER TABLE `xhpc_tradebill_payment_check_record` MODIFY COLUMN `create_by`  varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '创建人' AFTER `create_time`;
ALTER TABLE `xhpc_tradebill_payment_check_record` MODIFY COLUMN `update_time`  datetime(6) NOT NULL COMMENT '更新时间' AFTER `create_by`;
ALTER TABLE `xhpc_tradebill_payment_check_record` MODIFY COLUMN `update_by`  varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '更新人' AFTER `update_time`;
ALTER TABLE `xhpc_tradebill_payment_check_record` MODIFY COLUMN `upload_id`  int(11) NOT NULL COMMENT '文件上传ID' AFTER `update_by`;
ALTER TABLE `xhpc_tradebill_payment_check_record` MODIFY COLUMN `order_type`  smallint(6) NULL DEFAULT NULL COMMENT '订单类型（1-充值，2-退款）' AFTER `upload_id`;
ALTER TABLE `xhpc_tradebill_payment_check_record` MODIFY COLUMN `payment_channel`  smallint(6) NULL DEFAULT NULL COMMENT '充值渠道（1微信 2支付宝）' AFTER `order_type`;
ALTER TABLE `xhpc_tradebill_payment_check_record` MODIFY COLUMN `platform_order_number`  varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '平台-订单ID' AFTER `payment_channel`;
ALTER TABLE `xhpc_tradebill_payment_check_record` MODIFY COLUMN `platform_pay_number`  varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '平台-支付订单号' AFTER `platform_order_number`;
ALTER TABLE `xhpc_tradebill_payment_check_record` MODIFY COLUMN `platform_user_id`  varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '平台-用户ID' AFTER `platform_pay_number`;
ALTER TABLE `xhpc_tradebill_payment_check_record` MODIFY COLUMN `platform_amount`  decimal(10,2) NULL DEFAULT NULL COMMENT '平台-金额' AFTER `platform_user_id`;
ALTER TABLE `xhpc_tradebill_payment_check_record` MODIFY COLUMN `platform_pay_time`  datetime(6) NULL DEFAULT NULL COMMENT '平台-支付时间' AFTER `platform_amount`;
ALTER TABLE `xhpc_tradebill_payment_check_record` MODIFY COLUMN `payment_pay_number`  varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '支付方-订单号' AFTER `platform_pay_time`;
ALTER TABLE `xhpc_tradebill_payment_check_record` MODIFY COLUMN `payment_user_id`  varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '支付方-用户ID' AFTER `payment_pay_number`;
ALTER TABLE `xhpc_tradebill_payment_check_record` MODIFY COLUMN `payment_amount`  decimal(10,2) NULL DEFAULT NULL COMMENT '支付方-支付金额' AFTER `payment_user_id`;
ALTER TABLE `xhpc_tradebill_payment_check_record` MODIFY COLUMN `payment_pay_time`  datetime(6) NULL DEFAULT NULL COMMENT '支付方-支付时间' AFTER `payment_amount`;
ALTER TABLE `xhpc_tradebill_payment_check_record` MODIFY COLUMN `status`  smallint(6) NOT NULL COMMENT '状态（0-待对账，1-对账异常，2-对账正常）' AFTER `payment_pay_time`;
ALTER TABLE `xhpc_tradebill_payment_check_record` MODIFY COLUMN `remark`  varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '备注' AFTER `status`;
ALTER TABLE `xhpc_tradebill_upload_record` MODIFY COLUMN `id`  int(11) NOT NULL AUTO_INCREMENT COMMENT 'ID' FIRST ;
ALTER TABLE `xhpc_tradebill_upload_record` MODIFY COLUMN `create_time`  datetime(6) NOT NULL COMMENT '创建时间' AFTER `id`;
ALTER TABLE `xhpc_tradebill_upload_record` MODIFY COLUMN `create_by`  varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '创建人' AFTER `create_time`;
ALTER TABLE `xhpc_tradebill_upload_record` MODIFY COLUMN `update_time`  datetime(6) NOT NULL COMMENT '更新时间' AFTER `create_by`;
ALTER TABLE `xhpc_tradebill_upload_record` MODIFY COLUMN `update_by`  varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '更新人' AFTER `update_time`;
ALTER TABLE `xhpc_tradebill_upload_record` MODIFY COLUMN `source`  varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '来源' AFTER `update_by`;
ALTER TABLE `xhpc_tradebill_upload_record` MODIFY COLUMN `file_name`  varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '文件名称' AFTER `source`;
ALTER TABLE `xhpc_tradebill_upload_record` MODIFY COLUMN `url`  varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '文件地址' AFTER `file_name`;
ALTER TABLE `xhpc_tradebill_upload_record` MODIFY COLUMN `type`  smallint(6) NOT NULL COMMENT '文件类型（1-微信充值，2-微信退款，3-支付宝充值，4-支付宝退款，5-恒大，6-小桔，7-新电途，8-特来电）' AFTER `url`;
ALTER TABLE `xhpc_tradebill_upload_record` MODIFY COLUMN `status`  smallint(6) NOT NULL COMMENT '状态（0-未对账，1-已对账）' AFTER `type`;
ALTER TABLE `xhpc_tradebill_upload_record` MODIFY COLUMN `del_flag`  smallint(6) NOT NULL COMMENT '删除标识（0-正常，2-已删除）' AFTER `status`;
ALTER TABLE `xhpc_tradebill_upload_record` MODIFY COLUMN `success_count`  int(11) NOT NULL COMMENT '对账成功记录数量' AFTER `del_flag`;
ALTER TABLE `xhpc_tradebill_upload_record` MODIFY COLUMN `fail_count`  int(11) NOT NULL COMMENT '对账失败记录数量' AFTER `success_count`;
ALTER TABLE `xhpc_tradebill_upload_record` MODIFY COLUMN `uncheck_count`  int(11) NOT NULL COMMENT '未对账记录数量' AFTER `fail_count`;
ALTER TABLE `xhpc_tradebill_upload_record` MODIFY COLUMN `checked_count`  int(11) NOT NULL COMMENT '已对账记录数量' AFTER `uncheck_count`;
ALTER TABLE `xhpc_tradebill_upload_record` MODIFY COLUMN `tenant_id`  varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '000000' COMMENT '租户id' AFTER `checked_count`;
ALTER TABLE `xhpc_user_account_statement` MODIFY COLUMN `type`  int(10) NULL DEFAULT NULL COMMENT '类型（1充值 2退款 3充电）' AFTER `refund_order_id`;
ALTER TABLE `xhpc_user_account_statement` MODIFY COLUMN `create_time`  datetime NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '创建时间' AFTER `del_flag`;
ALTER TABLE `xhpc_user_account_statement` MODIFY COLUMN `tenant_id`  varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '000000' COMMENT '租户id' AFTER `remark`;
ALTER TABLE `xhpc_user_account_statement` MODIFY COLUMN `source`  int(4) NULL DEFAULT 0 COMMENT '订单来源（0 C端用户 1 流量方用户 2社区用户 3B端用户）' AFTER `tenant_id`;
ALTER TABLE `xhpc_work_order_user` MODIFY COLUMN `id`  bigint(20) NOT NULL AUTO_INCREMENT FIRST ;


CREATE TABLE `xhpc_ic_card_info` (
                                     `ic_card_info_id`  bigint(11) NOT NULL AUTO_INCREMENT COMMENT '记录id' ,
                                     `t_iccard_info_id`  varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT 't_iccard_info表中的卡记录的id' ,
                                     `use_status`  bigint(2) NULL DEFAULT 0 COMMENT '卡使用状态（0未使用，1已绑定）' ,
                                     `create_time`  datetime NULL DEFAULT NULL COMMENT '绑卡日期' ,
                                     `user_id`  int(11) NULL DEFAULT NULL COMMENT '用户id' ,
                                     `user_account`  varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '用户账户' ,
                                     `user_type`  bigint(2) NULL DEFAULT NULL COMMENT '用户类型（0 C端用户 1 流量方用户 2社区用户 3B端用户）' ,
                                     `user_name`  varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '用户姓名' ,
                                     `user_id_card`  varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '用户身份证' ,
                                     `user_age`  bigint(3) NULL DEFAULT NULL COMMENT '用户年龄' ,
                                     `user_sex`  bigint(2) NULL DEFAULT NULL COMMENT '用户性别（0女，1男）' ,
                                     `user_phone`  varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '用户手机号码' ,
                                     `user_vehicle`  varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '用户车牌号码' ,
                                     `del_flag`  bigint(2) NULL DEFAULT 0 COMMENT '逻辑删除字段（默认为0，1为删除）' ,
                                     `tenant_id`  varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '租户id' ,
                                     PRIMARY KEY (`ic_card_info_id`)
)
    ENGINE=InnoDB
DEFAULT CHARACTER SET=utf8 COLLATE=utf8_general_ci
ROW_FORMAT=Dynamic
;
CREATE TABLE `xhpc_message_board_receive_user` (
                                                   `tenant_id`  varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '接收者id（租户id）' ,
                                                   `tenant_type`  int(2) NULL DEFAULT NULL COMMENT '接收者类型（租户类型 0，为默认类型）' ,
                                                   `sender_account`  varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '发送者账号' ,
                                                   `sender_type`  int(11) NULL DEFAULT NULL COMMENT '发送者类型（0 C端用户 1 流量方用户 2社区用户 3B端用户）' ,
                                                   `user_icon`  text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '用户头像地址' ,
                                                   `have_new_info`  tinyint(1) NULL DEFAULT NULL COMMENT '是否有新消息（0表示有新消息，null表示没有）' ,
                                                   `new_info_time`  datetime NULL DEFAULT NULL COMMENT '新消息发送时间' ,
                                                   `del_flag`  tinyint(1) NULL DEFAULT NULL COMMENT '逻辑删除（0为删除）'
)
    ENGINE=InnoDB
DEFAULT CHARACTER SET=utf8mb4 COLLATE=utf8mb4_general_ci
ROW_FORMAT=Dynamic
;
CREATE TABLE `xhpc_timing_charging_cache_rate_model` (
                                                         `timing_charging_cache_rate_model_id`  bigint(20) NOT NULL AUTO_INCREMENT ,
                                                         `timing_charging_model_id`  bigint(20) NOT NULL ,
                                                         `one_price`  int(8) NULL DEFAULT NULL COMMENT '尖电价 所有价格精度' ,
                                                         `one_svc_price`  int(8) NULL DEFAULT NULL COMMENT '尖服务费价格' ,
                                                         `two_price`  int(8) NULL DEFAULT NULL COMMENT '峰电价' ,
                                                         `two_svc_price`  int(8) NULL DEFAULT NULL COMMENT '峰服务费价格' ,
                                                         `three_price`  int(8) NULL DEFAULT NULL COMMENT '平电价' ,
                                                         `three_svc_price`  int(8) NULL DEFAULT NULL COMMENT '平服务费价格' ,
                                                         `four_price`  int(8) NULL DEFAULT NULL COMMENT '谷电价' ,
                                                         `four_svc_price`  int(8) NULL DEFAULT NULL COMMENT '谷服务费价格' ,
                                                         `loss_rate`  int(4) NULL DEFAULT NULL COMMENT '计损比例' ,
                                                         `tf_prices_seq`  varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '48个字符串48个时段,每个时段的值为4个值之一 → 00: 尖费率 01: 峰费率 02: 平费率 03: 谷费率' ,
                                                         `pp`  varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '00:00~07:00,0.16格式电费/服务费' ,
                                                         `status`  int(10) NULL DEFAULT 0 COMMENT '状态（0正常 1停用）' ,
                                                         `del_flag`  int(2) NULL DEFAULT 0 COMMENT '删除标志（0代表存在 2代表删除）' ,
                                                         `create_time`  datetime NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '创建时间' ,
                                                         `create_by`  varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '创建者' ,
                                                         `update_time`  datetime NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间' ,
                                                         `update_by`  varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '更新者' ,
                                                         `remark`  varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注' ,
                                                         `tenant_id`  varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL ,
                                                         `charging_station_id`  bigint(20) NULL DEFAULT NULL COMMENT '场站id' ,
                                                         `phone`  varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新失败联系人' ,
                                                         PRIMARY KEY (`timing_charging_cache_rate_model_id`)
)
    ENGINE=InnoDB
DEFAULT CHARACTER SET=utf8mb4 COLLATE=utf8mb4_general_ci
ROW_FORMAT=Dynamic
;
CREATE TABLE `xhpc_timing_charging_model` (
                                              `timing_charging_model_id`  bigint(20) NOT NULL AUTO_INCREMENT ,
                                              `reason`  varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '调整原因' ,
                                              `charging_station_id`  bigint(20) NULL DEFAULT NULL COMMENT '场站id' ,
                                              `timing_time`  datetime NOT NULL COMMENT '定时时间' ,
                                              `error_reason`  text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '失败原因' ,
                                              `number`  int(2) NULL DEFAULT 0 COMMENT '次数' ,
                                              `status`  int(10) NULL DEFAULT 0 COMMENT '状态（0未执行 1已执行 2执行错误）' ,
                                              `del_flag`  int(2) NULL DEFAULT 0 COMMENT '删除标志（0代表存在 2代表删除）' ,
                                              `create_time`  datetime NULL DEFAULT NULL COMMENT '创建时间' ,
                                              `create_by`  varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '创建者' ,
                                              `update_time`  datetime NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间' ,
                                              `update_by`  varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '更新者' ,
                                              `remark`  varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注' ,
                                              `tenant_id`  varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '000000' COMMENT '租户id' ,
                                              `phone`  varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新失败联系人' ,
                                              PRIMARY KEY (`timing_charging_model_id`)
)
    ENGINE=InnoDB
DEFAULT CHARACTER SET=utf8mb4 COLLATE=utf8mb4_general_ci
ROW_FORMAT=Dynamic
;
CREATE TABLE `xhpc_timing_charging_rate` (
                                             `timing_charging_rate_id`  bigint(20) NOT NULL AUTO_INCREMENT COMMENT '费率id' ,
                                             `charging_station_id`  bigint(20) NULL DEFAULT NULL COMMENT '电站id' ,
                                             `power_fee`  decimal(10,5) NULL DEFAULT NULL COMMENT '电费' ,
                                             `service_fee`  decimal(10,5) NULL DEFAULT NULL COMMENT '服务费' ,
                                             `name`  varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '名称' ,
                                             `status`  int(10) NULL DEFAULT 0 COMMENT '状态（0正常 1停用）' ,
                                             `del_flag`  int(2) NULL DEFAULT 0 COMMENT '删除标志（0代表存在 2代表删除）' ,
                                             `create_time`  datetime NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '创建时间' ,
                                             `create_by`  varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '创建者' ,
                                             `update_time`  datetime NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间' ,
                                             `update_by`  varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '更新者' ,
                                             `remark`  varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注' ,
                                             `rate_value`  varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '费率类型 00: 尖费率 01: 峰费率 02: 平费率 03: 谷费率' ,
                                             `tenant_id`  varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '000000' COMMENT '租户id' ,
                                             `timing_charging_model_id`  bigint(20) NOT NULL COMMENT '计费模型id' ,
                                             PRIMARY KEY (`timing_charging_rate_id`)
)
    ENGINE=InnoDB
DEFAULT CHARACTER SET=utf8mb4 COLLATE=utf8mb4_general_ci
ROW_FORMAT=Dynamic
;
CREATE TABLE `xhpc_timing_charging_time` (
                                             `timing_charging_time_id`  bigint(20) NOT NULL AUTO_INCREMENT COMMENT '费率时段id' ,
                                             `charging_station_id`  bigint(20) NULL DEFAULT NULL COMMENT '电站id' ,
                                             `timing_charging_rate_id`  bigint(20) NULL DEFAULT NULL COMMENT '费率id' ,
                                             `start_time`  time NULL DEFAULT NULL COMMENT '启始时间' ,
                                             `end_time`  time NULL DEFAULT NULL COMMENT '结束时间' ,
                                             `status`  int(10) NULL DEFAULT 0 COMMENT '状态（0正常 1停用）' ,
                                             `del_flag`  int(2) NULL DEFAULT 0 COMMENT '删除标志（0代表存在 2代表删除）' ,
                                             `create_time`  datetime NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '创建时间' ,
                                             `create_by`  varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '创建者' ,
                                             `update_time`  datetime NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间' ,
                                             `update_by`  varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '更新者' ,
                                             `remark`  varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注' ,
                                             `sort`  int(4) NULL DEFAULT 1 COMMENT '时间排序' ,
                                             `type`  int(2) NULL DEFAULT 1 COMMENT '1 设置时间段  2默认时间段' ,
                                             `rate_value`  varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '费率类型 00: 尖费率 01: 峰费率 02: 平费率 03: 谷费率' ,
                                             `tenant_id`  varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '000000' COMMENT '租户id' ,
                                             `timing_charging_model_id`  bigint(20) NOT NULL COMMENT '计费模型id' ,
                                             PRIMARY KEY (`timing_charging_time_id`)
)
    ENGINE=InnoDB
DEFAULT CHARACTER SET=utf8mb4 COLLATE=utf8mb4_general_ci
ROW_FORMAT=Dynamic
;
CREATE TABLE `xhpc_work_type_dict` (
                                       `work_type_id`  int(11) NOT NULL AUTO_INCREMENT ,
                                       `name`  varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '类型名称' ,
                                       `parent_type_id`  int(11) NULL DEFAULT NULL COMMENT '父级类型ID' ,
                                       `status`  smallint(2) NULL DEFAULT NULL COMMENT '状态（0:禁用，1-启用）' ,
                                       `del_flag`  smallint(2) NULL DEFAULT NULL COMMENT '删除标志（0-正常，2-已删除）' ,
                                       `sort`  smallint(4) NULL DEFAULT 0 COMMENT '排序' ,
                                       `tenant_id`  varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '000000' COMMENT '租户ID' ,
                                       `create_by`  varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建人' ,
                                       `create_time`  datetime NULL DEFAULT NULL COMMENT '创建时间' ,
                                       `update_by`  varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新人' ,
                                       `update_time`  datetime NULL DEFAULT NULL COMMENT '更新时间' ,
                                       PRIMARY KEY (`work_type_id`)
)
    ENGINE=InnoDB
DEFAULT CHARACTER SET=utf8mb4 COLLATE=utf8mb4_general_ci
ROW_FORMAT=Dynamic
;

ALTER TABLE `xhpc_community`
    ADD COLUMN `commission_type` INT(4) NULL COMMENT ' 0总金额提成 1服务费提成 2电量抽成' AFTER `tenant_id`;

ALTER TABLE `xhpc_customers`
    ADD COLUMN `commission_type` INT(4) NULL COMMENT '0总金额提成 1服务费提成 2电量抽成' AFTER `tenant_id`;


