CREATE TABLE `AR_BA_APPROACH_ORDER_GOODS` (
  `ID` varchar(32) COLLATE utf8mb4_bin NOT NULL,
  `ORDER_SN` varchar(32) COLLATE utf8mb4_bin NOT NULL,
  `GOODS_ID` varchar(32) COLLATE utf8mb4_bin NOT NULL,
  `GOODS_TITLE` varchar(255) COLLATE utf8mb4_bin NOT NULL,
  `PRICE` decimal(16,2) NOT NULL DEFAULT 0.00,
  `REAL_PRICE` decimal(16,2) NOT NULL DEFAULT 0.00,
  `PV` decimal(16,2) NOT NULL DEFAULT 0.00,
  `REAL_PV` decimal(16,2) NOT NULL DEFAULT 0.00,
  `STANDARD_PRICE` float(16,2) NOT NULL DEFAULT 0.00 COMMENT '标准价格',
  `REAL_STANDARD_PRICE` float(16,2) NOT NULL DEFAULT 0.00 COMMENT '支付标准价格',
  `EXCHANGE_RATE` float(10,4) NOT NULL DEFAULT 0.0000 COMMENT '汇率',
  `TAX_RATE` float(16,2) NOT NULL DEFAULT 0.00 COMMENT '税率',
  `SKU_CODE` varchar(16) COLLATE utf8mb4_bin NOT NULL,
  `BUY_NUMS` int(10) NOT NULL DEFAULT 0,
  `P_CALC_MONTH` date NOT NULL,
  `POINT` smallint(5) unsigned NOT NULL DEFAULT 0,
  `CATEGORY_TYPE` tinyint(1) unsigned NOT NULL DEFAULT 1 COMMENT '商品分类：1普通商品',
  `PAY_TYPE` varchar(30) COLLATE utf8mb4_bin NOT NULL DEFAULT 'cash' COMMENT '支付方式：7-pay_stack',
  `EMAIL` varchar(32) COLLATE utf8mb4_bin DEFAULT '' COMMENT '邮箱',
  PRIMARY KEY (`ID`) USING BTREE,
  KEY `GOODS_ID` (`GOODS_ID`) USING BTREE,
  KEY `ORDER_SN` (`ORDER_SN`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin ROW_FORMAT=DYNAMIC COMMENT='BA会员订单中包含的商品';


CREATE TABLE `AR_BA_APPROACH_ORDER` (
  `ID` varchar(32) COLLATE utf8mb4_bin NOT NULL,
  `SN` varchar(32) COLLATE utf8mb4_bin NOT NULL DEFAULT '',
  `DEC_SN` varchar(32) COLLATE utf8mb4_bin DEFAULT '',
  `USER_ID` varchar(32) COLLATE utf8mb4_bin NOT NULL,
  `USER_NAME` varchar(16) COLLATE utf8mb4_bin NOT NULL,
  `ORDER_TYPE` varchar(12) COLLATE utf8mb4_bin NOT NULL,
  `ORDER_AMOUNT` decimal(16,2) NOT NULL DEFAULT 0.00,
  `PV` decimal(16,2) NOT NULL DEFAULT 0.00,
  `PAY_AMOUNT` decimal(16,2) NOT NULL DEFAULT 0.00,
  `PAY_PV` decimal(16,2) NOT NULL DEFAULT 0.00,
  `ORDER_AMOUNT_STANDARD` float(16,2) NOT NULL DEFAULT 0.00 COMMENT '订单价格-标准价格',
  `PAY_AMOUNT_STANDARD` float(16,2) NOT NULL DEFAULT 0.00 COMMENT '标准价格',
  `EXCHANGE_RATE` float(10,4) NOT NULL DEFAULT 0.0000 COMMENT '汇率',
  `PAY_AT` int(10) NOT NULL DEFAULT 0,
  `FREIGHT` float(10,2) NOT NULL DEFAULT 0.00,
  `PAY_FREIGHT` float(10,2) NOT NULL DEFAULT 0.00,
  `DELIVERY_STATUS` tinyint(2) NOT NULL DEFAULT 0,
  `DELIVERY_PERIOD` int(10) NOT NULL DEFAULT 0,
  `DELIVERY_AT` int(10) NOT NULL DEFAULT 0,
  `EXPRESS_COMPANY` varchar(128) COLLATE utf8mb4_bin DEFAULT '',
  `ORDER_TRACK_NO` varchar(32) COLLATE utf8mb4_bin DEFAULT '',
  `EXPRESS_TYPE` tinyint(1) NOT NULL DEFAULT 0,
  `FRONT_REMARK` varchar(1000) COLLATE utf8mb4_bin DEFAULT '',
  `REMARK` text COLLATE utf8mb4_bin DEFAULT NULL,
  `NOTE` text COLLATE utf8mb4_bin DEFAULT NULL COMMENT '备注内容',
  `PERIOD_NUM` int(10) NOT NULL DEFAULT 0,
  `STATUS` int(3) NOT NULL DEFAULT 0,
  `CONSIGNEE` varchar(120) COLLATE utf8mb4_bin DEFAULT '',
  `MOBILE` varchar(11) COLLATE utf8mb4_bin DEFAULT '',
  `TEL` varchar(16) COLLATE utf8mb4_bin DEFAULT '',
  `PROVINCE` int(6) NOT NULL DEFAULT 0,
  `CITY` int(6) DEFAULT 0,
  `COUNTY` int(9) DEFAULT 0,
  `LGA_NAME` varchar(50) COLLATE utf8mb4_bin DEFAULT NULL,
  `CITY_NAME` varchar(50) COLLATE utf8mb4_bin DEFAULT NULL,
  `ADDRESS` varchar(255) COLLATE utf8mb4_bin NOT NULL DEFAULT '',
  `P_CALC_MONTH` date NOT NULL,
  `CREATED_AT` int(10) NOT NULL DEFAULT 0,
  `CREATE_USER` varchar(16) COLLATE utf8mb4_bin NOT NULL,
  `UPDATED_AT` int(10) NOT NULL DEFAULT 0,
  `UPDATER` varchar(16) COLLATE utf8mb4_bin DEFAULT '',
  `IS_DELETE` int(10) NOT NULL DEFAULT 0,
  `DELETED_AT` int(10) NOT NULL DEFAULT 0,
  `PAY_TYPE` varchar(32) COLLATE utf8mb4_bin NOT NULL DEFAULT 'cash',
  `WAREHOUSE` varchar(16) COLLATE utf8mb4_bin NOT NULL DEFAULT '01',
  `EMAIL` varchar(32) COLLATE utf8mb4_bin DEFAULT '' COMMENT '邮箱',
  `REMAIN_PV` decimal(16,2) NOT NULL DEFAULT 0.00 COMMENT '当期未计入的剩余PV',
  `IS_AUTO` int(11) NOT NULL DEFAULT 0 COMMENT '假订单标志',
  PRIMARY KEY (`ID`) USING BTREE,
  KEY `SN` (`SN`) USING BTREE,
  KEY `USER_ID` (`USER_ID`) USING BTREE,
  KEY `USER_NAME` (`USER_NAME`) USING BTREE,
  KEY `PERIOD_NUM` (`PERIOD_NUM`) USING BTREE,
  KEY `IS_DELETE` (`IS_DELETE`) USING BTREE,
  KEY `ORDER_TYPE` (`ORDER_TYPE`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin ROW_FORMAT=DYNAMIC COMMENT='BA会员商品中间订单';

CREATE TABLE `AR_BA_ORDER` (
  `ID` varchar(32) COLLATE utf8mb4_bin NOT NULL,
  `SN` varchar(32) COLLATE utf8mb4_bin NOT NULL DEFAULT '',
  `DEC_SN` varchar(32) COLLATE utf8mb4_bin DEFAULT '',
  `USER_ID` varchar(32) COLLATE utf8mb4_bin NOT NULL,
  `USER_NAME` varchar(16) COLLATE utf8mb4_bin NOT NULL,
  `ORDER_TYPE` varchar(12) COLLATE utf8mb4_bin NOT NULL,
  `ORDER_AMOUNT` decimal(16,2) NOT NULL DEFAULT 0.00,
  `PV` decimal(16,2) NOT NULL DEFAULT 0.00,
  `PAY_AMOUNT` decimal(16,2) NOT NULL DEFAULT 0.00,
  `PAY_PV` decimal(16,2) NOT NULL DEFAULT 0.00,
  `ORDER_AMOUNT_STANDARD` float(16,2) NOT NULL DEFAULT 0.00 COMMENT '订单价格-标准价格',
  `PAY_AMOUNT_STANDARD` float(16,2) NOT NULL DEFAULT 0.00 COMMENT '支付金额-标准价格',
  `EXCHANGE_RATE` float(10,4) NOT NULL DEFAULT 0.0000 COMMENT '汇率',
  `PAY_AT` int(10) NOT NULL DEFAULT 0,
  `FREIGHT` float(10,2) NOT NULL DEFAULT 0.00,
  `PAY_FREIGHT` float(10,2) NOT NULL DEFAULT 0.00,
  `DELIVERY_STATUS` tinyint(2) NOT NULL DEFAULT 0,
  `DELIVERY_PERIOD` int(10) NOT NULL DEFAULT 0,
  `DELIVERY_AT` int(10) NOT NULL DEFAULT 0,
  `EXPRESS_COMPANY` varchar(128) COLLATE utf8mb4_bin DEFAULT '',
  `ORDER_TRACK_NO` varchar(32) COLLATE utf8mb4_bin DEFAULT '',
  `EXPRESS_TYPE` tinyint(1) NOT NULL DEFAULT 0,
  `FRONT_REMARK` varchar(1000) COLLATE utf8mb4_bin DEFAULT '',
  `REMARK` text COLLATE utf8mb4_bin DEFAULT NULL,
  `NOTE` text COLLATE utf8mb4_bin DEFAULT NULL COMMENT '备注内容',
  `PERIOD_NUM` int(10) NOT NULL DEFAULT 0,
  `STATUS` int(3) NOT NULL DEFAULT 0,
  `CONSIGNEE` varchar(120) COLLATE utf8mb4_bin DEFAULT '',
  `MOBILE` varchar(11) COLLATE utf8mb4_bin DEFAULT '',
  `TEL` varchar(16) COLLATE utf8mb4_bin DEFAULT '',
  `PROVINCE` int(6) NOT NULL DEFAULT 0,
  `CITY` int(6) DEFAULT NULL,
  `COUNTY` int(6) DEFAULT NULL,
  `CITY_NAME` varchar(50) COLLATE utf8mb4_bin DEFAULT '' COMMENT '城市名(NG)',
  `LGA_NAME` varchar(50) COLLATE utf8mb4_bin DEFAULT '' COMMENT 'Local Gov Area(NG)',
  `ADDRESS` varchar(255) COLLATE utf8mb4_bin NOT NULL DEFAULT '',
  `P_CALC_MONTH` date NOT NULL,
  `CREATED_AT` int(10) NOT NULL DEFAULT 0,
  `CREATE_USER` varchar(16) COLLATE utf8mb4_bin NOT NULL,
  `UPDATED_AT` int(10) NOT NULL DEFAULT 0,
  `UPDATER` varchar(16) COLLATE utf8mb4_bin DEFAULT '',
  `IS_DELETE` int(10) NOT NULL DEFAULT 0,
  `DELETED_AT` int(10) NOT NULL DEFAULT 0,
  `PAY_TYPE` varchar(32) COLLATE utf8mb4_bin NOT NULL DEFAULT 'cash',
  `WAREHOUSE` varchar(16) COLLATE utf8mb4_bin NOT NULL DEFAULT '01',
  `EMAIL` varchar(32) COLLATE utf8mb4_bin DEFAULT '' COMMENT '邮箱',
  `REMAIN_PV` decimal(16,2) NOT NULL DEFAULT 0.00 COMMENT '当期未计入的剩余PV',
  `IS_AUTO` int(11) NOT NULL DEFAULT 0 COMMENT '假订单标志',
  PRIMARY KEY (`ID`) USING BTREE,
  KEY `SN` (`SN`) USING BTREE,
  KEY `USER_ID` (`USER_ID`) USING BTREE,
  KEY `USER_NAME` (`USER_NAME`) USING BTREE,
  KEY `PERIOD_NUM` (`PERIOD_NUM`) USING BTREE,
  KEY `IS_DELETE` (`IS_DELETE`) USING BTREE,
  KEY `ORDER_TYPE` (`ORDER_TYPE`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin ROW_FORMAT=DYNAMIC COMMENT='BA会员商品订单';


CREATE TABLE `AR_BA_ORDER_GOODS` (
  `ID` varchar(32) COLLATE utf8mb4_bin NOT NULL,
  `ORDER_SN` varchar(32) COLLATE utf8mb4_bin NOT NULL,
  `GOODS_ID` varchar(32) COLLATE utf8mb4_bin NOT NULL,
  `GOODS_TITLE` varchar(255) COLLATE utf8mb4_bin NOT NULL,
  `PRICE` decimal(16,2) NOT NULL DEFAULT 0.00,
  `REAL_PRICE` decimal(16,2) NOT NULL DEFAULT 0.00,
  `PV` decimal(16,2) NOT NULL DEFAULT 0.00,
  `REAL_PV` decimal(16,2) NOT NULL DEFAULT 0.00,
  `STANDARD_PRICE` float(16,2) NOT NULL DEFAULT 0.00 COMMENT '标准价格',
  `EXCHANGE_RATE` float(10,4) NOT NULL DEFAULT 0.0000 COMMENT '汇率',
  `TAX_RATE` float(16,2) NOT NULL DEFAULT 0.00 COMMENT '税率',
  `REAL_STANDARD_PRICE` float(16,2) NOT NULL DEFAULT 0.00 COMMENT '支付标准价格',
  `SKU_CODE` varchar(16) COLLATE utf8mb4_bin NOT NULL,
  `BUY_NUMS` int(10) NOT NULL DEFAULT 0,
  `P_CALC_MONTH` date NOT NULL,
  `POINT` smallint(5) unsigned NOT NULL DEFAULT 0,
  `EMAIL` varchar(32) COLLATE utf8mb4_bin DEFAULT '' COMMENT '邮箱',
  `CATEGORY_TYPE` tinyint(1) NOT NULL DEFAULT 1,
  `PAY_TYPE` varchar(30) COLLATE utf8mb4_bin DEFAULT 'cash',
  `REMAIN_PV` decimal(16,2) NOT NULL DEFAULT 0.00 COMMENT '当期未计入的剩余PV',
  PRIMARY KEY (`ID`) USING BTREE,
  KEY `GOODS_ID` (`GOODS_ID`) USING BTREE,
  KEY `ORDER_SN` (`ORDER_SN`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin ROW_FORMAT=DYNAMIC COMMENT='BA会员订单中包含的商品';

CREATE TABLE `AR_BA_APPROACH_DEC_ORDER` (
  `ID` varchar(32) COLLATE utf8mb4_bin NOT NULL,
  `DEC_SN` varchar(32) COLLATE utf8mb4_bin NOT NULL DEFAULT '',
  `ORDER_SN` varchar(32) COLLATE utf8mb4_bin NOT NULL DEFAULT '',
  `USER_ID` varchar(32) COLLATE utf8mb4_bin NOT NULL,
  `TO_USER_ID` varchar(32) COLLATE utf8mb4_bin NOT NULL,
  `TYPE` varchar(32) COLLATE utf8mb4_bin NOT NULL,
  `IS_ADMIN` tinyint(1) NOT NULL DEFAULT 0,
  `DEC_AMOUNT` decimal(16,3) NOT NULL DEFAULT 0.000,
  `DEC_PV` decimal(16,3) NOT NULL DEFAULT 0.000,
  `PAID_WALLET` varchar(48) COLLATE utf8mb4_bin NOT NULL,
  `IS_BATCH` tinyint(1) NOT NULL DEFAULT 0,
  `REMARK` text COLLATE utf8mb4_bin DEFAULT NULL,
  `REC_USER_ID` varchar(32) COLLATE utf8mb4_bin DEFAULT '',
  `CON_USER_ID` varchar(32) COLLATE utf8mb4_bin DEFAULT '',
  `PERIOD_NUM` int(10) NOT NULL,
  `P_CALC_MONTH` date NOT NULL,
  `CALC_MONTH` int(8) NOT NULL DEFAULT 0,
  `CREATED_AT` int(10) NOT NULL,
  `UPDATER` varchar(32) COLLATE utf8mb4_bin DEFAULT '',
  `UPDATED_AT` varchar(32) COLLATE utf8mb4_bin NOT NULL DEFAULT '0',
  `IS_DEL` tinyint(1) NOT NULL DEFAULT 0,
  `DELETED_AT` int(10) NOT NULL DEFAULT 0,
  `DEC_ID` varchar(32) COLLATE utf8mb4_bin DEFAULT '',
  `DETAIL_TYPE` tinyint(1) NOT NULL DEFAULT 1 COMMENT '默认为1注册 2为升级',
  `UPGRADE_TYPE` tinyint(1) NOT NULL DEFAULT 0 COMMENT '1 补差额升级 2全额升级',
  `ORI_LV` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '升级前的级别',
  `UPGRADE_LV` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '升级后的级别',
  PRIMARY KEY (`ID`) USING BTREE,
  UNIQUE KEY `DEC_SN` (`DEC_SN`) USING BTREE,
  KEY `USER_ID` (`USER_ID`) USING BTREE,
  KEY `TYPE` (`TYPE`) USING BTREE,
  KEY `PERIOD_NUM` (`PERIOD_NUM`) USING BTREE,
  KEY `IS_DEL` (`IS_DEL`) USING BTREE,
  KEY `ORDER_SN` (`ORDER_SN`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin ROW_FORMAT=DYNAMIC COMMENT='报单中间表';

CREATE TABLE `AR_BA_RECEIVE_ADDRESS` (
  `ID` varchar(32) COLLATE utf8mb4_bin NOT NULL,
  `USER_ID` varchar(32) COLLATE utf8mb4_bin NOT NULL,
  `USER_NAME` varchar(16) COLLATE utf8mb4_bin NOT NULL,
  `CONSIGNEE` varchar(120) COLLATE utf8mb4_bin NOT NULL,
  `MOBILE` varchar(11) COLLATE utf8mb4_bin NOT NULL,
  `PROVINCE` int(6) NOT NULL,
  `CITY` int(6) DEFAULT NULL,
  `COUNTY` int(6) DEFAULT NULL,
  `CITY_NAME` varchar(50) COLLATE utf8mb4_bin DEFAULT '' COMMENT '城市名(NG)',
  `LGA_NAME` varchar(50) COLLATE utf8mb4_bin DEFAULT '' COMMENT 'Local Gov Area(NG)',
  `ADDRESS` varchar(255) COLLATE utf8mb4_bin NOT NULL,
  `IS_DEFAULT` tinyint(1) NOT NULL DEFAULT 0,
  `CREATED_AT` int(10) NOT NULL DEFAULT 0,
  `UPDATER` varchar(10) COLLATE utf8mb4_bin DEFAULT '',
  `UPDATED_AT` int(10) NOT NULL DEFAULT 0,
  PRIMARY KEY (`ID`) USING BTREE,
  KEY `USER_ID` (`USER_ID`) USING BTREE,
  KEY `USER_NAME` (`USER_NAME`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin ROW_FORMAT=DYNAMIC COMMENT='BA会员收货地址';

INSERT INTO `AR_BA_RECEIVE_ADDRESS` (`ID`, `USER_ID`, `USER_NAME`, `CONSIGNEE`, `MOBILE`, `PROVINCE`, `CITY`, `COUNTY`, `CITY_NAME`, `LGA_NAME`, `ADDRESS`, `IS_DEFAULT`, `CREATED_AT`, `UPDATER`, `UPDATED_AT`) VALUES ('100000000000000000', '300000000000000000', 'D', 'DCONSIGNEE_NAME', '18888888888', 1, 1, 1, '', '', '狮驼岭', 0, 1589064762, '', 0);

CREATE TABLE `AR_BA_USER` (
  `ID` varchar(32) COLLATE utf8mb4_bin NOT NULL COMMENT '会员ID',
  `USER_NAME` varchar(16) COLLATE utf8mb4_bin NOT NULL COMMENT '会员编号',
  `PASSWORD_HASH` varchar(255) COLLATE utf8mb4_bin NOT NULL COMMENT '会员登录密码',
  `PAY_PASSWORD` varchar(255) COLLATE utf8mb4_bin NOT NULL COMMENT '支付密码',
  `NATION` tinyint(4) NOT NULL DEFAULT 0,
  `REAL_NAME` varchar(128) COLLATE utf8mb4_bin NOT NULL COMMENT '会员姓名',
  `ID_CARD` varchar(18) COLLATE utf8mb4_bin DEFAULT NULL,
  `ID_TYPE` tinyint(1) NOT NULL DEFAULT 0,
  `MOBILE` varchar(11) COLLATE utf8mb4_bin DEFAULT '' COMMENT '手机号码',
  `ADDRESS` varchar(2000) COLLATE utf8mb4_bin DEFAULT '' COMMENT '详细地址',
  `ID_IMAGE` varchar(255) COLLATE utf8mb4_bin DEFAULT '',
  `OPEN_BANK` varchar(32) COLLATE utf8mb4_bin DEFAULT '' COMMENT '开户行',
  `BANK_ADDRESS` varchar(255) COLLATE utf8mb4_bin DEFAULT '' COMMENT '开户行地址',
  `BANK_NO` varchar(32) COLLATE utf8mb4_bin DEFAULT '' COMMENT '银行卡号',
  `BANK_PROVINCE` int(11) DEFAULT 0 COMMENT '开户行所在省',
  `BANK_CITY` int(11) DEFAULT 0 COMMENT '开户行所在市',
  `BANK_COUNTY` int(11) DEFAULT 0 COMMENT '开户行所在区',
  `SPOUSE_NAME` varchar(16) COLLATE utf8mb4_bin DEFAULT '',
  `SPOUSE_IDCARD` varchar(18) COLLATE utf8mb4_bin DEFAULT '',
  `CREATED_AT` int(11) NOT NULL DEFAULT 0,
  `UPDATED_AT` int(11) NOT NULL DEFAULT 0,
  `STATUS` tinyint(1) NOT NULL DEFAULT 1,
  `DEC_CLOSED` tinyint(1) NOT NULL DEFAULT 0,
  `DEC_CLOSED_AT` int(11) NOT NULL DEFAULT 0,
  `DEC_LV` varchar(32) COLLATE utf8mb4_bin DEFAULT '' COMMENT '会员级别',
  `EMP_LV` varchar(32) COLLATE utf8mb4_bin DEFAULT '' COMMENT '荣衔级别',
  `CROWN_LV` varchar(32) COLLATE utf8mb4_bin DEFAULT NULL,
  `PROVINCE` int(11) NOT NULL DEFAULT 0 COMMENT '省',
  `CITY` int(11) NOT NULL DEFAULT 0 COMMENT '市',
  `COUNTY` int(11) NOT NULL DEFAULT 0 COMMENT '区',
  `CITY_NAME` varchar(50) COLLATE utf8mb4_bin DEFAULT '' COMMENT '城市名(NG)',
  `LGA_NAME` varchar(50) COLLATE utf8mb4_bin DEFAULT '' COMMENT 'Local Gov Area(NG)',
  `TEL` varchar(16) COLLATE utf8mb4_bin DEFAULT '',
  `LOGIN_TIMES` int(11) NOT NULL DEFAULT 0,
  `LOGIN_IP` varchar(15) COLLATE utf8mb4_bin DEFAULT '',
  `LOGIN_AT` int(11) NOT NULL DEFAULT 0,
  `PULL_MESSAGE_AT` int(11) NOT NULL DEFAULT 0,
  `SUB_COM_ID` varchar(32) COLLATE utf8mb4_bin DEFAULT '',
  `AVATAR` varchar(255) COLLATE utf8mb4_bin NOT NULL,
  `DELETED` tinyint(1) NOT NULL DEFAULT 0,
  `DELETED_AT` int(11) NOT NULL DEFAULT 0,
  `ALLOW_TRANSFER` tinyint(1) NOT NULL DEFAULT 1,
  `TRANSFER_PROP` float(10,2) NOT NULL DEFAULT 0.00,
  `PARTITION_DATE` timestamp NOT NULL DEFAULT current_timestamp() COMMENT '加入日期',
  `IS_DEC` tinyint(1) NOT NULL DEFAULT 0,
  `DEC_ID` varchar(32) COLLATE utf8mb4_bin NOT NULL DEFAULT '1',
  `BIRTHDAY` date DEFAULT '1990-09-09',
  `DEC_ROLE_ID` varchar(32) COLLATE utf8mb4_bin DEFAULT '',
  `PERIOD_AT` int(11) NOT NULL DEFAULT 0 COMMENT '加入期数',
  `DEC_PROVINCE` int(11) NOT NULL DEFAULT 0,
  `DEC_CITY` int(11) NOT NULL DEFAULT 0,
  `DEC_COUNTY` int(11) NOT NULL DEFAULT 0,
  `IS_UNION` tinyint(1) NOT NULL DEFAULT 0,
  `STATUS_AT` int(11) NOT NULL DEFAULT 0,
  `VERIFIED` tinyint(1) NOT NULL DEFAULT 0,
  `VERIFIED_AT` int(11) NOT NULL DEFAULT 0,
  `ALLOW_LOGIN` tinyint(1) NOT NULL DEFAULT 1,
  `NOT_OPERATING` tinyint(1) NOT NULL DEFAULT 0,
  `REG_FROM` tinyint(1) NOT NULL DEFAULT 1,
  `ID_CARD_PREFIX` varchar(32) COLLATE utf8mb4_bin DEFAULT '',
  `ALLOW_BONUS_LOGIN` tinyint(1) NOT NULL DEFAULT 1,
  `SEX` varchar(32) COLLATE utf8mb4_bin DEFAULT '' COMMENT '性别',
  `DEC_ACCOUNT_OLD` varchar(64) COLLATE utf8mb4_bin DEFAULT '',
  `BANK_UPDATED_AT` int(11) NOT NULL DEFAULT 0,
  `IS_DIRECT_SELLER` tinyint(1) NOT NULL DEFAULT 0,
  `DEC_LV_UPDATED_AT` int(11) NOT NULL DEFAULT 0,
  `DEC_LV_UPDATED_PERIOD` int(11) NOT NULL DEFAULT 0,
  `DEC_ADDRESS` varchar(2000) COLLATE utf8mb4_bin DEFAULT '',
  `DEC_PHONE` varchar(32) COLLATE utf8mb4_bin DEFAULT '',
  `GUARANTOR` varchar(32) COLLATE utf8mb4_bin DEFAULT '',
  `GUARANTOR_NAME` varchar(64) COLLATE utf8mb4_bin DEFAULT '',
  `PART_FUNC_CLOSED` tinyint(1) NOT NULL DEFAULT 0,
  `LAST_DEC_LV_UPDATED_PERIOD` int(11) NOT NULL DEFAULT 0,
  `USER_CREATOR` varchar(32) COLLATE utf8mb4_bin DEFAULT '',
  `USER_UPDATER` varchar(32) COLLATE utf8mb4_bin DEFAULT '',
  `LAST_DEC_LV_UPDATED_AT` int(11) NOT NULL DEFAULT 0,
  `DEC_CREATED_AT` int(11) NOT NULL DEFAULT 0,
  `PART_FUNC_CLOSED_REMARK` text COLLATE utf8mb4_bin DEFAULT NULL,
  `DEC_CREATED_PERIOD` int(11) NOT NULL DEFAULT 0,
  `PASSWORD_CHANGED` tinyint(1) NOT NULL DEFAULT 0,
  `SUB_COM_LEADER` tinyint(1) NOT NULL DEFAULT 0,
  `LOGIN_FAIL_TIMES` int(11) NOT NULL DEFAULT 0,
  `ZG_UPGRADE_PV` decimal(16,2) NOT NULL DEFAULT 0.00,
  `APP_CLIENT_ID` varchar(128) COLLATE utf8mb4_bin DEFAULT '',
  `READ_AGREEMENT` tinyint(1) NOT NULL DEFAULT 1,
  `LAST_DEC_LV` varchar(32) COLLATE utf8mb4_bin DEFAULT '',
  `BONUS_APP_CLIENT_ID` varchar(128) COLLATE utf8mb4_bin DEFAULT '',
  `IS_FIRST_OPEN` tinyint(1) DEFAULT 1,
  `IS_ATLAS` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `LEADER_ALIAS` varchar(255) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '所属领导人',
  `MEMBER_TYPE_TITLE` varchar(255) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '所属荣衔会员',
  `MANAGE_OF_STUDIO` varchar(255) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '所属工作室店长',
  `IS_MODIFY_PASSWORD` tinyint(1) unsigned NOT NULL DEFAULT 0 COMMENT '0:关闭,1:开启',
  `IS_STUDIO` tinyint(3) unsigned NOT NULL DEFAULT 0 COMMENT '工作室',
  `IS_RECHARGE` tinyint(3) unsigned NOT NULL DEFAULT 0 COMMENT '是否显示充值',
  `EMAIL` varchar(32) COLLATE utf8mb4_bin DEFAULT '' COMMENT '邮箱',
  `LAST_CROWN_LV` varchar(32) COLLATE utf8mb4_bin NOT NULL DEFAULT '' COMMENT '最新Crown级别',
  `LAST_CROWN_LV_UPDATED_AT` int(11) NOT NULL DEFAULT 0 COMMENT '最新Crown级别更新时间',
  `LAST_CROWN_LV_UPDATED_PERIOD` int(11) NOT NULL DEFAULT 0 COMMENT '最新Crown级别更新期数',
  `WHETHER_UPGRADE` TINYINT NOT NULL DEFAULT '0' COMMENT '是否已升级：0-未升级 1-已升级',
  `BA_UPGRADE_AT` int(10) NOT NULL DEFAULT '0' COMMENT 'BA会员升级时间',
  PRIMARY KEY (`ID`) USING BTREE,
  UNIQUE KEY `USER_NAME` (`USER_NAME`) USING BTREE,
  UNIQUE KEY `ID` (`ID`) USING BTREE,
  KEY `DEC_ID` (`DEC_ID`) USING BTREE,
  KEY `STATUS` (`STATUS`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin ROW_FORMAT=DYNAMIC COMMENT='用户';

CREATE TABLE `AR_BA_USER_INFO`  (
  `ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
  `USER_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
  `USER_NAME` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
  `ZC_PV` decimal(16, 3) NOT NULL DEFAULT 0,
  `CON_UID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
  `REC_UID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
  `CON_NUM` int(10) NOT NULL DEFAULT 0,
  `REC_NUM` int(10) NOT NULL DEFAULT 0,
  `NETWORK_DEEP` int(10) NOT NULL DEFAULT 0,
  `RELATION_DEEP` int(10) NOT NULL DEFAULT 0,
  `SYSTEM_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL,
  `IS_GROUP_LEADER` tinyint(1) NOT NULL DEFAULT 0,
  `IS_SYSTEM_LEADER` tinyint(1) NOT NULL DEFAULT 0,
  `IS_TEAM` tinyint(1) NOT NULL DEFAULT 0,
  `IS_BIND` tinyint(1) NOT NULL DEFAULT 0,
  `IS_TEAM_MAIN` tinyint(1) NOT NULL DEFAULT 0,
  `IS_BIND_MAIN` tinyint(1) NOT NULL DEFAULT 0,
  `IS_AUTO_WITHDRAW` tinyint(1) NOT NULL DEFAULT 0,
  `CLOSE_LOGIN` tinyint(1) NOT NULL DEFAULT 0,
  `REG_TYPE` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '56D9181C0F5D428FA2DBD4CAB263BF2F',
  `SHOULD_REG_TYPE` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT '56D9181C0F5D428FA2DBD4CAB263BF2F',
  `REG_NAME` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL,
  `CREDIT_CODE` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL,
  `PREMISES` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL,
  `LEGAL_PERSON` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL,
  `REG_EXPIRES` int(10) NULL DEFAULT NULL,
  `STORE_TYPE` tinyint(1) NOT NULL DEFAULT 0,
  `INVOICE_BALANCE` decimal(16, 2) NOT NULL DEFAULT 0,
  `HIGHEST_EMP_LV` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL,
  `CREATED_AT` int(10) NOT NULL,
  `UPDATED_AT` int(10) NOT NULL DEFAULT 0,
  `CLOSE_LOGIN_AT` int(10) NOT NULL DEFAULT 0,
  `PULLED_AT` int(10) NOT NULL DEFAULT 0,
  `DELETED` tinyint(1) NOT NULL DEFAULT 0,
  `DELETED_AT` int(10) NOT NULL DEFAULT 0,
  `GROUP_LEADER_AT` int(10) NOT NULL DEFAULT 0,
  `ALLOW_TRANSFER` tinyint(1) NOT NULL DEFAULT 1,
  `ALLOW_RECONSUME_SMS` tinyint(1) NOT NULL DEFAULT 0,
  `ALLOW_RECONSUME_SMS_TO` int(10) NOT NULL DEFAULT 0,
  `HIGHEST_EMP_LV_PERIOD` int(10) NOT NULL DEFAULT 1,
  `TRANSFER_PROP` float(10, 2) NOT NULL DEFAULT 100,
  `LOGIN_NUMS` int(10) NOT NULL DEFAULT 0,
  `FAIL_NUMS` int(10) NOT NULL DEFAULT 0,
  `LAST_LOGIN_IP` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '0.0.0.0',
  `LAST_LOGIN_AT` int(10) NOT NULL DEFAULT 0,
  `SHOW_EMP_LV` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT '',
  `ZC_AMOUNT` decimal(16, 3) NOT NULL DEFAULT 0,
  PRIMARY KEY (`ID`) USING BTREE,
  UNIQUE INDEX `USER_ID`(`USER_ID`) USING BTREE,
  INDEX `USER_NAME_DELETED`(`USER_NAME`, `DELETED`) USING BTREE,
  INDEX `NETWORK_DEEP`(`NETWORK_DEEP`) USING BTREE,
  INDEX `RELATION_DEEP`(`RELATION_DEEP`) USING BTREE,
  INDEX `REC_UID`(`REC_UID`) USING BTREE,
  INDEX `CON_UID`(`CON_UID`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin COMMENT = '会员资料表' ROW_FORMAT = Dynamic;

CREATE TABLE `AR_BA_DEC_ORDER`  (
    `ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
    `DEC_SN` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '',
    `ORDER_SN` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '',
    `USER_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
    `TO_USER_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
    `TYPE` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
    `IS_ADMIN` tinyint(1) NOT NULL DEFAULT 0,
    `DEC_AMOUNT` decimal(16, 3) NOT NULL DEFAULT 0,
    `DEC_PV` decimal(16, 3) NOT NULL DEFAULT 0,
    `PAID_WALLET` varchar(48) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
    `IS_BATCH` tinyint(1) NOT NULL DEFAULT 0,
    `REMARK` text CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL,
    `REC_USER_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT '',
    `CON_USER_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT '',
    `PERIOD_NUM` int(10) NOT NULL,
    `P_CALC_MONTH` date NOT NULL,
    `CALC_MONTH` int(8) NOT NULL DEFAULT 0,
    `CREATED_AT` int(10) NOT NULL,
    `UPDATER` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT '',
    `UPDATED_AT` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '0',
    `IS_DEL` tinyint(1) NOT NULL DEFAULT 0,
    `DELETED_AT` int(10) NOT NULL DEFAULT 0,
    `DEC_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT '',
    `DETAIL_TYPE` tinyint(1) NOT NULL DEFAULT 1 COMMENT '默认为1注册 2为升级',
    `UPGRADE_TYPE` tinyint(1) NOT NULL DEFAULT 0 COMMENT '1 补差额升级 2全额升级',
    `ORI_LV` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '升级前的级别',
    `UPGRADE_LV` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '升级后的级别',
    PRIMARY KEY (`ID`) USING BTREE,
    UNIQUE INDEX `DEC_SN`(`DEC_SN`) USING BTREE,
    INDEX `USER_ID`(`USER_ID`) USING BTREE,
    INDEX `TYPE`(`TYPE`) USING BTREE,
    INDEX `PERIOD_NUM`(`PERIOD_NUM`) USING BTREE,
    INDEX `IS_DEL`(`IS_DEL`) USING BTREE,
    INDEX `ORDER_SN`(`ORDER_SN`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin COMMENT = '报单' ROW_FORMAT = Dynamic;
