-- 用户备份表
BEGIN
    EXECUTE IMMEDIATE 'DROP TABLE AR_USER_ALL_TEMPLATE';
    EXCEPTION WHEN OTHERS THEN NULL;
END;
CREATE TABLE AR_USER_ALL_TEMPLATE
(
    ID VARCHAR2(32) NOT NULL PRIMARY KEY,
	USER_NAME VARCHAR2(16) NOT NULL,
	NATION NUMBER(2) DEFAULT 0 NOT NULL,
	REAL_NAME VARCHAR2(128) NOT NULL,
	ID_CARD VARCHAR2(18) NOT NULL,
	ID_TYPE NUMBER(1) DEFAULT 0 NOT NULL,
	MOBILE VARCHAR2(11) DEFAULT '',
	ADDRESS VARCHAR2(2000) DEFAULT '',
	ID_IMAGE VARCHAR2(255) DEFAULT '',
	OPEN_BANK VARCHAR2(32) DEFAULT '',
	BANK_ADDRESS VARCHAR2(255) DEFAULT '',
	BANK_NO VARCHAR2(32) DEFAULT '',
	BANK_PROVINCE NUMBER(6) DEFAULT 0,
	BANK_CITY NUMBER(6) DEFAULT 0,
	BANK_COUNTY NUMBER(6) DEFAULT 0,
	SPOUSE_NAME VARCHAR2(16) DEFAULT '',
	SPOUSE_IDCARD VARCHAR2(18) DEFAULT '',
	CREATED_AT NUMBER(10) DEFAULT 0 NOT NULL,
	UPDATED_AT NUMBER(10) DEFAULT 0 NOT NULL,
	STATUS NUMBER(1) DEFAULT 1 NOT NULL,
	DEC_CLOSED NUMBER(1) DEFAULT 0 NOT NULL,
	DEC_CLOSED_AT NUMBER(10) DEFAULT 0 NOT NULL,
	DEC_LV VARCHAR2(32) DEFAULT '',
	EMP_LV VARCHAR2(32) DEFAULT '',
	PROVINCE NUMBER(6) DEFAULT 0 NOT NULL,
	CITY NUMBER(6) DEFAULT 0 NOT NULL,
	COUNTY NUMBER(6) DEFAULT 0 NOT NULL,
	TEL VARCHAR2(16) DEFAULT '',
	LOGIN_TIMES NUMBER(10) DEFAULT 0 NOT NULL,
	LOGIN_IP VARCHAR2(15) DEFAULT '',
	LOGIN_AT NUMBER(10) DEFAULT 0 NOT NULL,
	REG_IS_COMPLETED NUMBER(1) DEFAULT 0 NOT NULL,
	COMPLETED_AT NUMBER(10) DEFAULT 0 NOT NULL,
	PULL_MESSAGE_AT NUMBER(10) DEFAULT 0 NOT NULL,
	SUB_COM_ID VARCHAR2(32) DEFAULT '',
	AVATAR VARCHAR2(255) NOT NULL,
	IS_DEC NUMBER(1) DEFAULT 0 NOT NULL,
	DEC_ID VARCHAR2(32) DEFAULT 1 NOT NULL,
	BIRTHDAY DATE DEFAULT '',
	DEC_ROLE_ID VARCHAR2(32) DEFAULT '',
	PERIOD_AT NUMBER(10) DEFAULT 0 NOT NULL,
	DEC_PROVINCE NUMBER(6) DEFAULT 0 NOT NULL,
	DEC_CITY NUMBER(6) DEFAULT 0 NOT NULL,
	DEC_COUNTY NUMBER(6) DEFAULT 0 NOT NULL,
	IS_UNION NUMBER(1) DEFAULT 0 NOT NULL,
	READ_AGREEMENT NUMBER(1) DEFAULT 1 NOT NULL,
	STATUS_AT NUMBER(10) DEFAULT 0 NOT NULL,
	VERIFIED NUMBER(1) DEFAULT 0 NOT NULL,
	VERIFIED_AT NUMBER(10) DEFAULT 0 NOT NULL,
	ALLOW_LOGIN NUMBER(1) DEFAULT 1 NOT NULL,
	NOT_OPERATING NUMBER(1) DEFAULT 0 NOT NULL,
	REG_FROM NUMBER(1) DEFAULT 1 NOT NULL,
	ID_CARD_PREFIX VARCHAR2(32) DEFAULT '',
	ALLOW_BONUS_LOGIN NUMBER(1) DEFAULT 1 NOT NULL,
	SEX VARCHAR2(32) DEFAULT '',
	IS_FIRST_OPEN NUMBER(1) DEFAULT 1 NOT NULL,
	DEC_ACCOUNT_OLD VARCHAR2(64) DEFAULT '',
	BANK_UPDATED_AT NUMBER(10) DEFAULT 0 NOT NULL,
	LAST_DEC_LV VARCHAR2(32) DEFAULT '',
	IS_DIRECT_SELLER NUMBER(1) DEFAULT 0 NOT NULL,
	DEC_LV_UPDATED_AT NUMBER(10) DEFAULT 0 NOT NULL,
	DEC_LV_UPDATED_PERIOD NUMBER(10) DEFAULT 0 NOT NULL,
	DEC_ADDRESS VARCHAR2(2000) DEFAULT '',
	DEC_PHONE VARCHAR2(32) DEFAULT '',
	GUARANTOR VARCHAR2(32) DEFAULT '',
	GUARANTOR_NAME VARCHAR2(64) DEFAULT '',
	PART_FUNC_CLOSED NUMBER(1) DEFAULT 0 NOT NULL,
	LAST_DEC_LV_UPDATED_PERIOD NUMBER(10) DEFAULT 0 NOT NULL,
	USER_CREATOR VARCHAR2(32) DEFAULT '',
	USER_UPDATER VARCHAR2(32) DEFAULT '',
	LAST_DEC_LV_UPDATED_AT NUMBER(10) DEFAULT 0 NOT NULL,
	DEC_CREATED_AT NUMBER(10) DEFAULT 0 NOT NULL,
	PART_FUNC_CLOSED_REMARK VARCHAR2(4000) DEFAULT '',
	DEC_CREATED_PERIOD NUMBER(10) DEFAULT 0 NOT NULL,
    PASSWORD_CHANGED NUMBER(1) DEFAULT 0 NOT NULL,
    SUB_COM_LEADER NUMBER(1) DEFAULT 0 NOT NULL,
    LOGIN_FAIL_TIMES NUMBER(10) DEFAULT 0 NOT NULL,
    ZG_UPGRADE_PV NUMBER(16,2) DEFAULT 0.00 NOT NULL,
	USER_ID VARCHAR2(32) NOT NULL,
	ZC_PV NUMBER(16,3) DEFAULT 0 NOT NULL,
	CON_UID VARCHAR2(32) NOT NULL,
	REC_UID VARCHAR2(32) NOT NULL,
	CON_NUM NUMBER(10) DEFAULT 0 NOT NULL,
	REC_NUM NUMBER(10) DEFAULT 0 NOT NULL,
	NETWORK_DEEP NUMBER(10) DEFAULT 0 NOT NULL,
	RELATION_DEEP NUMBER(10) DEFAULT 0 NOT NULL,
	SYSTEM_ID VARCHAR2(32),
	IS_GROUP_LEADER NUMBER(1) DEFAULT 0 NOT NULL,
	IS_SYSTEM_LEADER NUMBER(1) DEFAULT 0 NOT NULL,
	IS_TEAM NUMBER(1) DEFAULT 0 NOT NULL,
	IS_BIND NUMBER(1) DEFAULT 0 NOT NULL,
	IS_TEAM_MAIN NUMBER(1) DEFAULT 0 NOT NULL,
	IS_BIND_MAIN NUMBER(1) DEFAULT 0 NOT NULL,
	IS_AUTO_WITHDRAW NUMBER(1) DEFAULT 0 NOT NULL,
	CLOSE_LOGIN NUMBER(1) DEFAULT 0 NOT NULL,
	REG_TYPE VARCHAR2(32) DEFAULT '56D9181C0F5D428FA2DBD4CAB263BF2F' NOT NULL,
	SHOULD_REG_TYPE VARCHAR2(32) DEFAULT '56D9181C0F5D428FA2DBD4CAB263BF2F',
	REG_NAME VARCHAR2(255),
	CREDIT_CODE VARCHAR2(255),
	PREMISES VARCHAR2(255),
	LEGAL_PERSON VARCHAR2(255),
	REG_EXPIRES NUMBER(10),
	STORE_TYPE NUMBER(1) DEFAULT 0 NOT NULL,
	INVOICE_BALANCE NUMBER(16,2) DEFAULT 0.00 NOT NULL,
	HIGHEST_EMP_LV VARCHAR2(32),
	CLOSE_LOGIN_AT NUMBER(10) DEFAULT 0 NOT NULL,
	PULLED_AT NUMBER(10) DEFAULT 0 NOT NULL,
	DELETED NUMBER(1) DEFAULT 0 NOT NULL,
	DELETED_AT NUMBER(10) DEFAULT 0 NOT NULL,
	GROUP_LEADER_AT NUMBER(10) DEFAULT 0 NOT NULL,
	ALLOW_TRANSFER NUMBER(1) DEFAULT 1 NOT NULL,
    ALLOW_RECONSUME_SMS NUMBER(1) DEFAULT 0          NOT NULL,
    ALLOW_RECONSUME_SMS_TO  NUMBER(10) DEFAULT 0        NOT NULL,
	HIGHEST_EMP_LV_PERIOD NUMBER(10) DEFAULT 1 NOT NULL,
	TRANSFER_PROP NUMBER(10,2) DEFAULT 100.00 NOT NULL,
	LOGIN_NUMS NUMBER(10) DEFAULT 0            NOT NULL,
    FAIL_NUMS NUMBER(10) DEFAULT 0            NOT NULL,
    LAST_LOGIN_IP VARCHAR2(16) DEFAULT '0.0.0.0' NOT NULL ,
    LAST_LOGIN_AT  NUMBER(10) DEFAULT 0                     NOT NULL,
    SHOW_EMP_LV     VARCHAR2(32) DEFAULT NULL
);

COMMENT ON TABLE AR_USER_ALL_TEMPLATE IS '用户';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.USER_NAME IS '帐号';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.NATION IS '民族';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.REAL_NAME IS '姓名';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.ID_CARD IS '身份证号';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.ID_TYPE IS '证件类型';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.MOBILE IS '手机号';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.ADDRESS IS '身份证地址';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.ID_IMAGE IS '证件图片';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.OPEN_BANK IS '开户行';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.BANK_ADDRESS IS '银行地址';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.BANK_NO IS '银行卡号';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.BANK_PROVINCE IS '银行省份';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.BANK_CITY IS '银行城市';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.BANK_COUNTY IS '银行县区';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.SPOUSE_NAME IS '配偶姓名';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.SPOUSE_IDCARD IS '配偶证件号';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.CREATED_AT IS '创建时间';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.UPDATED_AT IS '更新时间';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.STATUS IS '状态';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.DEC_CLOSED IS '是否关闭报单功能';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.DEC_CLOSED_AT IS '关闭时间';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.DEC_LV IS '报单级别';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.EMP_LV IS '聘级';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.PROVINCE IS '省份';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.CITY IS '城市';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.COUNTY IS '县区';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.TEL IS '座机';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.LOGIN_TIMES IS '登录次数';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.LOGIN_IP IS '登录IP';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.LOGIN_AT IS '登录时间';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.REG_IS_COMPLETED IS '注册完成';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.COMPLETED_AT IS '注册完成时间';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.PULL_MESSAGE_AT IS '拉取消息的时间';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.SUB_COM_ID IS '子公司ID';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.AVATAR IS '头像';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.IS_DEC IS '是否为报单中心';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.DEC_ID IS '报单中心ID';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.BIRTHDAY IS '生日';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.DEC_ROLE_ID IS '报单中心级别';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.PERIOD_AT IS '期数';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.DEC_PROVINCE IS '报单中心所属的省份';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.DEC_CITY IS '报单中心所属的城市';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.DEC_COUNTY IS '报单中心所属的县区';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.IS_UNION IS '是否为点位合作';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.READ_AGREEMENT IS '已读电子协意';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.STATUS_AT IS '状态更改时间';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.VERIFIED IS '是否认证';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.VERIFIED_AT IS '认证时间';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.ALLOW_LOGIN IS '允许登录';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.NOT_OPERATING IS '不运作';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.REG_FROM IS '注册类型';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.ID_CARD_PREFIX IS '身份证前缀';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.ALLOW_BONUS_LOGIN IS '允许结算登录';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.SEX IS '性别';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.IS_FIRST_OPEN IS '首次开通';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.DEC_ACCOUNT_OLD IS '老系统中的报单中心编号';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.BANK_UPDATED_AT IS '银行信息更新时间';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.LAST_DEC_LV IS '上次报单级别';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.IS_DIRECT_SELLER IS '是否为直销员';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.DEC_LV_UPDATED_AT IS '报单级别更新时间';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.DEC_LV_UPDATED_PERIOD IS '报单级别更新期数';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.DEC_ADDRESS IS '报单中心详细地址';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.DEC_PHONE IS '报单中心电话';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.GUARANTOR IS '担保人编号';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.GUARANTOR_NAME IS '担保人姓名';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.PART_FUNC_CLOSED IS '部分功能开启';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.LAST_DEC_LV_UPDATED_PERIOD IS '上次报单级别更新期数';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.USER_CREATOR IS '创建人';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.USER_UPDATER IS '修改人';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.LAST_DEC_LV_UPDATED_AT IS '上次报单级别更新时间';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.DEC_CREATED_AT IS '成为报单中心时间';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.PART_FUNC_CLOSED_REMARK IS '部分功能关闭原因';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.DEC_CREATED_PERIOD IS '成为报单中心期数';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.ZC_PV IS '注册单PV';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.CON_UID IS '接点人ID';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.REC_UID IS '推荐人ID';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.CON_NUM IS '下级节点数量';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.REC_NUM IS '开拓会员数量';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.NETWORK_DEEP IS '安置网络深度';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.RELATION_DEEP IS '开拓网络深度';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.SYSTEM_ID IS '体系ID';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.IS_GROUP_LEADER IS '是否团队领导人';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.IS_SYSTEM_LEADER IS '是否体系领导人';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.IS_TEAM IS '是否点位合作';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.IS_BIND IS '是否点位绑定';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.IS_TEAM_MAIN IS '是否点位合作主点';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.IS_BIND_MAIN IS '是否点位绑定主点';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.IS_AUTO_WITHDRAW IS '是否开启自动提现';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.CLOSE_LOGIN IS '关闭结算系统登录';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.REG_TYPE IS '注册类型';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.SHOULD_REG_TYPE IS '应注册类型';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.REG_NAME IS '注册名称';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.CREDIT_CODE IS '信用代码';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.PREMISES IS '经营场所';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.LEGAL_PERSON IS '法人';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.REG_EXPIRES IS '注册有效期';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.STORE_TYPE IS '店铺类型';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.INVOICE_BALANCE IS '发票余额';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.HIGHEST_EMP_LV IS '历史最高聘级';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.CREATED_AT IS '创建时间';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.UPDATED_AT IS '更新时间';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.CLOSE_LOGIN_AT IS '禁止登录时间';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.PULLED_AT IS '站内信拉取时间';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.DELETED IS '是否删除';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.DELETED_AT IS '删除时间';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.GROUP_LEADER_AT IS '成为团队领导人的时间';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.ALLOW_TRANSFER is '开启转账功能';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.ALLOW_TRANSFER is '开启复销短信通知';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.ALLOW_TRANSFER is '开启复销短信通知有效期';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.HIGHEST_EMP_LV_PERIOD is '首次达到最高聘级期数';
COMMENT ON COLUMN AR_USER_ALL_TEMPLATE.TRANSFER_PROP is '单笔转账比例';

COMMIT ;