platformbiz/models/mysql.ddl.sql
2024-11-30 17:18:28 +08:00

397 lines
7.6 KiB
SQL

-- ./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',
`prodtypeid` VARCHAR(32) comment '产品类型id',
`orgid` VARCHAR(32) comment '产品机构',
`providerid` VARCHAR(32) comment '供应商编号',
`agreeid` VARCHAR(32) comment '分销协议id',
`providerpid` VARCHAR(255) comment '供应方产品id',
`name` VARCHAR(255) comment '名称',
`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 '规格数据',
`create_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP comment '生成时间戳'
,primary key(id)
)
engine=innodb
default charset=utf8
comment '客户资源'
;
-- ./supportedpayment.xlsx
drop table if exists supportedpayment;
CREATE TABLE supportedpayment
(
`id` VARCHAR(32) comment 'id',
`name` VARCHAR(100) comment '支付名称',
`description` VARCHAR(400) comment '描述',
`appid` VARCHAR(400) comment 'appid',
`ak` VARCHAR(4000) comment 'ak',
`sk` VARCHAR(4000) comment 'sk',
`callback_path` VARCHAR(400) 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',
`order_date` date comment '订单日期',
`order_status` VARCHAR(1) comment '订单状态',
`business_op` VARCHAR(255) comment '业务操作',
`amount` double(18,2) comment '金额',
`provider_orderid` VARCHAR(256) comment '供应商orderid',
`specdataid` VARCHAR(32) comment '规格数据id',
`userid` VARCHAR(32) comment '用户id',
`thirdparty_order` VARCHAR(32) comment '第三方订单号',
`refund` VARCHAR(32) comment '退费金额',
`source` VARCHAR(10) comment '订单来源网站',
`originalprice` VARCHAR(16) comment '原价',
`ordertype` VARCHAR(10) comment '订单类型',
`servicename` VARCHAR(64) comment '产品名称',
`pay_date` TIMESTAMP DEFAULT CURRENT_TIMESTAMP comment '支付时间',
`del_flg` VARCHAR(1) DEFAULT '0' comment '删除标志',
`create_at` 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` None comment '优惠券类型id',
`customerid` VARCHAR(32) comment '客户id',
`amount` double(18,2) comment '金额',
`enable_date` None comment '启用日期',
`expire_date` None 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 '模型计费'
;
-- ./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',
`providerid` VARCHAR(32) comment '供应商机构id',
`resellerid` VARCHAR(32) comment '商户id',
`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 '分销协议'
;