
-- ./coupontype.xlsx





drop table if exists coupontype;
CREATE TABLE coupontype
(

  `id` VARCHAR(32)   comment 'id',
  `orgid` VARCHAR(32)   comment '发放机构',
  `name` VARCHAR(100)   comment '优惠券名',
  `use_ptids` VARCHAR(4000)   comment '可用产品id集',
  `void_ptids` VARCHAR(4000)   comment '不可用产品id集',
  `mintransamt` double(18,2)   comment '最低交易金额',
  `use_multiple` VARCHAR(1)   comment '是否可用多张',
  `with_others` VARCHAR(1)   comment '是否与其他优惠券同用',
  `issue_action` VARCHAR(100)   comment '发放客户动作',
  `issue_condition` VARCHAR(1000)   comment '发放条件'


,primary key(id)


)
engine=innodb 
default charset=utf8 
comment '优惠券类型'
;


-- ./product.xlsx





drop table if exists product;
CREATE TABLE product
(

  `id` VARCHAR(32)   comment 'id',
  `name` VARCHAR(100)   comment '产品名称',
  `prodtypeid` VARCHAR(32)   comment '产品类型id',
  `orgid` VARCHAR(32)   comment '产品机构',
  `providerid` VARCHAR(32)   comment '供应商编号',
  `agreeid` VARCHAR(32)   comment '分销协议id',
  `providerpid` VARCHAR(255)   comment '供应方产品id',
  `description` VARCHAR(255)   comment '描述',
  `prod_state` VARCHAR(32)   comment '状态',
  `product_code` VARCHAR(100)   comment '产品编码',
  `spec_note` VARCHAR(400)   comment '规格说明',
  `specific_pattern` VARCHAR(32)   comment '规格模版id'


,primary key(id)


)
engine=innodb 
default charset=utf8 
comment '产品'
;


-- ./prodpricing.xlsx





drop table if exists prodpricing;
CREATE TABLE prodpricing
(

  `id` VARCHAR(32)   comment 'id',
  `prodid` VARCHAR(32)   comment '产品id',
  `enable_date` date   comment '开始日期',
  `expired_date` date   comment '失效日期',
  `pricing_mode` VARCHAR(1)   comment '计费模式',
  `fact_name` VARCHAR(100)   comment '因子名',
  `fact_value` double(18,2)   comment '计费因子值',
  `unit_price` double(18,4)   comment '单价'


,primary key(id)


)
engine=innodb 
default charset=utf8 
comment '模型计费'
;


-- ./agreeproduct.xlsx





drop table if exists agreeproduct;
CREATE TABLE agreeproduct
(

  `id` VARCHAR(32)   comment 'id',
  `agreeid` VARCHAR(32)   comment '协议id',
  `providerpid` VARCHAR(32)   comment '供应方产品id',
  `resellerpid` VARCHAR(32)   comment '商户产品id'


,primary key(id)


)
engine=innodb 
default charset=utf8 
comment '协议授权产品'
;


-- ./resource.xlsx





drop table if exists resource;
CREATE TABLE resource
(

  `id` VARCHAR(32)   comment 'id',
  `orgid` VARCHAR(32)   comment '机构id',
  `resellerid` VARCHAR(32)   comment '商户id',
  `prodid` VARCHAR(32)   comment '产品id',
  `providerrid` VARCHAR(100)   comment '供应商资源id',
  `attachedrid` VARCHAR(32)   comment '关联产品id',
  `enable_date` date   comment '开始日期',
  `expired_date` date   comment '失效日期',
  `spec_data` VARCHAR(4000)   comment '规格数据'


,primary key(id)


)
engine=innodb 
default charset=utf8 
comment '客户资源'
;


-- ./prodtype.xlsx





drop table if exists prodtype;
CREATE TABLE prodtype
(

  `id` VARCHAR(32)   comment 'id',
  `name` VARCHAR(100)   comment '产品类型名称',
  `enable_date` date   comment '启用日期',
  `expire_date` date   comment '失效日期',
  `parentid` VARCHAR(32)   comment '父类型'


,primary key(id)


)
engine=innodb 
default charset=utf8 
comment '产品类型'
;


-- ./biz_order.xlsx





drop table if exists biz_order;
CREATE TABLE biz_order
(

  `id` VARCHAR(32)   comment 'id',
  `customerid` VARCHAR(32)   comment '客户id',
  `resellerid` VARCHAR(32)   comment '分销商id',
  `order_date` date   comment '订单日期',
  `order_status` VARCHAR(1)   comment '订单状态',
  `business_op` VARCHAR(255)   comment '业务操作',
  `amount` double(18,2)   comment '金额',
  `up_orderid` VARCHAR(256)   comment '上位系统orderid',
  `down_orderid` VARCHAR(256)   comment '下位系统orderid',
  `specdataid` VARCHAR(32)   comment '规格数据id',
  `userid` VARCHAR(32)   comment '用户id',
  `refund` VARCHAR(32)   comment '退费金额',
  `source` VARCHAR(10)   comment '订单来源网站',
  `originalprice` VARCHAR(16)   comment '原价',
  `ordertype` VARCHAR(10)   comment '订单类型',
  `productid` VARCHAR(64)   comment '产品id',
  `pay_date` TIMESTAMP DEFAULT CURRENT_TIMESTAMP   comment '支付时间'


,primary key(id)


)
engine=innodb 
default charset=utf8 
comment '订单'
;


-- ./coupon.xlsx





drop table if exists coupontype;
CREATE TABLE coupontype
(

  `id` VARCHAR(32)   comment 'id',
  `coupontypeid` VARCHAR(32)   comment '优惠券类型id',
  `customerid` VARCHAR(32)   comment '客户id',
  `amount` double(18,2)   comment '金额',
  `enable_date` date   comment '启用日期',
  `expire_date` date   comment '失效日期',
  `resellerid` VARCHAR(32)   comment '商户id',
  `orderid` VARCHAR(32)   comment '订单id',
  `use_timestamp` TIMESTAMP DEFAULT CURRENT_TIMESTAMP   comment '使用时间',
  `coupon_state` VARCHAR(1)   comment '状态'


,primary key(id)


)
engine=innodb 
default charset=utf8 
comment '优惠券类型'
;


-- ./agreedetail.xlsx





drop table if exists agreementdetail;
CREATE TABLE agreementdetail
(

  `id` VARCHAR(32)   comment 'id',
  `agreeid` VARCHAR(32)   comment '协议id',
  `prodtypeids` VARCHAR(3200)   comment '产品类型id集',
  `pricing_mode` VARCHAR(1)   comment '计费类型',
  `discount` double(18,4)   comment '折扣',
  `step_type` VARCHAR(1)   comment '阶梯类型'


,primary key(id)


)
engine=innodb 
default charset=utf8 
comment '协议明细'
;


-- ./prodpricingtab.xlsx





drop table if exists prodpricingtab;
CREATE TABLE prodpricingtab
(

  `id` VARCHAR(32)   comment 'id',
  `prodid` VARCHAR(32)   comment '产品id',
  `fact_value` VARCHAR(400)   comment '因子值',
  `unit_amt` double(18,4)   comment '价格值'


,primary key(id)


)
engine=innodb 
default charset=utf8 
comment '模型计费'
;


-- ./paychannel.xlsx





drop table if exists paychannel;
CREATE TABLE paychannel
(

  `id` VARCHAR(32)   comment 'id',
  `name` VARCHAR(32)   comment '名字',
  `feerate` double(18,4)   comment '费率',
  `enable_date` VARCHAR(32)   comment '启用日期',
  `expore_date` double(18,2)   comment '停用日期'


,primary key(id)


)
engine=innodb 
default charset=utf8 
comment '支付渠道'
;


-- ./agreedetailstep.xlsx





drop table if exists agreedetailstep;
CREATE TABLE agreedetailstep
(

  `id` VARCHAR(32)   comment 'id',
  `adid` VARCHAR(32)   comment '协议明细id',
  `minamt` double(18,2)   comment '最低金额',
  `maxamt` double(18,2)   comment '最大金额',
  `discount` double(18,4)   comment '折扣值'


,primary key(id)


)
engine=innodb 
default charset=utf8 
comment '协议阶梯折扣'
;


-- ./agreement.xlsx





drop table if exists agreement;
CREATE TABLE agreement
(

  `id` VARCHAR(32)   comment 'id',
  `name` VARCHAR(100)   comment '协议名称',
  `providerid` VARCHAR(32)   comment '供应商机构id',
  `resellerid` VARCHAR(32) NOT NULL  comment '商户id',
  `prodpricing_mode` VARCHAR(1) NOT NULL  comment '产品计价模式',
  `settle_mode` VARCHAR(1)   comment '结算方式',
  `settle_dp` VARCHAR(255)   comment '结算日期模版',
  `protocolfile` VARCHAR(255)   comment '协议文件',
  `start_date` date   comment '起效日期',
  `end_date` date   comment '失效日期',
  `auto_renew` VARCHAR(1)   comment '自动续期',
  `agree_state` VARCHAR(1)   comment '协议状态'


,primary key(id)


)
engine=innodb 
default charset=utf8 
comment '分销协议'
;


-- ./recharge_log.xlsx





drop table if exists recharge_log;
CREATE TABLE recharge_log
(

  `id` VARCHAR(32)   comment 'id',
  `customerid` VARCHAR(32)   comment '客户id',
  `userid` VARCHAR(32)   comment '用户id',
  `action` VARCHAR(32)   comment '动作',
  `recharge_amt` double(18,2)   comment '充值金额',
  `fee_rate` double(18,4)   comment '充值费率',
  `fee_amt` VARCHAR(18)   comment '充值费用',
  `pcid` VARCHAR(32)   comment '支付渠道id',
  `biz_orderid` VARCHAR(32)   comment '订单号',
  `channel_tid` VARCHAR(256)   comment '渠道交易id',
  `recharge_status` VARCHAR(1)   comment '充值状态',
  `transdate` date   comment '充值日期',
  `timestamp` TIMESTAMP DEFAULT CURRENT_TIMESTAMP   comment '时间戳'


,primary key(id)


)
engine=innodb 
default charset=utf8 
comment '充值日志'
;


