-- Create table 会员信息
create table CU_MEMBER
(
  pk_id              NUMBER(20) not null,
  member_code        VARCHAR2(20) not null,
  member_name        VARCHAR2(100) not null,
  category           NUMBER(2) default 0 not null
  customer_type      NUMBER(2) not null,
  phone              VARCHAR2(20),
  id_card            VARCHAR2(30),
  sex                NUMBER(1),
  birth_date         DATE,
  pk_country         NUMBER(4) not null,
  pk_settle_country  NUMBER(4) not null,
  parent             VARCHAR2(20) not null,
  place_parent       VARCHAR2(20),
  place_dept         number(1),
  team_code          VARCHAR2(20),
  center_code        VARCHAR2(20) not null,
  source             NUMBER(2) not null,
  province           NUMBER(6),
  city               NUMBER(6),
  county             NUMBER(6),
  address            VARCHAR2(200),
  pk_register_grade  NUMBER(4) not null,
  pk_settle_grade    NUMBER(4) not null,
  pk_awards          NUMBER(4) DEFAULT 0 not null ,
  consume_achieve    NUMBER(15,4) default 0 not null,
  purchase_status    NUMBER(2) default 0 not null,
  share_status       NUMBER(2) default 0 not null,
  pay_time           DATE,
  pay_status 		 number(2) default 0 not null
  login_pwd          VARCHAR2(100) not null,
  pay_pwd            VARCHAR2(100) not null,
  login_password     VARCHAR2(50) not null,
  pay_password       VARCHAR2(50) not null,
  edit_number        NUMBER(4) default 0 not null,
  del_flag           NUMBER(1) default 0 not null,
  pkCreator            VARCHAR2(50) not null,
  creation_time      DATE default sysdate not null,
  pkModified           VARCHAR2(50),
  modified_time      DATE,
  register_authority NUMBER(6) default 0 not null,
  vertex             VARCHAR2(20),
  account_status     NUMBER(1) default 0 not null,
  pay_status         NUMBER(2) default 0 not null,
  category           NUMBER(2) default 0 not null,
  email              VARCHAR2(50)
)
tablespace CLOUD
  pctfree 10
  initrans 1
  maxtrans 255
  storage
  (
    initial 64K
    next 1M
    minextents 1
    maxextents unlimited
    pctincrease 0
  );
-- Add comments to the table
comment on table CU_MEMBER
  is '会员信息';
-- Add comments to the columns
comment on column CU_MEMBER.pk_id
  is '用户ID';
comment on column CU_MEMBER.member_code
  is '会员编号';
comment on column CU_MEMBER.member_name
  is '会员名称';
comment on column CU_MEMBER.customer_type
  is '会员类型（0.正常 1.空单 2.死点 4.嗨粉 5.商城小程序游客）';
comment on column CU_MEMBER.customer_type
  is '会员类型（0.正常 1.空单 2.死点 4.嗨粉 5.商城小程序游客）';
comment on column CU_MEMBER.phone
  is '手机号码';
comment on column CU_MEMBER.id_card
  is '证件号码';
comment on column CU_MEMBER.sex
  is '性别（0=未知,1=男,2=女）';
comment on column CU_MEMBER.birth_date
  is '出生日期（年月日）';
comment on column CU_MEMBER.pk_country
  is '自然国';
comment on column CU_MEMBER.pk_settle_country
  is '结算国';
comment on column CU_MEMBER.parent
  is '推荐人编号';
comment on column CU_MEMBER.place_parent
  is '安置人编号';
comment on column CU_MEMBER.place_dept
  is '安置部门';
comment on column CU_MEMBER.team_code
  is '所属团队编号';
comment on column CU_MEMBER.center_code
  is '报单中心编号';
comment on column CU_MEMBER.source
  is '数据来源（1=PC端,2=H5,5=报单公众号,6=商城小程序,7=报单APP,8=商城APP）';
comment on column CU_MEMBER.province
  is '注册省';
comment on column CU_MEMBER.city
  is '注册市';
comment on column CU_MEMBER.county
  is '注册县';
comment on column CU_MEMBER.address
  is '注册地址';
comment on column CU_MEMBER.pk_register_grade
  is '注册等级';
comment on column CU_MEMBER.pk_settle_grade
  is '结算等级';
comment on column CU_MEMBER.pk_awards
  is '真实奖衔';
comment on column CU_MEMBER.consume_achieve
  is '消费业绩';
comment on column CU_MEMBER.purchase_status
  is '是否复购考核状态（0=是,1=否）';
comment on column CU_MEMBER.share_status
  is '是否分红考核状态（0=是,1=否）';
comment on column CU_MEMBER.pay_time
  is '支付时间';
comment on column CU_MEMBER.pay_status
  is '支付状态  (0=未支付,1=已支付)';
comment on column CU_MEMBER.login_pwd
  is '登录密码';
comment on column CU_MEMBER.pay_pwd
  is '支付密码';
comment on column CU_MEMBER.login_password
  is '登录密码明文';
comment on column CU_MEMBER.pay_password
  is '支付密码明文';
comment on column CU_MEMBER.edit_number
  is '修改次数';
comment on column CU_MEMBER.del_flag
  is '逻辑删除 (0=未删除,1已删除)';
comment on column CU_MEMBER.pkCreator
  is '创建人';
comment on column CU_MEMBER.creation_time
  is '创建时间';
comment on column CU_MEMBER.pkModified
  is '修改人';
comment on column CU_MEMBER.modified_time
  is '修改时间';
comment on column CU_MEMBER.register_authority
  is '注册权限（0=普通用户,1=报单中心,2=服务中心）';
comment on column CU_MEMBER.vertex
  is '顶点编号';
comment on column CU_MEMBER.account_status
  is '账户状态（0=正常,1=冻结,2=封停）';
comment on column CU_MEMBER.pay_status
  is '支付状态  (0=未支付,1=已支付)';
comment on column CU_MEMBER.category
  is '用户类型分类（0=正常（正常 空单 嗨粉） 1=死点（死点））';
comment on column CU_MEMBER.email
  is '邮箱';
-- Create/Recreate indexes
create unique index MEMBER_MEMBER_CODE on CU_MEMBER (MEMBER_CODE)
  tablespace CLOUD
  pctfree 10
  initrans 2
  maxtrans 255
  storage
  (
    initial 64K
    next 1M
    minextents 1
    maxextents unlimited
    pctincrease 0
  );
-- Create/Recreate primary, unique and foreign key constraints
alter table CU_MEMBER
  add constraint CU_MEMBER_PK primary key (PK_ID)
  using index
  tablespace CLOUD
  pctfree 10
  initrans 2
  maxtrans 255
  storage
  (
    initial 64K
    next 1M
    minextents 1
    maxextents unlimited
    pctincrease 0
  );

create sequence CU_MEMBER_SEQ
minvalue 1
maxvalue 999999999999999999999999
start with 1
increment by 1
cache 20;

-- Create table 会员注册信息
create table CU_MEMBER_REGISTER
(
  pk_id             NUMBER(20) not null,
  member_code       VARCHAR2(30) not null,
  member_name       VARCHAR2(100) not null,
  customer_type     NUMBER(2) not null,
  phone             VARCHAR2(20),
  id_card           VARCHAR2(30),
  sex               NUMBER(1),
  birth_date        DATE,
  pk_country        NUMBER(4) not null,
  pk_settle_country NUMBER(4) not null,
  parent            VARCHAR2(20) not null,
  place_parent      VARCHAR2(20),
  place_dept        number(2),
  team_code         VARCHAR2(20),
  center_code       VARCHAR2(20) not null,
  source            NUMBER(2) not null,
  province          NUMBER(6),
  city              NUMBER(6),
  county            NUMBER(6),
  address           VARCHAR2(200),
  pk_register_grade NUMBER(4) not null,
  consume_achieve   NUMBER(15,4) default 0 not null,
  pay_time          DATE,
  del_flag          NUMBER(1) default 0 not null,
  pkCreator           VARCHAR2(50) not null,
  creation_time     DATE default sysdate not null,
  pkModified          VARCHAR2(50),
  modified_time     DATE,
  vertex            VARCHAR2(20)
)
tablespace CLOUD
  pctfree 10
  initrans 1
  maxtrans 255
  storage
  (
    initial 64K
    next 1M
    minextents 1
    maxextents unlimited
    pctincrease 0
  );
-- Add comments to the table
comment on table CU_MEMBER_REGISTER
  is '会员信息-注册信息';
-- Add comments to the columns
comment on column CU_MEMBER_REGISTER.pk_id
  is '用户ID';
comment on column CU_MEMBER_REGISTER.member_code
  is '会员编号';
comment on column CU_MEMBER_REGISTER.member_name
  is '会员名称';
comment on column CU_MEMBER_REGISTER.customer_type
  is '会员类型（0.正常 1.空单 2.死点 4.嗨粉 5.商城小程序游客）';
comment on column CU_MEMBER_REGISTER.phone
  is '手机号码';
comment on column CU_MEMBER_REGISTER.id_card
  is '证件号码';
comment on column CU_MEMBER_REGISTER.sex
  is '性别（0=未知,1=男,2=女）';
comment on column CU_MEMBER_REGISTER.birth_date
  is '出生日期（年月日）';
comment on column CU_MEMBER_REGISTER.pk_country
  is '自然国';
comment on column CU_MEMBER_REGISTER.pk_settle_country
  is '结算国';
comment on column CU_MEMBER_REGISTER.parent
  is '推荐人编号';
comment on column CU_MEMBER_REGISTER.place_parent
  is '安置人编号';
comment on column CU_MEMBER_REGISTER.place_dept
  is '安置部门';
comment on column CU_MEMBER_REGISTER.team_code
  is '所属团队编号';
comment on column CU_MEMBER_REGISTER.center_code
  is '报单中心编号';
comment on column CU_MEMBER_REGISTER.source
  is '数据来源（1=PC端,2=H5,5=报单公众号,6=商城小程序,7=报单APP,8=商城APP）';
comment on column CU_MEMBER_REGISTER.province
  is '注册省';
comment on column CU_MEMBER_REGISTER.city
  is '注册市';
comment on column CU_MEMBER_REGISTER.county
  is '注册县';
comment on column CU_MEMBER_REGISTER.address
  is '注册地址';
comment on column CU_MEMBER_REGISTER.pk_register_grade
  is '注册等级';
comment on column CU_MEMBER_REGISTER.consume_achieve
  is '消费业绩';
comment on column CU_MEMBER_REGISTER.del_flag
  is '逻辑删除 (0=未删除,1已删除)';
comment on column CU_MEMBER_REGISTER.pkCreator
  is '创建人';
comment on column CU_MEMBER_REGISTER.creation_time
  is '创建时间';
comment on column CU_MEMBER_REGISTER.pkModified
  is '修改人';
comment on column CU_MEMBER_REGISTER.modified_time
  is '修改时间';
comment on column CU_MEMBER_REGISTER.vertex
  is '顶点编号';
-- Create/Recreate indexes
create unique index CU_MEMBER_REGISTER_MEMBER_CODE on CU_MEMBER_REGISTER (MEMBER_CODE)
  tablespace CLOUD
  pctfree 10
  initrans 2
  maxtrans 255
  storage
  (
    initial 64K
    next 1M
    minextents 1
    maxextents unlimited
    pctincrease 0
  );
-- Create/Recreate primary, unique and foreign key constraints
alter table CU_MEMBER_REGISTER
  add constraint CU_MEMBER_REGISTER_PK primary key (PK_ID)
  using index
  tablespace CLOUD
  pctfree 10
  initrans 2
  maxtrans 255
  storage
  (
    initial 64K
    next 1M
    minextents 1
    maxextents unlimited
    pctincrease 0
  );
create sequence CU_MEMBER_REGISTER_SEQ
minvalue 1
maxvalue 999999999999999999999999
start with 1
increment by 1
cache 20;

-- Create table 会员登录记录
create table CU_MEMBER_LOGIN
(
  pk_id        NUMBER(20) not null,
  member_code  VARCHAR2(20) not null,
  login_id     VARCHAR2(128) not null,
  login_time   DATE default sysdate not null,
  login_device VARCHAR2(2),
  status       NUMBER(1) not null,
  message      VARCHAR2(50)
)
tablespace CLOUD
  pctfree 10
  initrans 1
  maxtrans 255
  storage
  (
    initial 256K
    next 256K
    minextents 1
    maxextents unlimited
    pctincrease 0
  );
-- Add comments to the table
comment on table CU_MEMBER_LOGIN
  is '会员登录记录';
-- Add comments to the columns
comment on column CU_MEMBER_LOGIN.pk_id
  is '主键ID';
comment on column CU_MEMBER_LOGIN.member_code
  is '会员编号';
comment on column CU_MEMBER_LOGIN.login_id
  is '登录IP';
comment on column CU_MEMBER_LOGIN.login_time
  is '登录时间';
comment on column CU_MEMBER_LOGIN.login_device
  is '登录设备';
comment on column CU_MEMBER_LOGIN.status
  is '状态（0=成功,1=失败）';
comment on column CU_MEMBER_LOGIN.message
  is '消息内容';
-- Create/Recreate indexes
create index MEMBER_LOGIN_MEMBER_CODE on CU_MEMBER_LOGIN (MEMBER_CODE)
  tablespace CLOUD
  pctfree 10
  initrans 2
  maxtrans 255
  storage
  (
    initial 256K
    next 256K
    minextents 1
    maxextents unlimited
    pctincrease 0
  );
-- Create/Recreate primary, unique and foreign key constraints
alter table CU_MEMBER_LOGIN
  add constraint CU_MEMBER_LOGIN_PK primary key (PK_ID)
  using index
  tablespace CLOUD
  pctfree 10
  initrans 2
  maxtrans 255
  storage
  (
    initial 256K
    next 256K
    minextents 1
    maxextents unlimited
    pctincrease 0
  );

create sequence CU_MEMBER_LOGIN_SEQ
minvalue 1
maxvalue 999999999999999999999999
start with 1
increment by 1
cache 20;

-- Create table 会员密码修改记录
create table CU_MEMBER_PASSWORD
(
  pk_id         NUMBER(20) not null,
  member_code   VARCHAR2(20) not null,
  edit_type     NUMBER(2) not null,
  old_value     VARCHAR2(50) not null,
  new_value     VARCHAR2(50) not null,
  del_flag      NUMBER(1) default 0 not null,
  pkCreator       VARCHAR2(50) not null,
  creation_time DATE default sysdate not null,
  pkModified      VARCHAR2(50),
  modified_time DATE,
  pk_country    NUMBER(4) not null
)
tablespace CLOUD
  pctfree 10
  initrans 1
  maxtrans 255
  storage
  (
    initial 256K
    next 256K
    minextents 1
    maxextents unlimited
    pctincrease 0
  );
-- Add comments to the table
comment on table CU_MEMBER_PASSWORD
  is '会员更名、密码修改表';
-- Add comments to the columns
comment on column CU_MEMBER_PASSWORD.pk_id
  is '主键';
comment on column CU_MEMBER_PASSWORD.member_code
  is '会员编号';
comment on column CU_MEMBER_PASSWORD.edit_type
  is '修改类型（0=忘记密码,1=修改登录密码,2=修改支付密码,3=更改姓名,4=修改手机号）';
comment on column CU_MEMBER_PASSWORD.old_value
  is '原值';
comment on column CU_MEMBER_PASSWORD.new_value
  is '新值';
comment on column CU_MEMBER_PASSWORD.del_flag
  is '逻辑删除 (0=未删除,1已删除)';
comment on column CU_MEMBER_PASSWORD.pkCreator
  is '创建人';
comment on column CU_MEMBER_PASSWORD.creation_time
  is '创建时间';
comment on column CU_MEMBER_PASSWORD.pkModified
  is '修改人';
comment on column CU_MEMBER_PASSWORD.modified_time
  is '修改时间';
comment on column CU_MEMBER_PASSWORD.pk_country
  is '国家';
-- Create/Recreate indexes
create index MEMBER_PASSWORD_MEMBER_CODE on CU_MEMBER_PASSWORD (MEMBER_CODE)
  tablespace CLOUD
  pctfree 10
  initrans 2
  maxtrans 255;
-- Create/Recreate primary, unique and foreign key constraints
alter table CU_MEMBER_PASSWORD
  add constraint CU_MEMBER_PASSWORD_PK primary key (PK_ID)
  using index
  tablespace CLOUD
  pctfree 10
  initrans 2
  maxtrans 255;

create sequence CU_MEMBER_PASSWORD_SEQ
minvalue 1
maxvalue 999999999999999999999999
start with 1
increment by 1
cache 20;


-- Create table
create table CU_MEMBER_AGENT
(
  pk_id          NUMBER(20) not null,
  member_code    VARCHAR2(20) not null,
  agent_type     VARCHAR2(100) not null,
  agent_province NUMBER(6) not null,
  agent_city     NUMBER(6),
  agent_county   NUMBER(6),
  agent_grade    NUMBER(6),
  del_flag       NUMBER(1) default 0 not null,
  pkCreator        VARCHAR2(50) not null,
  creation_time  DATE default sysdate not null,
  pkModified       VARCHAR2(50),
  modified_time  DATE,
  pk_country     NUMBER(4) not null
)
tablespace CLOUD
  pctfree 10
  initrans 1
  maxtrans 255
  storage
  (
    initial 64K
    next 1M
    minextents 1
    maxextents unlimited
    pctincrease 0
  );
-- Add comments to the table
comment on table CU_MEMBER_AGENT
  is '会员信息-代理商信息';
-- Add comments to the columns
comment on column CU_MEMBER_AGENT.pk_id
  is '主键';
comment on column CU_MEMBER_AGENT.member_code
  is '会员编号';
comment on column CU_MEMBER_AGENT.agent_type
  is '代理类型 (1=代理商,2=店铺)';
comment on column CU_MEMBER_AGENT.agent_province
  is '省';
comment on column CU_MEMBER_AGENT.agent_city
  is '市';
comment on column CU_MEMBER_AGENT.agent_county
  is '县';
comment on column CU_MEMBER_AGENT.agent_grade
  is '级别来源(1=代理商级别, 2=店铺级别)';
comment on column CU_MEMBER_AGENT.del_flag
  is '逻辑删除 (0=未删除,1已删除)';
comment on column CU_MEMBER_AGENT.pkCreator
  is '创建人';
comment on column CU_MEMBER_AGENT.creation_time
  is '创建时间';
comment on column CU_MEMBER_AGENT.pkModified
  is '修改人';
comment on column CU_MEMBER_AGENT.modified_time
  is '修改时间';
comment on column CU_MEMBER_AGENT.pk_country
  is '国家';
-- Create/Recreate indexes
create unique index CU_MEMBER_AGENT_MEMBER_CODE on CU_MEMBER_AGENT (MEMBER_CODE)
  tablespace CLOUD
  pctfree 10
  initrans 2
  maxtrans 255
  storage
  (
    initial 64K
    next 1M
    minextents 1
    maxextents unlimited
    pctincrease 0
  );
-- Create/Recreate primary, unique and foreign key constraints
alter table CU_MEMBER_AGENT
  add constraint CU_MEMBER_AGENT_PK primary key (PK_ID)
  using index
  tablespace CLOUD
  pctfree 10
  initrans 2
  maxtrans 255
  storage
  (
    initial 64K
    next 1M
    minextents 1
    maxextents unlimited
    pctincrease 0
  );

create sequence CU_MEMBER_AGENT_SEQ
minvalue 1
maxvalue 999999999999999999999999
start with 1
increment by 1
cache 20;


-- Create table 会员银行卡信息
create table CU_MEMBER_BANK
(
  pk_id         NUMBER(20) not null,
  member_code   VARCHAR2(20) not null,
  deposit_bank  NUMBER(4) not null,
  account_name  VARCHAR2(100) not null,
  card_number   VARCHAR2(50) not null,
  id_card       VARCHAR2(30) not null,
  phone         VARCHAR2(20) not null,
  del_flag      NUMBER(1) default 0 not null,
  pkCreator       VARCHAR2(50) not null,
  creation_time DATE default sysdate not null,
  pkModified      VARCHAR2(50),
  modified_time DATE,
  pk_country    NUMBER(4) not null
)
tablespace CLOUD
  pctfree 10
  initrans 1
  maxtrans 255
  storage
  (
    initial 64K
    next 1M
    minextents 1
    maxextents unlimited
    pctincrease 0
  );
-- Add comments to the table
comment on table CU_MEMBER_BANK
  is '会员信息-银行卡信息';
-- Add comments to the columns
comment on column CU_MEMBER_BANK.pk_id
  is '主键';
comment on column CU_MEMBER_BANK.member_code
  is '会员编号';
comment on column CU_MEMBER_BANK.deposit_bank
  is '开户银行';
comment on column CU_MEMBER_BANK.account_name
  is '开户姓名';
comment on column CU_MEMBER_BANK.card_number
  is '银行卡号';
comment on column CU_MEMBER_BANK.id_card
  is '身份证号';
comment on column CU_MEMBER_BANK.phone
  is '手机号';
comment on column CU_MEMBER_BANK.del_flag
  is '逻辑删除 (0=未删除,1已删除)';
comment on column CU_MEMBER_BANK.pkCreator
  is '创建人';
comment on column CU_MEMBER_BANK.creation_time
  is '创建时间';
comment on column CU_MEMBER_BANK.pkModified
  is '修改人';
comment on column CU_MEMBER_BANK.modified_time
  is '修改时间';
comment on column CU_MEMBER_BANK.pk_country
  is '国家';
-- Create/Recreate indexes
create index CU_MEMBER_BANK_MEMBER_CODE on CU_MEMBER_BANK (MEMBER_CODE)
  tablespace CLOUD
  pctfree 10
  initrans 2
  maxtrans 255
  storage
  (
    initial 64K
    next 1M
    minextents 1
    maxextents unlimited
    pctincrease 0
  );
-- Create/Recreate primary, unique and foreign key constraints
alter table CU_MEMBER_BANK
  add constraint CU_MEMBER_BANK_PK primary key (PK_ID)
  using index
  tablespace CLOUD
  pctfree 10
  initrans 2
  maxtrans 255
  storage
  (
    initial 64K
    next 1M
    minextents 1
    maxextents unlimited
    pctincrease 0
  );

create sequence CU_MEMBER_BANK_SEQ
minvalue 1
maxvalue 999999999999999999999999
start with 1
increment by 1
cache 20;

-- Create table 收货地址
create table CU_MEMBER_RECEIVING
(
  pk_id         NUMBER(20) not null,
  member_code   VARCHAR2(20) not null,
  rec_address   VARCHAR2(200) not null,
  rec_name      VARCHAR2(100) not null,
  rec_phone     VARCHAR2(20) not null,
  rec_province  NUMBER(20) not null,
  rec_city      NUMBER(20),
  rec_county    NUMBER(20),
  is_default    NUMBER(1) default 1 not null,
  del_flag      NUMBER(1) default 0 not null,
  pkCreator       VARCHAR2(50) not null,
  creation_time DATE default sysdate not null,
  pkModified      VARCHAR2(50),
  modified_time DATE,
  pk_country    NUMBER(4) not null
)
tablespace CLOUD
  pctfree 10
  initrans 1
  maxtrans 255
  storage
  (
    initial 256K
    next 256K
    minextents 1
    maxextents unlimited
    pctincrease 0
  );
-- Add comments to the table
comment on table CU_MEMBER_RECEIVING
  is '会员收货信息';
-- Add comments to the columns
comment on column CU_MEMBER_RECEIVING.pk_id
  is '主键';
comment on column CU_MEMBER_RECEIVING.member_code
  is '会员编号';
comment on column CU_MEMBER_RECEIVING.rec_address
  is '收货地址';
comment on column CU_MEMBER_RECEIVING.rec_name
  is '收货人';
comment on column CU_MEMBER_RECEIVING.rec_phone
  is '收货人手机';
comment on column CU_MEMBER_RECEIVING.rec_province
  is '收货省';
comment on column CU_MEMBER_RECEIVING.rec_city
  is '收货市';
comment on column CU_MEMBER_RECEIVING.rec_county
  is '收货县';
comment on column CU_MEMBER_RECEIVING.is_default
  is '是否默认（0=是,1=否）';
comment on column CU_MEMBER_RECEIVING.del_flag
  is '逻辑删除 (0=未删除,1已删除)';
comment on column CU_MEMBER_RECEIVING.pkCreator
  is '创建人';
comment on column CU_MEMBER_RECEIVING.creation_time
  is '创建时间';
comment on column CU_MEMBER_RECEIVING.pkModified
  is '修改人';
comment on column CU_MEMBER_RECEIVING.modified_time
  is '修改时间';
comment on column CU_MEMBER_RECEIVING.pk_country
  is '自然国';
-- Create/Recreate indexes
create index MEMBER_RECEIVING_MEMBER_CODE on CU_MEMBER_RECEIVING (MEMBER_CODE)
  tablespace CLOUD
  pctfree 10
  initrans 2
  maxtrans 255;
-- Create/Recreate primary, unique and foreign key constraints
alter table CU_MEMBER_RECEIVING
  add constraint CU_MEMBER_RECEIVING_PK primary key (PK_ID)
  using index
  tablespace CLOUD
  pctfree 10
  initrans 2
  maxtrans 255;

create sequence CU_MEMBER_RECEIVING_SEQ
minvalue 1
maxvalue 999999999999999999999999
start with 1
increment by 1
cache 20;

-- Create table 礼包收货地址
create table CU_MEMBER_GIFT
(
  pk_id         NUMBER(20) not null,
  member_code   VARCHAR2(20) not null,
  gift_address  VARCHAR2(200) not null,
  gift_name     VARCHAR2(100) not null,
  gift_phone    VARCHAR2(20) not null,
  gift_province NUMBER(20) not null,
  gift_city     NUMBER(20),
  gift_county   NUMBER(20),
  del_flag      NUMBER(1) default 0 not null,
  pkCreator       VARCHAR2(50) not null,
  creation_time DATE default sysdate not null,
  pkModified      VARCHAR2(50),
  modified_time DATE,
  pk_country    NUMBER(4) not null
)
tablespace CLOUD
  pctfree 10
  initrans 1
  maxtrans 255
  storage
  (
    initial 256K
    next 256K
    minextents 1
    maxextents unlimited
    pctincrease 0
  );
-- Add comments to the table
comment on table CU_MEMBER_GIFT
  is '会员礼包收货地址';
-- Add comments to the columns
comment on column CU_MEMBER_GIFT.pk_id
  is '主键';
comment on column CU_MEMBER_GIFT.member_code
  is '会员编号';
comment on column CU_MEMBER_GIFT.gift_address
  is '收货地址';
comment on column CU_MEMBER_GIFT.gift_name
  is '收货人';
comment on column CU_MEMBER_GIFT.gift_phone
  is '收货人手机';
comment on column CU_MEMBER_GIFT.gift_province
  is '收货省';
comment on column CU_MEMBER_GIFT.gift_city
  is '收货市';
comment on column CU_MEMBER_GIFT.gift_county
  is '收货县';
comment on column CU_MEMBER_GIFT.del_flag
  is '逻辑删除 (0=未删除,1已删除)';
comment on column CU_MEMBER_GIFT.pkCreator
  is '创建人';
comment on column CU_MEMBER_GIFT.creation_time
  is '创建时间';
comment on column CU_MEMBER_GIFT.pkModified
  is '修改人';
comment on column CU_MEMBER_GIFT.modified_time
  is '修改时间';
comment on column CU_MEMBER_GIFT.pk_country
  is '自然国';
-- Create/Recreate primary, unique and foreign key constraints
alter table CU_MEMBER_GIFT
  add constraint CU_MEMBER_GIFT_PK primary key (PK_ID)
  using index
  tablespace CLOUD
  pctfree 10
  initrans 2
  maxtrans 255;

create sequence CU_MEMBER_GIFT_SEQ
minvalue 1
maxvalue 999999999999999999999999
start with 1
increment by 1
cache 20;

-- Create table 会员账户信息
create table CU_MEMBER_ACCOUNT
(
  pk_id             NUMBER(20) not null,
  member_code       VARCHAR2(30) not null,
  account1          NUMBER(17,6) default 0 not null,
  lock_account1     NUMBER(17,6) default 0 not null,
  account2          NUMBER(17,6) default 0 not null,
  lock_account2     NUMBER(17,6) default 0 not null,
  account3          NUMBER(17,6) default 0 not null,
  lock_account3     NUMBER(17,6) default 0 not null,
  account4          NUMBER(17,6) default 0 not null,
  lock_account4     NUMBER(17,6) default 0 not null,
  withdraw_account4 NUMBER(17,6) default 0 not null,
  consume_account4  NUMBER(17,6) default 0 not null,
  account5          NUMBER(17,6) default 0 not null,
  lock_account5     NUMBER(17,6) default 0 not null,
  account6          NUMBER(17,6) default 0 not null,
  lock_account6     NUMBER(17,6) default 0 not null,
  account7          NUMBER(17,6) default 0 not null,
  lock_account7     NUMBER(17,6) default 0 not null,
  account8          NUMBER(17,6) default 0 not null,
  lock_account8     NUMBER(17,6) default 0 not null,
  account9          NUMBER(17,6) default 0 not null,
  lock_account9     NUMBER(17,6) default 0 not null,
  account10         NUMBER(17,6) default 0 not null,
  lock_account10     NUMBER(17,6) default 0 not null,
  account11         NUMBER(17,6) default 0 not null,
  account12         NUMBER(17,6) default 0 not null,
  account13         NUMBER(17,6) default 0 not null,
  account14         NUMBER(17,6) default 0 not null,
  account15         NUMBER(17,6) default 0 not null,
  account16         NUMBER(17,6) default 0 not null,
  account17         NUMBER(17,6) default 0 not null,
  account18         NUMBER(17,6) default 0 not null,
  account19         NUMBER(17,6) default 0 not null,
  account20         NUMBER(17,6) default 0 not null,
  wallet_status     NUMBER(1) default 0 not null,
  del_flag          NUMBER(1) default 0 not null,
  pkCreator           VARCHAR2(50) not null,
  creation_time     DATE default sysdate not null,
  pkModified          VARCHAR2(50),
  modified_time     DATE,
  pk_country        NUMBER(4) not null
)
tablespace CLOUD
  pctfree 10
  initrans 1
  maxtrans 255
  storage
  (
    initial 256K
    next 256K
    minextents 1
    maxextents unlimited
    pctincrease 0
  );
-- Add comments to the table
comment on table CU_MEMBER_ACCOUNT
  is '会员账户信息';
-- Add comments to the columns
comment on column CU_MEMBER_ACCOUNT.pk_id
  is '主键ID';
comment on column CU_MEMBER_ACCOUNT.member_code
  is '会员编号';
comment on column CU_MEMBER_ACCOUNT.account1
  is '消费账户';
comment on column CU_MEMBER_ACCOUNT.account2
  is '现金账户';
comment on column CU_MEMBER_ACCOUNT.account3
  is '政策账户';
comment on column CU_MEMBER_ACCOUNT.account4
  is '奖金账户';
comment on column CU_MEMBER_ACCOUNT.lock_account4
  is '奖金锁定账户';
comment on column CU_MEMBER_ACCOUNT.withdraw_account4
  is '可提现账户';
comment on column CU_MEMBER_ACCOUNT.consume_account4
  is '可消费账户';
comment on column CU_MEMBER_ACCOUNT.account5
  is '重消账户';
comment on column CU_MEMBER_ACCOUNT.account6
  is '积分账户';
comment on column CU_MEMBER_ACCOUNT.account7
  is '鼓励账户';
comment on column CU_MEMBER_ACCOUNT.account8
  is '复购券账户';
comment on column CU_MEMBER_ACCOUNT.account9
  is '预置账户9';
comment on column CU_MEMBER_ACCOUNT.account10
  is '预置账户10';
comment on column CU_MEMBER_ACCOUNT.account11
  is '预置账户11';
comment on column CU_MEMBER_ACCOUNT.account12
  is '预置账户12';
comment on column CU_MEMBER_ACCOUNT.account13
  is '预置账户13';
comment on column CU_MEMBER_ACCOUNT.account14
  is '预置账户14';
comment on column CU_MEMBER_ACCOUNT.account15
  is '预置账户15';
comment on column CU_MEMBER_ACCOUNT.account16
  is '预置账户16';
comment on column CU_MEMBER_ACCOUNT.account17
  is '预置账户17';
comment on column CU_MEMBER_ACCOUNT.account18
  is '预置账户18';
comment on column CU_MEMBER_ACCOUNT.account19
  is '预置账户19';
comment on column CU_MEMBER_ACCOUNT.account20
  is '预置账户20';
comment on column CU_MEMBER_ACCOUNT.wallet_status
  is '钱包状态（0=正常,1=锁定）';
comment on column CU_MEMBER_ACCOUNT.del_flag
  is '逻辑删除 (0=未删除,1已删除)';
comment on column CU_MEMBER_ACCOUNT.pkCreator
  is '创建人';
comment on column CU_MEMBER_ACCOUNT.creation_time
  is '创建时间';
comment on column CU_MEMBER_ACCOUNT.pkModified
  is '修改人';
comment on column CU_MEMBER_ACCOUNT.modified_time
  is '修改时间';
comment on column CU_MEMBER_ACCOUNT.pk_country
  is '国家';
comment on column CU_MEMBER_ACCOUNT.lock_account1
  is '消费锁定账户';
comment on column CU_MEMBER_ACCOUNT.lock_account2
  is '现金锁定账户';
-- Create/Recreate indexes
create unique index MEMBER_ACCOUNT_MEMBER_CODE on CU_MEMBER_ACCOUNT (MEMBER_CODE)
  tablespace CLOUD
  pctfree 10
  initrans 2
  maxtrans 255
  storage
  (
    initial 256K
    next 256K
    minextents 1
    maxextents unlimited
    pctincrease 0
  );
-- Create/Recreate primary, unique and foreign key constraints
alter table CU_MEMBER_ACCOUNT
  add constraint CU_MEMBER_ACCOUNT_PK primary key (PK_ID)
  using index
  tablespace CLOUD
  pctfree 10
  initrans 2
  maxtrans 255
  storage
  (
    initial 256K
    next 256K
    minextents 1
    maxextents unlimited
    pctincrease 0
  );

create sequence cu_member_account_SEQ
minvalue 1
maxvalue 999999999999999999999999
start with 1
increment by 1
cache 20;

-- Create table 升级记录
create table CU_MEMBER_AWARDS
(
  pk_id         NUMBER(20) not null,
  member_code   VARCHAR2(20) not null,
  period        NUMBER(6) not null,
  up_type       NUMBER(2) not null,
  old_level     NUMBER(6) not null,
  new_level     NUMBER(6) not null,
  remark        VARCHAR2(200),
  del_flag      NUMBER(1) default 0 not null,
  pkCreator       VARCHAR2(50) not null,
  creation_time DATE default sysdate not null,
  pkModified      VARCHAR2(50),
  modified_time DATE,
  pk_country    NUMBER(4) not null
)
tablespace CLOUD
  pctfree 10
  initrans 1
  maxtrans 255
  storage
  (
    initial 64K
    next 1M
    minextents 1
    maxextents unlimited
    pctincrease 0
  );
-- Add comments to the table
comment on table CU_MEMBER_AWARDS
  is '会员信息-奖衔升级记录';
-- Add comments to the columns
comment on column CU_MEMBER_AWARDS.pk_id
  is '主键';
comment on column CU_MEMBER_AWARDS.member_code
  is '会员编号';
comment on column CU_MEMBER_AWARDS.period
  is '结算期间';
comment on column CU_MEMBER_AWARDS.up_type
  is '升级类型 (1=自动升级,2=手动升级,3=购买赠予)';
comment on column CU_MEMBER_AWARDS.old_level
  is '原等级';
comment on column CU_MEMBER_AWARDS.new_level
  is '新等级';
comment on column CU_MEMBER_AWARDS.remark
  is '备注';
comment on column CU_MEMBER_AWARDS.del_flag
  is '逻辑删除 (0=未删除,1已删除)';
comment on column CU_MEMBER_AWARDS.pkCreator
  is '创建人';
comment on column CU_MEMBER_AWARDS.creation_time
  is '创建时间';
comment on column CU_MEMBER_AWARDS.pkModified
  is '修改人';
comment on column CU_MEMBER_AWARDS.modified_time
  is '修改时间';
comment on column CU_MEMBER_AWARDS.pk_country
  is '国家';
-- Create/Recreate indexes
create index CU_MEMBER_AWARDS_MEMBER_CODE on CU_MEMBER_AWARDS (MEMBER_CODE)
  tablespace CLOUD
  pctfree 10
  initrans 2
  maxtrans 255
  storage
  (
    initial 64K
    next 1M
    minextents 1
    maxextents unlimited
    pctincrease 0
  );
-- Create/Recreate primary, unique and foreign key constraints
alter table CU_MEMBER_AWARDS
  add constraint CU_MEMBER_AWARDS_PK primary key (PK_ID)
  using index
  tablespace CLOUD
  pctfree 10
  initrans 2
  maxtrans 255
  storage
  (
    initial 64K
    next 1M
    minextents 1
    maxextents unlimited
    pctincrease 0
  );

create sequence CU_MEMBER_AWARDS_SEQ
minvalue 1
maxvalue 999999999999999999999999
start with 1
increment by 1
cache 20;

-- Create table 会员考核记录
create table CU_MEMBER_ASSESS
(
  pk_id         NUMBER(20) not null,
  member_code   VARCHAR2(20) not null,
  settle_month  VARCHAR2(10) not null,
  assess_type   NUMBER(2) not null,
  pk_awards     NUMBER(6) not null,
  assess_target NUMBER(17,6) default 0 not null,
  assess_status NUMBER(2) not null,
  month_balance NUMBER(17,6) default 0 not null,
  month_add     NUMBER(17,6) default 0 not null,
  month_used    NUMBER(17,6) default 0 not null,
  month_surplus NUMBER(17,6) default 0 not null,
  del_flag      NUMBER(1) default 0 not null,
  pkCreator       VARCHAR2(50) not null,
  creation_time DATE default sysdate not null,
  pkModified      VARCHAR2(50),
  modified_time DATE,
  pk_country    NUMBER(4) not null
)
tablespace CLOUD
  pctfree 10
  initrans 1
  maxtrans 255
  storage
  (
    initial 64K
    next 1M
    minextents 1
    maxextents unlimited
    pctincrease 0
  );
-- Add comments to the table
comment on table CU_MEMBER_ASSESS
  is '会员信息-会员考核记录';
-- Add comments to the columns
comment on column CU_MEMBER_ASSESS.pk_id
  is '主键';
comment on column CU_MEMBER_ASSESS.member_code
  is '会员编号';
comment on column CU_MEMBER_ASSESS.settle_month
  is '结算月';
comment on column CU_MEMBER_ASSESS.assess_type
  is '考核类型( 0=复购考核,1=分红考核)';
comment on column CU_MEMBER_ASSESS.pk_awards
  is '考核奖衔';
comment on column CU_MEMBER_ASSESS.assess_target
  is '考核指标';
comment on column CU_MEMBER_ASSESS.assess_status
  is '考核状态 (0=考核通过,1=免考通过,2=考核不通过,3=不考核)';
comment on column CU_MEMBER_ASSESS.month_balance
  is '上月结余业绩';
comment on column CU_MEMBER_ASSESS.month_add
  is '当月新增业绩';
comment on column CU_MEMBER_ASSESS.month_used
  is '当月使用业绩';
comment on column CU_MEMBER_ASSESS.month_surplus
  is '当月剩余业绩';
comment on column CU_MEMBER_ASSESS.del_flag
  is '逻辑删除 (0=未删除,1已删除)';
comment on column CU_MEMBER_ASSESS.pkCreator
  is '创建人';
comment on column CU_MEMBER_ASSESS.creation_time
  is '创建时间';
comment on column CU_MEMBER_ASSESS.pkModified
  is '修改人';
comment on column CU_MEMBER_ASSESS.modified_time
  is '修改时间';
comment on column CU_MEMBER_ASSESS.pk_country
  is '国家';
-- Create/Recreate indexes
create index CU_ASSESSMENT_MEMBER_CODE on CU_MEMBER_ASSESS (MEMBER_CODE)
  tablespace CLOUD
  pctfree 10
  initrans 2
  maxtrans 255
  storage
  (
    initial 64K
    next 1M
    minextents 1
    maxextents unlimited
    pctincrease 0
  );
-- Create/Recreate primary, unique and foreign key constraints
alter table CU_MEMBER_ASSESS
  add constraint CU_MEMBER_ASSESS_PK primary key (PK_ID)
  using index
  tablespace CLOUD
  pctfree 10
  initrans 2
  maxtrans 255
  storage
  (
    initial 64K
    next 1M
    minextents 1
    maxextents unlimited
    pctincrease 0
  );


create sequence CU_MEMBER_ASSESS_SEQ
minvalue 1
maxvalue 999999999999999999999999
start with 1
increment by 1
cache 20;

-- Create table 会员提现记录
create table CU_MEMBER_WITHDRAW
(
  pk_id          NUMBER(20) not null,
  member_code    VARCHAR2(20) not null,
  withdraw_code  VARCHAR2(30) not null,
  pk_account   number(6) not null,
  pk_bank_id     NUMBER(6) not null,
  pk_rate_id     NUMBER(6) not null,
  cash_amount    NUMBER(17,6) not null,
  service_charge NUMBER(17,6) not null,
  income_tax     NUMBER(17,6) not null,
  issued_amount  NUMBER(17,6) not null,
  approve_state  NUMBER(2) not null,
  payment_time   DATE,
  payer          NUMBER(6),
  remarks        VARCHAR2(200),
  del_flag       NUMBER(1),
  pk_country     NUMBER(4) not null,
  pkCreator        VARCHAR2(100) not null,
  creation_time  DATE default sysdate not null,
  pkModified       VARCHAR2(100),
  modified_time  DATE,
  approver       NUMBER(6),
  approve_time   DATE
)
tablespace CLOUD
  pctfree 10
  initrans 1
  maxtrans 255
  storage
  (
    initial 256K
    next 256K
    minextents 1
    maxextents unlimited
    pctincrease 0
  );
-- Add comments to the table
comment on table CU_MEMBER_WITHDRAW
  is '会员提现表';
-- Add comments to the columns
comment on column CU_MEMBER_WITHDRAW.pk_id
  is '主键';
comment on column CU_MEMBER_WITHDRAW.member_code
  is '会员编号';
comment on column CU_MEMBER_WITHDRAW.withdraw_code
  is '申请单号';
comment on column CU_MEMBER_WITHDRAW.pk_account
  is '账号类型(来源参照：币种配置)';
comment on column CU_MEMBER_WITHDRAW.pk_bank_id
  is '银行信息';
comment on column CU_MEMBER_WITHDRAW.pk_rate_id
  is '汇率';
comment on column CU_MEMBER_WITHDRAW.cash_amount
  is '提现金额';
comment on column CU_MEMBER_WITHDRAW.service_charge
  is '手续费';
comment on column CU_MEMBER_WITHDRAW.income_tax
  is '个人所得税';
comment on column CU_MEMBER_WITHDRAW.issued_amount
  is '实发金额';
comment on column CU_MEMBER_WITHDRAW.approve_state
  is '审核状态(1=待提交,2=已提交,3=审核中,4=已驳回,5=已完成,6=已归档)';
comment on column CU_MEMBER_WITHDRAW.payment_time
  is '打款日期';
comment on column CU_MEMBER_WITHDRAW.payer
  is '打款人';
comment on column CU_MEMBER_WITHDRAW.remarks
  is '备注';
comment on column CU_MEMBER_WITHDRAW.del_flag
  is '逻辑删除 (0=未删除,1已删除)';
comment on column CU_MEMBER_WITHDRAW.pk_country
  is '所属国家';
comment on column CU_MEMBER_WITHDRAW.pkCreator
  is '创建人';
comment on column CU_MEMBER_WITHDRAW.creation_time
  is '创建时间';
comment on column CU_MEMBER_WITHDRAW.pkModified
  is '修改人';
comment on column CU_MEMBER_WITHDRAW.modified_time
  is '修改时间';
comment on column CU_MEMBER_WITHDRAW.approver
  is '审核人';
comment on column CU_MEMBER_WITHDRAW.approve_time
  is '审核时间';
-- Create/Recreate indexes
create index CU_WITHDRAW_MEMBER_CODE on CU_MEMBER_WITHDRAW (MEMBER_CODE)
  tablespace CLOUD
  pctfree 10
  initrans 2
  maxtrans 255
  storage
  (
    initial 64K
    next 1M
    minextents 1
    maxextents unlimited
    pctincrease 0
  );
-- Create/Recreate primary, unique and foreign key constraints
alter table CU_MEMBER_WITHDRAW
  add constraint CU_MEMBER_WITHDRAW_PK primary key (PK_ID)
  using index
  tablespace CLOUD
  pctfree 10
  initrans 2
  maxtrans 255
  storage
  (
    initial 64K
    next 1M
    minextents 1
    maxextents unlimited
    pctincrease 0
  );


create sequence CU_MEMBER_WITHDRAW_SEQ
minvalue 1
maxvalue 999999999999999999999999
start with 1
increment by 1
cache 20;

-- Create table 会员转账记录
create table CU_MEMBER_TRANSFER
(
  pk_id           NUMBER(20) not null,
  member_code     VARCHAR2(20) not null,
  transfer_code   VARCHAR2(30) not null,
  pk_account    NUMBER(6) not null,
  to_member_code  VARCHAR2(20) not null,
  pk_to_account NUMBER(6) not null,
  pk_rate         NUMBER(6) not null,
  transfer_money  NUMBER(17,6),
  remarks         VARCHAR2(200),
  approve_state   NUMBER(2) default 1 not null,
  approver        NUMBER(6),
  approve_time    DATE,
  del_flag        NUMBER(1) default 0 not null,
  pkCreator         VARCHAR2(50) not null,
  creation_time   DATE default sysdate not null,
  pkModified        VARCHAR2(50),
  modified_time   DATE,
  pk_country      NUMBER(4) not null
)
tablespace CLOUD
  pctfree 10
  initrans 1
  maxtrans 255
  storage
  (
    initial 64K
    next 1M
    minextents 1
    maxextents unlimited
    pctincrease 0
  );
-- Add comments to the table
comment on table CU_MEMBER_TRANSFER
  is '会员信息-奖衔升级记录';
-- Add comments to the columns
comment on column CU_MEMBER_TRANSFER.pk_id
  is '主键';
comment on column CU_MEMBER_TRANSFER.member_code
  is '转出编号';
comment on column CU_MEMBER_TRANSFER.transfer_code
  is '申请单号';
comment on column CU_MEMBER_TRANSFER.pk_account
  is '账户类型(来源于参照：币种配置)';
comment on column CU_MEMBER_TRANSFER.to_member_code
  is '转入编号';
comment on column CU_MEMBER_TRANSFER.pk_to_account
  is '转入账户类型(来源于参照：币种配置)';
comment on column CU_MEMBER_TRANSFER.pk_rate
  is '汇率';
comment on column CU_MEMBER_TRANSFER.transfer_money
  is '转账金额';
comment on column CU_MEMBER_TRANSFER.remarks
  is '备注';
comment on column CU_MEMBER_TRANSFER.approve_state
  is '审核状态';
comment on column CU_MEMBER_TRANSFER.approver
  is '审核人';
comment on column CU_MEMBER_TRANSFER.approve_time
  is '审核时间';
comment on column CU_MEMBER_TRANSFER.del_flag
  is '逻辑删除 (0=未删除,1已删除)';
comment on column CU_MEMBER_TRANSFER.pkCreator
  is '创建人';
comment on column CU_MEMBER_TRANSFER.creation_time
  is '创建时间';
comment on column CU_MEMBER_TRANSFER.pkModified
  is '修改人';
comment on column CU_MEMBER_TRANSFER.modified_time
  is '修改时间';
comment on column CU_MEMBER_TRANSFER.pk_country
  is '国家';
-- Create/Recreate indexes
create index CU_MEMBER_TRANSFER_MEMBER_CODE on CU_MEMBER_TRANSFER (MEMBER_CODE)
  tablespace CLOUD
  pctfree 10
  initrans 2
  maxtrans 255
  storage
  (
    initial 64K
    next 1M
    minextents 1
    maxextents unlimited
    pctincrease 0
  );
-- Create/Recreate primary, unique and foreign key constraints
alter table CU_MEMBER_TRANSFER
  add constraint CU_MEMBER_TRANSFER_PK primary key (PK_ID)
  using index
  tablespace CLOUD
  pctfree 10
  initrans 2
  maxtrans 255
  storage
  (
    initial 64K
    next 1M
    minextents 1
    maxextents unlimited
    pctincrease 0
  );

create sequence CU_MEMBER_TRANSFER_SEQ
minvalue 1
maxvalue 999999999999999999999999
start with 1
increment by 1
cache 20;


-- Create table
create table CU_MEMBER_TRADE
(
  pk_id          NUMBER(20) not null,
  member_code    VARCHAR2(20) not null,
  trade_code     VARCHAR2(30) not null,
  pk_account     NUMBER(6) not null,
  trade_type     NUMBER(2) not null,
  trade_classify NUMBER(2) not null,
  pk_rate_id     NUMBER(6) not null,
  trade_amount   NUMBER(17,6) not null,
  trade_balance  NUMBER(17,6) not null,
  source_code    VARCHAR2(30) not null,
  trade_statue   NUMBER(2) not null,
  remarks        VARCHAR2(200),
  del_flag       NUMBER(1) default 0 not null,
  pk_country     NUMBER(4) default 1 not null,
  pkCreator        VARCHAR2(100) not null,
  creation_time  DATE default sysdate not null,
  pkModified       VARCHAR2(100),
  modified_time  DATE
)
tablespace CLOUD
  pctfree 10
  initrans 1
  maxtrans 255
  storage
  (
    initial 256K
    next 256K
    minextents 1
    maxextents unlimited
    pctincrease 0
  );
-- Add comments to the table
comment on table CU_MEMBER_TRADE
  is '会员交易明细';
-- Add comments to the columns
comment on column CU_MEMBER_TRADE.pk_id
  is '主键';
comment on column CU_MEMBER_TRADE.member_code
  is '会员编号';
comment on column CU_MEMBER_TRADE.trade_code
  is '交易编号';
comment on column CU_MEMBER_TRADE.pk_account
  is '账户类型(来源于参照：币种配置)';
comment on column CU_MEMBER_TRADE.trade_type
  is '交易类型:(10充值, 11转账, 12收益发放, 13转换, 14提现, 15提现撤回, 16提现拒绝, 17注册订单, 18升级订单, 19复购订单, 20圣宝云代注册, 21圣宝云代升级, 22圣宝云代复购, 23商城vip, 24返还补偿鼓励币, 25返还本金鼓励币, 26扣减抢拼现金币, 27撤单返钱, 28返还本金, 30抢拼专区, 31兑换专区, 40领取红包, 50发放复购券, 51复购券撤单, 52使用复购券, 54圣宝云代使用复购券)';
comment on column CU_MEMBER_TRADE.trade_classify
  is '交易分:(1=消费 2=提现 3=转账 4=充值 5=收益)';
comment on column CU_MEMBER_TRADE.pk_rate_id
  is '汇率';
comment on column CU_MEMBER_TRADE.trade_amount
  is '交易金额';
comment on column CU_MEMBER_TRADE.trade_balance
  is '交易余额';
comment on column CU_MEMBER_TRADE.source_code
  is '来源单号';
comment on column CU_MEMBER_TRADE.trade_statue
  is '交易状态:(1=可消费 2=生效)';
comment on column CU_MEMBER_TRADE.remarks
  is '备注';
comment on column CU_MEMBER_TRADE.del_flag
  is '逻辑删除 (0=未删除,1已删除)';
comment on column CU_MEMBER_TRADE.pk_country
  is '所属国家';
comment on column CU_MEMBER_TRADE.pkCreator
  is '创建人';
comment on column CU_MEMBER_TRADE.creation_time
  is '创建时间';
comment on column CU_MEMBER_TRADE.pkModified
  is '修改人';
comment on column CU_MEMBER_TRADE.modified_time
  is '修改时间';
-- Create/Recreate indexes
create index CU_MEMBER_TRADE_MEMBER_CODE on CU_MEMBER_TRADE (MEMBER_CODE)
  tablespace CLOUD
  pctfree 10
  initrans 2
  maxtrans 255
  storage
  (
    initial 64K
    next 1M
    minextents 1
    maxextents unlimited
    pctincrease 0
  );
-- Create/Recreate primary, unique and foreign key constraints
alter table CU_MEMBER_TRADE
  add constraint CU_MEMBER_TRADE_PK primary key (PK_ID)
  using index
  tablespace CLOUD
  pctfree 10
  initrans 2
  maxtrans 255
  storage
  (
    initial 64K
    next 1M
    minextents 1
    maxextents unlimited
    pctincrease 0
  );


create sequence CU_MEMBER_TRADE_SEQ
minvalue 1
maxvalue 999999999999999999999999
start with 1
increment by 1
cache 20;

-- Create table
create table CU_MEMBER_TEAM
(
  pk_id          NUMBER(20) not null,
  member_code    VARCHAR2(20) not null,
  team_name      VARCHAR2(100) not null,
  pk_transaction NUMBER(8),
  del_flag       NUMBER(1) default 0 not null,
  pk_country     NUMBER(4) default 1 not null,
  pkCreator        VARCHAR2(100) not null,
  creation_time  DATE default sysdate not null,
  pkModified       VARCHAR2(100),
  modified_time  DATE
)
tablespace CLOUD
  pctfree 10
  initrans 1
  maxtrans 255
  storage
  (
    initial 256K
    next 256K
    minextents 1
    maxextents unlimited
    pctincrease 0
  );
-- Add comments to the table
comment on table CU_MEMBER_TEAM
  is '会员所属团队';
-- Add comments to the columns
comment on column CU_MEMBER_TEAM.pk_id
  is '主键';
comment on column CU_MEMBER_TEAM.member_code
  is '会员编号';
comment on column CU_MEMBER_TEAM.team_name
  is '团队名称';
comment on column CU_MEMBER_TEAM.pk_transaction
  is '统一翻译,来源于统一翻译';
comment on column CU_MEMBER_TEAM.del_flag
  is '逻辑删除 (0=未删除,1已删除)';
comment on column CU_MEMBER_TEAM.pk_country
  is '所属国家';
comment on column CU_MEMBER_TEAM.pkCreator
  is '创建人';
comment on column CU_MEMBER_TEAM.creation_time
  is '创建时间';
comment on column CU_MEMBER_TEAM.pkModified
  is '修改人';
comment on column CU_MEMBER_TEAM.modified_time
  is '修改时间';
-- Create/Recreate indexes
create index CU_MEMBER_TEAM_MEMBER_CODE on CU_MEMBER_TEAM (MEMBER_CODE)
  tablespace CLOUD
  pctfree 10
  initrans 2
  maxtrans 255
  storage
  (
    initial 64K
    next 1M
    minextents 1
    maxextents unlimited
    pctincrease 0
  );
-- Create/Recreate primary, unique and foreign key constraints
alter table CU_MEMBER_TEAM
  add constraint CU_MEMBER_TEAM_PK primary key (PK_ID)
  using index
  tablespace CLOUD
  pctfree 10
  initrans 2
  maxtrans 255
  storage
  (
    initial 64K
    next 1M
    minextents 1
    maxextents unlimited
    pctincrease 0
  );


create sequence cu_member_team_SEQ
minvalue 1
maxvalue 999999999999999999999999
start with 1
increment by 1
cache 20;
